summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2020-11-10 13:59:25 (GMT)
committerculler <culler>2020-11-10 13:59:25 (GMT)
commitd94200fdcf927707b43670e7751208ea902b382e (patch)
treec8f724ce055955eef67c4b799866138c5389715d
parenta49d6e52a72b1f086503ae32cb28b0da62e5fa99 (diff)
parent6133a711414cfb8fcc3a8b52ecf25b59a09e5800 (diff)
downloadtk-d94200fdcf927707b43670e7751208ea902b382e.zip
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.gz
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.bz2
Merge main
-rw-r--r--.fossil-settings/encoding-glob6
-rw-r--r--.fossil-settings/ignore-glob13
-rw-r--r--.fossil-settings/manifest1
-rw-r--r--.gitattributes43
-rw-r--r--.gitignore45
-rw-r--r--.travis.yml195
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.20042
-rw-r--r--changes8
-rw-r--r--doc/CrtImgType.344
-rw-r--r--doc/EventHndlr.317
-rw-r--r--doc/GetFont.38
-rw-r--r--doc/GetPixels.38
-rw-r--r--doc/GetScroll.37
-rw-r--r--doc/ImgChanged.38
-rw-r--r--doc/MaintGeom.386
-rw-r--r--doc/ManageGeom.318
-rw-r--r--doc/NameOfImg.36
-rw-r--r--doc/SetOptions.32
-rw-r--r--doc/WindowId.312
-rw-r--r--doc/bind.n23
-rw-r--r--doc/bitmap.n2
-rw-r--r--doc/button.n2
-rw-r--r--doc/canvas.n11
-rw-r--r--doc/checkbutton.n2
-rw-r--r--doc/clipboard.n2
-rw-r--r--doc/colors.n121
-rw-r--r--doc/console.n9
-rw-r--r--doc/entry.n5
-rw-r--r--doc/event.n2
-rw-r--r--doc/focus.n2
-rw-r--r--doc/font.n2
-rw-r--r--doc/fontchooser.n4
-rw-r--r--doc/frame.n4
-rw-r--r--doc/grab.n2
-rw-r--r--doc/grid.n263
-rw-r--r--doc/image.n2
-rw-r--r--doc/label.n2
-rw-r--r--doc/labelframe.n4
-rw-r--r--doc/listbox.n5
-rw-r--r--doc/loadTk.n14
-rw-r--r--doc/menu.n2
-rw-r--r--doc/menubar.n2
-rw-r--r--doc/menubutton.n2
-rw-r--r--doc/message.n2
-rw-r--r--doc/options.n3
-rw-r--r--doc/pack.n204
-rw-r--r--doc/panedwindow.n4
-rw-r--r--doc/photo.n6
-rw-r--r--doc/place.n114
-rw-r--r--doc/radiobutton.n2
-rw-r--r--doc/scale.n2
-rw-r--r--doc/scrollbar.n9
-rw-r--r--doc/selection.n4
-rw-r--r--doc/send.n2
-rw-r--r--doc/spinbox.n5
-rw-r--r--doc/text.n16
-rw-r--r--doc/tk.n2
-rw-r--r--doc/tk_mac.n16
-rw-r--r--doc/toplevel.n2
-rw-r--r--doc/ttk_Geometry.318
-rw-r--r--doc/ttk_combobox.n6
-rw-r--r--doc/ttk_entry.n6
-rw-r--r--doc/ttk_intro.n2
-rw-r--r--doc/ttk_notebook.n10
-rw-r--r--doc/ttk_spinbox.n8
-rw-r--r--doc/ttk_style.n91
-rw-r--r--doc/ttk_widget.n12
-rw-r--r--doc/winfo.n2
-rw-r--r--doc/wish.12
-rw-r--r--doc/wm.n14
-rw-r--r--generic/nanosvg.h442
-rw-r--r--generic/nanosvgrast.h200
-rw-r--r--generic/tk.decls85
-rw-r--r--generic/tk.h73
-rw-r--r--generic/tkBind.c290
-rw-r--r--generic/tkBusy.c20
-rw-r--r--generic/tkButton.c2
-rw-r--r--generic/tkCanvArc.c39
-rw-r--r--generic/tkCanvLine.c65
-rw-r--r--generic/tkCanvPoly.c22
-rw-r--r--generic/tkCanvPs.c4
-rw-r--r--generic/tkCanvText.c39
-rw-r--r--generic/tkCanvUtil.c2
-rw-r--r--generic/tkCanvWind.c16
-rw-r--r--generic/tkCanvas.c52
-rw-r--r--generic/tkClipboard.c17
-rw-r--r--generic/tkCmds.c41
-rw-r--r--generic/tkConfig.c182
-rw-r--r--generic/tkConsole.c38
-rw-r--r--generic/tkDecls.h66
-rw-r--r--generic/tkEntry.c92
-rw-r--r--generic/tkEvent.c47
-rw-r--r--generic/tkFileFilter.h8
-rw-r--r--generic/tkFocus.c8
-rw-r--r--generic/tkFont.c129
-rw-r--r--generic/tkFont.h8
-rw-r--r--generic/tkFrame.c18
-rw-r--r--generic/tkGeometry.c380
-rw-r--r--generic/tkGet.c3
-rw-r--r--generic/tkGrab.c34
-rw-r--r--generic/tkGrid.c1258
-rw-r--r--generic/tkImage.c259
-rw-r--r--generic/tkImgBmap.c270
-rw-r--r--generic/tkImgPNG.c10
-rw-r--r--generic/tkImgPPM.c28
-rw-r--r--generic/tkImgPhInstance.c187
-rw-r--r--generic/tkImgPhoto.c755
-rw-r--r--generic/tkImgPhoto.h32
-rw-r--r--generic/tkImgSVGnano.c10
-rw-r--r--generic/tkInt.decls37
-rw-r--r--generic/tkInt.h72
-rw-r--r--generic/tkIntDecls.h45
-rw-r--r--generic/tkIntPlatDecls.h34
-rw-r--r--generic/tkIntXlibDecls.h14
-rw-r--r--generic/tkListbox.c18
-rw-r--r--generic/tkMain.c17
-rw-r--r--generic/tkMenu.c114
-rw-r--r--generic/tkMenu.h16
-rw-r--r--generic/tkMenubutton.c3
-rw-r--r--generic/tkMessage.c2
-rw-r--r--generic/tkObj.c9
-rw-r--r--generic/tkOldConfig.c43
-rw-r--r--generic/tkOldTest.c60
-rw-r--r--generic/tkOption.c11
-rw-r--r--generic/tkPack.c788
-rw-r--r--generic/tkPanedWindow.c851
-rw-r--r--generic/tkPkgConfig.c7
-rw-r--r--generic/tkPlace.c777
-rw-r--r--generic/tkPlatDecls.h116
-rw-r--r--generic/tkPointer.c9
-rw-r--r--generic/tkScale.c12
-rw-r--r--generic/tkScrollbar.c14
-rw-r--r--generic/tkSelect.c8
-rw-r--r--generic/tkSquare.c2
-rw-r--r--generic/tkStubInit.c89
-rw-r--r--generic/tkStyle.c13
-rw-r--r--generic/tkTest.c201
-rw-r--r--generic/tkText.c96
-rw-r--r--generic/tkText.h4
-rw-r--r--generic/tkTextBTree.c20
-rw-r--r--generic/tkTextDisp.c165
-rw-r--r--generic/tkTextImage.c54
-rw-r--r--generic/tkTextIndex.c2
-rw-r--r--generic/tkTextMark.c45
-rw-r--r--generic/tkTextTag.c6
-rw-r--r--generic/tkTextWind.c54
-rw-r--r--generic/tkUtil.c17
-rw-r--r--generic/tkWindow.c48
-rw-r--r--generic/ttk/ttkBlink.c2
-rw-r--r--generic/ttk/ttkButton.c6
-rw-r--r--generic/ttk/ttkClamTheme.c2
-rw-r--r--generic/ttk/ttkClassicTheme.c2
-rw-r--r--generic/ttk/ttkEntry.c65
-rw-r--r--generic/ttk/ttkFrame.c60
-rw-r--r--generic/ttk/ttkImage.c10
-rw-r--r--generic/ttk/ttkInit.c22
-rw-r--r--generic/ttk/ttkLabel.c19
-rw-r--r--generic/ttk/ttkLayout.c10
-rw-r--r--generic/ttk/ttkManager.c355
-rw-r--r--generic/ttk/ttkManager.h77
-rw-r--r--generic/ttk/ttkNotebook.c276
-rw-r--r--generic/ttk/ttkPanedwindow.c213
-rw-r--r--generic/ttk/ttkProgress.c35
-rw-r--r--generic/ttk/ttkScale.c22
-rw-r--r--generic/ttk/ttkScroll.c8
-rw-r--r--generic/ttk/ttkScrollbar.c19
-rw-r--r--generic/ttk/ttkSeparator.c2
-rw-r--r--generic/ttk/ttkSquare.c19
-rw-r--r--generic/ttk/ttkStubInit.c2
-rw-r--r--generic/ttk/ttkStubLib.c2
-rw-r--r--generic/ttk/ttkTheme.c41
-rw-r--r--generic/ttk/ttkTrace.c14
-rw-r--r--generic/ttk/ttkTreeview.c52
-rw-r--r--generic/ttk/ttkWidget.c2
-rw-r--r--generic/ttk/ttkWidget.h5
-rw-r--r--library/bgerror.tcl20
-rw-r--r--library/button.tcl10
-rw-r--r--library/choosedir.tcl2
-rw-r--r--library/clrpick.tcl2
-rw-r--r--library/comdlg.tcl11
-rw-r--r--library/console.tcl39
-rw-r--r--library/demos/bind.tcl12
-rw-r--r--library/demos/cscroll.tcl56
-rw-r--r--library/demos/ctext.tcl6
-rw-r--r--library/demos/dialog1.tcl14
-rw-r--r--library/demos/entry3.tcl2
-rw-r--r--library/demos/floor.tcl9
-rw-r--r--library/demos/fontchoose.tcl6
-rw-r--r--library/demos/goldberg.tcl8
-rw-r--r--library/demos/items.tcl21
-rw-r--r--library/demos/ixset2
-rw-r--r--library/demos/knightstour.tcl16
-rw-r--r--library/demos/menu.tcl2
-rw-r--r--library/demos/pendulum.tcl4
-rw-r--r--library/demos/tclIndex118
-rw-r--r--library/demos/tcolor2
-rw-r--r--library/demos/toolbar.tcl2
-rw-r--r--library/demos/ttkbut.tcl2
-rw-r--r--library/demos/ttkprogress.tcl2
-rw-r--r--library/demos/unicodeout.tcl50
-rw-r--r--library/demos/widget11
-rw-r--r--library/dialog.tcl4
-rw-r--r--library/entry.tcl63
-rw-r--r--library/focus.tcl2
-rw-r--r--library/fontchooser.tcl49
-rw-r--r--library/iconlist.tcl37
-rw-r--r--library/icons.tcl2
-rw-r--r--library/listbox.tcl96
-rw-r--r--library/megawidget.tcl4
-rw-r--r--library/menu.tcl8
-rw-r--r--library/msgbox.tcl2
-rw-r--r--library/msgs/da.msg30
-rw-r--r--library/msgs/de.msg2
-rw-r--r--library/obsolete.tcl4
-rw-r--r--library/optMenu.tcl4
-rw-r--r--library/palette.tcl2
-rw-r--r--library/safetk.tcl82
-rw-r--r--library/scale.tcl12
-rw-r--r--library/scrlbar.tcl41
-rw-r--r--library/spinbox.tcl45
-rw-r--r--library/tclIndex1
-rw-r--r--library/tearoff.tcl18
-rw-r--r--library/text.tcl129
-rw-r--r--library/tk.tcl34
-rw-r--r--library/tkfbox.tcl2
-rw-r--r--library/ttk/button.tcl2
-rw-r--r--library/ttk/combobox.tcl25
-rw-r--r--library/ttk/entry.tcl24
-rw-r--r--library/ttk/fonts.tcl2
-rw-r--r--library/ttk/menubutton.tcl4
-rw-r--r--library/ttk/notebook.tcl9
-rw-r--r--library/ttk/scrollbar.tcl21
-rw-r--r--library/ttk/spinbox.tcl53
-rw-r--r--library/ttk/ttk.tcl34
-rw-r--r--library/ttk/utils.tcl84
-rw-r--r--library/ttk/vistaTheme.tcl14
-rw-r--r--library/xmfbox.tcl4
-rw-r--r--macosx/Credits.html.in24
-rw-r--r--macosx/GNUmakefile32
-rw-r--r--macosx/README82
-rw-r--r--macosx/Tk-Common.xcconfig2
-rw-r--r--macosx/Tk.xcode/project.pbxproj4
-rw-r--r--macosx/Tk.xcodeproj/project.pbxproj4
-rw-r--r--macosx/tkMacOSX.h2
-rw-r--r--macosx/tkMacOSXBitmap.c9
-rw-r--r--macosx/tkMacOSXButton.c42
-rw-r--r--macosx/tkMacOSXClipboard.c11
-rw-r--r--macosx/tkMacOSXColor.c824
-rw-r--r--macosx/tkMacOSXColor.h198
-rw-r--r--macosx/tkMacOSXConstants.h12
-rw-r--r--macosx/tkMacOSXCursor.c75
-rw-r--r--macosx/tkMacOSXDefault.h40
-rw-r--r--macosx/tkMacOSXDialog.c184
-rw-r--r--macosx/tkMacOSXDraw.c852
-rw-r--r--macosx/tkMacOSXEmbed.c55
-rw-r--r--macosx/tkMacOSXEntry.c8
-rw-r--r--macosx/tkMacOSXEvent.c49
-rw-r--r--macosx/tkMacOSXFont.c50
-rw-r--r--macosx/tkMacOSXHLEvents.c85
-rw-r--r--macosx/tkMacOSXImage.c654
-rw-r--r--macosx/tkMacOSXInit.c243
-rw-r--r--macosx/tkMacOSXInt.h25
-rw-r--r--macosx/tkMacOSXKeyEvent.c44
-rw-r--r--macosx/tkMacOSXKeyboard.c13
-rw-r--r--macosx/tkMacOSXKeysyms.h4
-rw-r--r--macosx/tkMacOSXMenu.c179
-rw-r--r--macosx/tkMacOSXMenubutton.c15
-rw-r--r--macosx/tkMacOSXMenus.c29
-rw-r--r--macosx/tkMacOSXMouseEvent.c402
-rw-r--r--macosx/tkMacOSXNotify.c187
-rw-r--r--macosx/tkMacOSXPort.h39
-rw-r--r--macosx/tkMacOSXPrivate.h97
-rw-r--r--macosx/tkMacOSXRegion.c50
-rw-r--r--macosx/tkMacOSXScale.c36
-rw-r--r--macosx/tkMacOSXScrlbr.c20
-rw-r--r--macosx/tkMacOSXSend.c2
-rw-r--r--macosx/tkMacOSXServices.c9
-rw-r--r--macosx/tkMacOSXSubwindows.c361
-rw-r--r--macosx/tkMacOSXTest.c115
-rw-r--r--macosx/tkMacOSXWindowEvent.c506
-rw-r--r--macosx/tkMacOSXWm.c722
-rw-r--r--macosx/tkMacOSXWm.h8
-rw-r--r--macosx/tkMacOSXXStubs.c36
-rw-r--r--macosx/ttkMacOSXTheme.c224
-rw-r--r--tests/all.tcl8
-rw-r--r--tests/bell.test4
-rw-r--r--tests/bgerror.test4
-rw-r--r--tests/bind.test444
-rw-r--r--tests/bitmap.test4
-rw-r--r--tests/border.test4
-rw-r--r--tests/busy.test18
-rw-r--r--tests/button.test86
-rw-r--r--tests/canvImg.test37
-rw-r--r--tests/canvMoveto.test8
-rw-r--r--tests/canvPs.test8
-rw-r--r--tests/canvRect.test4
-rw-r--r--tests/canvText.test25
-rw-r--r--tests/canvWind.test4
-rw-r--r--tests/canvas.test244
-rw-r--r--tests/choosedir.test4
-rw-r--r--tests/clipboard.test8
-rw-r--r--tests/clrpick.test4
-rw-r--r--tests/cmds.test4
-rw-r--r--tests/color.test8
-rw-r--r--tests/config.test54
-rw-r--r--tests/constraints.tcl14
-rw-r--r--tests/cursor.test4
-rw-r--r--tests/dialog.test6
-rw-r--r--tests/embed.test4
-rw-r--r--tests/entry.test267
-rw-r--r--tests/event.test6
-rw-r--r--tests/filebox.test6
-rw-r--r--tests/focus.test15
-rw-r--r--tests/focusTcl.test4
-rw-r--r--tests/font.test516
-rw-r--r--tests/fontchooser.test29
-rw-r--r--tests/frame.test70
-rw-r--r--tests/geometry.test8
-rw-r--r--tests/get.test4
-rw-r--r--tests/grab.test4
-rw-r--r--tests/grid.test146
-rw-r--r--tests/image.test35
-rw-r--r--tests/imgBmap.test26
-rw-r--r--tests/imgListFormat.test4
-rw-r--r--tests/imgPNG.test10
-rw-r--r--tests/imgPPM.test4
-rw-r--r--tests/imgPhoto.test105
-rw-r--r--tests/imgSVGnano.test34
-rw-r--r--tests/listbox.test181
-rw-r--r--tests/main.test11
-rw-r--r--tests/menu.test64
-rw-r--r--tests/menuDraw.test6
-rw-r--r--tests/menubut.test30
-rw-r--r--tests/message.test20
-rw-r--r--tests/msgbox.test4
-rw-r--r--tests/obj.test4
-rw-r--r--tests/oldpack.test26
-rw-r--r--tests/option.test8
-rw-r--r--tests/pack.test112
-rw-r--r--tests/packgrid.test58
-rw-r--r--tests/panedwindow.test228
-rw-r--r--tests/pkgconfig.test12
-rw-r--r--tests/place.test122
-rw-r--r--tests/raise.test6
-rw-r--r--tests/safe.test65
-rw-r--r--tests/safePrimarySelection.test370
-rw-r--r--tests/scale.test68
-rw-r--r--tests/scrollbar.test104
-rw-r--r--tests/select.test21
-rw-r--r--tests/send.test19
-rw-r--r--tests/spinbox.test243
-rw-r--r--tests/text.test413
-rw-r--r--tests/textBTree.test6
-rw-r--r--tests/textDisp.test219
-rw-r--r--tests/textImage.test2
-rw-r--r--tests/textIndex.test42
-rw-r--r--tests/textMark.test10
-rw-r--r--tests/textTag.test35
-rw-r--r--tests/textWind.test42
-rw-r--r--tests/tk.test20
-rw-r--r--tests/ttk/all.tcl7
-rw-r--r--tests/ttk/checkbutton.test3
-rw-r--r--tests/ttk/combobox.test7
-rw-r--r--tests/ttk/entry.test33
-rw-r--r--tests/ttk/image.test7
-rw-r--r--tests/ttk/labelframe.test39
-rw-r--r--tests/ttk/layout.test5
-rw-r--r--tests/ttk/notebook.test9
-rw-r--r--tests/ttk/panedwindow.test19
-rw-r--r--tests/ttk/progressbar.test7
-rw-r--r--tests/ttk/radiobutton.test3
-rw-r--r--tests/ttk/scrollbar.test55
-rw-r--r--tests/ttk/spinbox.test76
-rw-r--r--tests/ttk/treetags.test5
-rw-r--r--tests/ttk/treeview.test43
-rw-r--r--tests/ttk/ttk.test41
-rw-r--r--tests/ttk/validate.test4
-rw-r--r--tests/ttk/vsapi.test7
-rw-r--r--tests/unixButton.test6
-rw-r--r--tests/unixEmbed.test319
-rw-r--r--tests/unixFont.test52
-rw-r--r--tests/unixMenu.test4
-rw-r--r--tests/unixSelect.test72
-rw-r--r--tests/unixWm.test168
-rw-r--r--tests/util.test16
-rw-r--r--tests/visual.test14
-rw-r--r--tests/visual_bb.test2
-rw-r--r--tests/winButton.test6
-rw-r--r--tests/winClipboard.test13
-rwxr-xr-xtests/winDialog.test42
-rw-r--r--tests/winFont.test16
-rw-r--r--tests/winMenu.test4
-rw-r--r--tests/winMsgbox.test12
-rw-r--r--tests/winSend.test18
-rw-r--r--tests/winWm.test21
-rw-r--r--tests/window.test4
-rw-r--r--tests/winfo.test35
-rw-r--r--tests/wm.test249
-rw-r--r--tests/xmfbox.test4
-rw-r--r--unix/Makefile.in21
-rwxr-xr-xunix/configure25
-rw-r--r--unix/configure.ac7
-rwxr-xr-x[-rw-r--r--]unix/install-sh412
-rwxr-xr-xunix/installManPage14
-rw-r--r--unix/tcl.m424
-rw-r--r--unix/tkAppInit.c8
-rw-r--r--unix/tkConfig.h.in42
-rw-r--r--unix/tkUnix.c2
-rw-r--r--unix/tkUnixButton.c6
-rw-r--r--unix/tkUnixDefault.h4
-rw-r--r--unix/tkUnixFont.c47
-rw-r--r--unix/tkUnixKey.c14
-rw-r--r--unix/tkUnixMenu.c123
-rw-r--r--unix/tkUnixMenubu.c8
-rw-r--r--unix/tkUnixPort.h6
-rw-r--r--unix/tkUnixRFont.c104
-rw-r--r--unix/tkUnixScale.c6
-rw-r--r--unix/tkUnixSelect.c9
-rw-r--r--unix/tkUnixSend.c12
-rw-r--r--unix/tkUnixWm.c222
-rw-r--r--win/Makefile.in22
-rwxr-xr-xwin/configure61
-rw-r--r--win/configure.ac22
-rw-r--r--win/makefile.vc4
-rw-r--r--win/rules.vc27
-rw-r--r--win/tcl.m438
-rw-r--r--win/tkConfig.sh.in5
-rw-r--r--win/tkWin32Dll.c2
-rw-r--r--win/tkWinColor.c1
-rw-r--r--win/tkWinCursor.c2
-rw-r--r--win/tkWinDefault.h2
-rw-r--r--win/tkWinDialog.c14
-rw-r--r--win/tkWinFont.c42
-rw-r--r--win/tkWinInt.h7
-rw-r--r--win/tkWinKey.c2
-rw-r--r--win/tkWinMenu.c21
-rw-r--r--win/tkWinPort.h10
-rw-r--r--win/tkWinSendCom.c4
-rw-r--r--win/tkWinWm.c132
-rw-r--r--win/tkWinX.c10
-rw-r--r--win/ttkWinTheme.c6
-rw-r--r--win/ttkWinXPTheme.c24
-rw-r--r--win/winMain.c1
-rw-r--r--xlib/X11/Xlib.h3
-rw-r--r--xlib/xgc.c37
446 files changed, 14395 insertions, 13637 deletions
diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob
index ee633a7..23f106b 100644
--- a/.fossil-settings/encoding-glob
+++ b/.fossil-settings/encoding-glob
@@ -1,3 +1,9 @@
win/buildall.vc.bat
win/makefile.vc
+win/rules-ext.vc
win/rules.vc
+win/targets.vc
+win/rc/*.bmp
+win/rc/*.cur
+win/rc/*.ico
+win/rc/*.rc
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index e319620..22e0537 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -1,9 +1,12 @@
*.a
*.dll
*.dylib
+*.dylib.E
*.exe
*.exp
+*.la
*.lib
+*.lo
*.o
*.obj
*.pdb
@@ -11,6 +14,7 @@
*.sl
*.so
*/Makefile
+*/autom4te.cache
*/config.cache
*/config.log
*/config.status
@@ -18,9 +22,16 @@
*/wish*
*/tktest*
*/versions.vc
+*/version.vc
+*/libtk.vfs
+*/libtk_*.zip
+html
+macosx/configure
win/Debug*
win/Release*
+win/*.manifest
win/nmhlp-out.txt
win/nmakehlp.out
unix/tk.pc
-html/*
+unix/Tk-Info.plist
+unix/Wish-Info.plist
diff --git a/.fossil-settings/manifest b/.fossil-settings/manifest
new file mode 100644
index 0000000..4ae8ef0
--- /dev/null
+++ b/.fossil-settings/manifest
@@ -0,0 +1 @@
+u
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fe89ab8
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,43 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* eol=lf
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.3 text
+*.c text
+*.css text
+*.enc text
+*.h text
+*.htm text
+*.html text
+*.java text
+*.js text
+*.json text
+*.n text
+*.svg text
+*.ts text
+*.tcl text
+*.test text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.bat eol=crlf
+*.rc eol=crlf
+*.sln eol=crlf
+*.vc eol=crlf
+
+# Denote all files that are truly binary and should not be modified.
+*.a binary
+*.bmp binary
+*.cur binary
+*.dll binary
+*.exe binary
+*.gif binary
+*.gz binary
+*.ico binary
+*.jpg binary
+*.lib binary
+*.pdf binary
+*.png binary
+*.xlsx binary
+*.zip binary
diff --git a/.gitignore b/.gitignore
index d96b03e..a49e849 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
*.a
+*.bundle
*.dll
*.dylib
+*.dylib.E
*.exe
*.exp
*.lib
@@ -10,19 +12,50 @@
*.res
*.sl
*.so
-*/Makefile
-*/config.cache
-*/config.log
-*/config.status
+.fslckout
+Makefile
+Tk-Info.plist
+Wish-Info.plist
+autom4te.cache
+config.cache
+config.log
+config.status
+config.status.lineno
+html
+manifest.uuid
+_FOSSIL_
*/tkConfig.sh
*/wish*
*/tktest*
*/versions.vc
+*/version.vc
+*/libtcl.vfs
+*/libtcl_*.zip
+libtommath/bn.ilg
+libtommath/bn.ind
+libtommath/pretty.build
+libtommath/tommath.src
+libtommath/*.log
+libtommath/*.pdf
+libtommath/*.pl
+libtommath/*.sh
+libtommath/doc/*
+libtommath/tombc/*
+libtommath/pre_gen/*
+libtommath/pics/*
+libtommath/mtest/*
+libtommath/logs/*
+libtommath/etc/*
+libtommath/demo/*
+libtommath/*.out
+libtommath/*.tex
+macosx/configure
+unix/autoMkindex.tcl
+unix/dltest.marker
unix/tk.pc
unix/tclIndex
win/Debug*
win/Release*
win/*.manifest
-win/nmhlp-out.txt
win/nmakehlp.out
-
+win/nmhlp-out.txt
diff --git a/.travis.yml b/.travis.yml
index 0a8ab68..e568e89 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,8 @@
-sudo: required
language: c
addons:
apt:
+ sources:
+ - ubuntu-toolchain-r-test
packages:
- binutils-mingw-w64-i686
- binutils-mingw-w64-x86-64
@@ -10,88 +11,116 @@ addons:
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-multilib
- - tcl-dev
+ - tcl8.6-dev
- libx11-dev
+ - xvfb
homebrew:
packages:
- tcl-tk
- casks:
- - xquartz
- update: true
-matrix:
+# casks:
+# - xquartz
+jobs:
include:
-# Testing on Linux with various compilers
+# Testing on Linux GCC
- name: "Linux/GCC/Shared"
os: linux
- dist: bionic
+ dist: focal
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script: &x11gui
+ - make binaries libraries tktest
+ - make install
+ - make test-classic >out-classic.txt
+ - cat out-classic.txt
+ - grep -q "Failed 0" out-classic.txt
+ - make test-ttk >out-ttk.txt
+ - cat out-ttk.txt
+ - grep -q "Failed 0" out-ttk.txt
+ - name: "Linux/GCC/Shared: NO_DEPRECATED"
+ os: linux
+ dist: focal
+ services:
+ - xvfb
compiler: gcc
env:
- BUILD_DIR=unix
+ - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1"
+ script: *x11gui
- name: "Linux/GCC/Shared/no-xft"
os: linux
- dist: bionic
+ dist: focal
+ services:
+ - xvfb
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
- - name: "Linux/GCC/Static"
+ script: *x11gui
+ - name: "Linux/GCC/Shared/bionic"
os: linux
dist: bionic
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script: *x11gui
+ - name: "Linux/GCC/Shared/xenial"
+ os: linux
+ dist: xenial
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script: *x11gui
+ - name: "Linux/GCC/Static"
+ os: linux
+ dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--disable-shared"
- name: "Linux/GCC/Debug"
os: linux
- dist: bionic
+ dist: focal
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
- name: "Linux/G++/Shared"
os: linux
- dist: bionic
+ dist: focal
compiler: g++
env:
- BUILD_DIR=unix
- CFGOPT="CC=g++ CFLAGS=-Dregister=dont+use+register"
- name: "Linux/G++/Shared UTF_MAX=4"
os: linux
- dist: bionic
+ dist: focal
compiler: g++
env:
- BUILD_DIR=unix
- CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=4"
- name: "Linux/G++/Shared UTF_MAX=6"
os: linux
- dist: bionic
+ dist: focal
compiler: g++
env:
- BUILD_DIR=unix
- CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=6"
-# Older versions of GCC...
- - name: "Linux/GCC 7/Shared"
- os: linux
- dist: bionic
- compiler: gcc-7
- addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- packages:
- - g++-7
- env:
- - BUILD_DIR=unix
- - name: "Linux/GCC 6/Shared"
+# Newer/Older versions of GCC
+ - name: "Linux/GCC 10/Shared"
os: linux
- dist: bionic
- compiler: gcc-6
+ dist: focal
+ compiler: gcc-10
addons:
apt:
- sources:
- - ubuntu-toolchain-r-test
packages:
- - g++-6
+ - g++-10
env:
- BUILD_DIR=unix
- name: "Linux/GCC 5/Shared"
@@ -100,96 +129,105 @@ matrix:
compiler: gcc-5
addons:
apt:
- sources:
- - ubuntu-toolchain-r-test
packages:
- g++-5
env:
- BUILD_DIR=unix
-# Clang
+# Testing on Linux Clang
- name: "Linux/Clang/Shared"
os: linux
- dist: bionic
+ dist: focal
compiler: clang
env:
- BUILD_DIR=unix
+ - name: "Linux/Clang/Shared: NO_DEPRECATED"
+ os: linux
+ dist: focal
+ compiler: clang
+ env:
+ - BUILD_DIR=unix
+ - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1"
- name: "Linux/Clang/Shared/no-xft"
os: linux
- dist: bionic
+ dist: focal
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
- name: "Linux/Clang/Static"
os: linux
- dist: bionic
+ dist: focal
compiler: clang
env:
- CFGOPT="--disable-shared"
- BUILD_DIR=unix
- name: "Linux/Clang/Debug"
os: linux
- dist: bionic
+ dist: focal
compiler: clang
env:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols"
# Testing on Mac, various styles
- - name: "macOS/Clang/Xcode 11.5/Shared"
+ - name: "macOS/Xcode 12/Shared"
os: osx
- osx_image: xcode11.5
+ osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang++/Xcode 11.5/Shared"
+ - name: "macOS/Clang++/Xcode 12/Shared"
os: osx
- osx_image: xcode11.5
+ osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern"
- - name: "macOS/Clang/Xcode 11.5/Shared"
+ - name: "macOS/Xcode 12/Static"
os: osx
- osx_image: xcode11.5
- env:
- - BUILD_DIR=unix
- - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang/Xcode 11.5/Static"
- os: osx
- osx_image: xcode11.5
+ osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang/Xcode 11.5/Debug"
+ - name: "macOS/Xcode 12/Debug"
os: osx
- osx_image: xcode11.5
+ osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang/Xcode 11.5/Shared/XQuartz"
- os: osx
- osx_image: xcode11.5
- env:
- - BUILD_DIR=unix
- - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include"
+# - name: "macOS/Xcode 12/Shared/XQuartz"
+# os: osx
+# osx_image: xcode12
+# env:
+# - BUILD_DIR=unix
+# - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include"
# Older MacOS versions
- - name: "macOS/Clang/Xcode 11/Shared"
+ - name: "macOS/Xcode 11/Shared"
os: osx
- osx_image: xcode11
+ osx_image: xcode11.7
env:
- BUILD_DIR=unix
- - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang/Xcode 10/Shared"
+ - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14"
+ - name: "macOS/Xcode 10/Shared"
os: osx
osx_image: xcode10.3
+ addons:
+ homebrew:
+ packages:
+ - tcl-tk
+ update: true
env:
- BUILD_DIR=unix
- - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
- - name: "macOS/Clang/Xcode 9/Shared"
+ - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14"
+ - name: "macOS/Xcode 9/Shared"
os: osx
osx_image: xcode9.4
+ addons:
+ homebrew:
+ packages:
+ - tcl-tk
+ update: true
env:
- BUILD_DIR=unix
- - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include"
+ - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13"
# Test on Windows with MSVC native
# - name: "Windows/MSVC/Shared"
# os: windows
@@ -203,6 +241,15 @@ matrix:
# install: []
# script:
# - cmd.exe //C vcvarsall.bat x64 '&&' nmake '-f' makefile.vc all tktest
+# "make dist" only
+ - name: "Linux: make dist"
+ os: linux
+ dist: focal
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script:
+ - make dist
before_install:
- |-
case $TRAVIS_OS_NAME in
@@ -212,12 +259,20 @@ before_install:
esac
- cd ${BUILD_DIR}
install:
- - ./configure ${CFGOPT} --prefix=$HOME || (cat config.log && exit 1)
-before_script:
- - export ERROR_ON_FAILURES=1
+ - mkdir "$HOME/install dir"
+ - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
script:
- make all tktest
+ - make install
+before_cache:
+ - |-
+ case $TRAVIS_OS_NAME in
+ osx)
+ brew cleanup
+ ;;
+ esac
cache:
directories:
+ - $HOME/Library/Caches/Homebrew
- $HOME/AppData/Local/Temp/chocolatey
- $HOME/AppData/Local/Apps/Tcl86
diff --git a/ChangeLog b/ChangeLog
index f01946a..4fbb0eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -714,7 +714,7 @@ a better first place to look now.
2011-10-27 Kevin B. Kenny <kennykb@acm.org>
* generic/tkInt.h: [Bug 3410609]: Change the event mechanism
- * unix/tkUnixEvent.c: for <KeyPress> events to use the keysym
+ * unix/tkUnixEvent.c: for <Key> 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
allows binding to ISO_Level3_Shift-ed characters, composed characters,
@@ -5213,7 +5213,7 @@ a better first place to look now.
2008-01-29 Joe English <jenglish@users.sourceforge.net>
- * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
+ * library/treeview.tcl: Fix bug in Shift-Button-1 binding (error
if no current focus item; reported on c.l.t.)
2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
diff --git a/ChangeLog.2004 b/ChangeLog.2004
index b900e7b..9afaa75 100644
--- a/ChangeLog.2004
+++ b/ChangeLog.2004
@@ -3521,7 +3521,7 @@
2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net>
* doc/wish.n: Added language to describe the handling of the
- end-of-file character \u001a in script files. [Bug 685505]
+ end-of-file character \x1A in script files. [Bug 685505]
2003-02-10 Jim Ingham <jingham@apple.com>
diff --git a/changes b/changes
index f92e083..b83c642 100644
--- a/changes
+++ b/changes
@@ -333,7 +333,7 @@ same menu.
4/12/92 (bug fix) Fixed core dump that occurred in tkError.c when
removing the first error record from the error list.
-4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <KeyPress-1>
+4/15/92 (bug fix) Fixed bug in tkBind.c that prevented <Key-1>
event specifications from being processed correctly: the "1" was
treated as a button name rather than a keysym.
@@ -3488,7 +3488,7 @@ Macintosh, the menubar is displayed accross the top of the main monitor,
just like with other applications. Under Windows and Unix, the menu is
attached to the toplevel window. Also, changed some semantics.
Tearoff menus will now reflect changes to the menu it was
-torn off from, and are deleted when the master menu is
+torn off from, and are deleted when the main menu is
deleted. Tearoffs also reflect more look-and-feel of the
platforms they are running on. (SRP)
@@ -3998,7 +3998,7 @@ into account the "-displayof" option. This problem also existed for the
command to the Mac. Also fixed "resource write" when the resource
was specified by id and already existed. (JI)
-9/16/97 (bug fix) Added null bindings to <Command-KeyPress> for the
+9/16/97 (bug fix) Added null bindings to <Command-Key> for the
text and entry widget on the Macintosh. This prevents unbound command
key sequences from having the character echoed to the widget. Also
fixed Cut & Copy bindings. (JI) (RJ)
@@ -7527,7 +7527,7 @@ in this changeset (new minor version) rather than bug fixes:
2018-01-07 (bug)[fa8de7] Crash [ttk::checkbutton .x -variable {}] (werner)
-2018-01-16 (bug)[382712] Crash in [event generate . <KeyPress>] (werner)
+2018-01-16 (bug)[382712] Crash in [event generate . <Key>] (werner)
2018-01-19 (bug)[657c38] Crash in menu destroy with checkbutton entry (werner)
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index 4949c50..b0a14fc 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image
+Tk_CreateImageType, Tk_GetImageModelData, Tk_InitImageArgs \- define new kind of image
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -17,7 +17,7 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind o
\fBTk_CreateImageType\fR(\fItypePtr\fR)
.sp
ClientData
-\fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR)
+\fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR)
.sp
\fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
.SH ARGUMENTS
@@ -71,7 +71,7 @@ The fields of this structure will be described in later subsections
of this entry.
.PP
The second major data structure manipulated by an image manager
-is called an \fIimage master\fR; it contains overall information
+is called an \fIimage model\fR; it contains overall information
about a particular image, such as the values of the configuration
options specified in an \fBimage create\fR command.
There will usually be one of these structures for each
@@ -113,8 +113,8 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIobjc\fR,
Tcl_Obj *const \fIobjv\fR[],
const Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImaster\fR,
- ClientData *\fImasterDataPtr\fR);
+ Tk_ImageModel \fImodel\fR,
+ ClientData *\fImodelDataPtr\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,
@@ -123,15 +123,15 @@ or generated automatically by the \fBimage\fR command.
The \fIobjc\fR and \fIobjv\fR arguments describe all the configuration
options for the new image (everything after the name argument to
\fBimage\fR).
-The \fImaster\fR argument is a token that refers to Tk's information
+The \fImodel\fR argument is a token that refers to Tk's information
about this image; the image manager must return this token to
Tk when invoking the \fBTk_ImageChanged\fR procedure.
Typically \fIcreateProc\fR will parse \fIobjc\fR and \fIobjv\fR
-and create an image master data structure for the new image.
+and create an image model data structure for the new image.
\fIcreateProc\fR may store an arbitrary one-word value at
-*\fImasterDataPtr\fR, which will be passed back to the
+*\fImodelDataPtr\fR, which will be passed back to the
image manager when other callbacks are invoked.
-Typically the value is a pointer to the master data
+Typically the value is a pointer to the model data
structure for the image.
.PP
If \fIcreateProc\fR encounters an error, it should leave an error
@@ -148,11 +148,11 @@ This procedure must match the following prototype:
.CS
typedef ClientData \fBTk_ImageGetProc\fR(
Tk_Window \fItkwin\fR,
- ClientData \fImasterData\fR);
+ ClientData \fImodelData\fR);
.CE
The \fItkwin\fR argument identifies the window in which the
-image will be used and \fImasterData\fR is the value
-returned by \fIcreateProc\fR when the image master was created.
+image will be used and \fImodelData\fR is the value
+returned by \fIcreateProc\fR when the image model was created.
\fIgetProc\fR will usually create a data structure for the new
instance, including such things as the resources needed to
display the image in the given window.
@@ -221,25 +221,25 @@ each of the image's instances.
\fIdeleteProc\fR must match the following prototype:
.CS
typedef void \fBTk_ImageDeleteProc\fR(
- ClientData \fImasterData\fR);
+ ClientData \fImodelData\fR);
.CE
-The \fImasterData\fR argument will be the same as the value
-stored in \fI*masterDataPtr\fR by \fIcreateProc\fR when the
+The \fImodelData\fR argument will be the same as the value
+stored in \fI*modelDataPtr\fR by \fIcreateProc\fR when the
image was created.
\fIdeleteProc\fR should release any resources associated with
the image.
-.SH TK_GETIMAGEMASTERDATA
+.SH TK_GETIMAGEMODELDATA
.PP
-The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve
+The procedure \fBTk_GetImageModelData\fR may be invoked to retrieve
information about an image. For example, an image manager can use this
-procedure to locate its image master data for an image.
+procedure to locate its image model data for an image.
If there exists an image named \fIname\fR
in the interpreter given by \fIinterp\fR, then \fI*typePtrPtr\fR is
filled in with type information for the image (the \fItypePtr\fR value
passed to \fBTk_CreateImageType\fR when the image type was registered)
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
+pointer to the image model data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
.SH "LEGACY INTERFACE SUPPORT"
.PP
@@ -252,8 +252,8 @@ typedef int \fBTk_ImageCreateProc\fR(
int \fIargc\fR,
char **\fIargv\fR,
Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImaster\fR,
- ClientData *\fImasterDataPtr\fR);
+ Tk_ImageModel \fImodel\fR,
+ ClientData *\fImodelDataPtr\fR);
.CE
Legacy programs and libraries dating from those days may still
contain code that defines extended Tk image types using the old
@@ -280,4 +280,4 @@ 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
+image manager, image type, instance, model
diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3
index a2cbf8d..cbc5b79 100644
--- a/doc/EventHndlr.3
+++ b/doc/EventHndlr.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback with an X event
+Tk_CreateEventHandler, Tk_DeleteEventHandler, Tk_GetButtonMask, Tk_SendVirtualEvent \- associate procedure callback with an X event
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -17,8 +17,18 @@ Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback wit
\fBTk_CreateEventHandler\fR(\fItkwin, mask, proc, clientData\fR)
.sp
\fBTk_DeleteEventHandler\fR(\fItkwin, mask, proc, clientData\fR)
+.sp
+\fBTk_GetButtonMask\fR(\fIbutton\fR)
+.sp
+\fBTk_SendVirtualEvent\fR(\fItkwin, eventName, detail\fR)
.SH ARGUMENTS
.AS "unsigned long" clientData
+.AP unsigned button in
+Button number.
+.AP "const char" *eventName in
+The name of the virtual event.
+.AP Tcl_Obj *detail in
+Detail information for the virtual event.
.AP Tk_Window tkwin in
Token for window in which events may occur.
.AP "unsigned long" mask in
@@ -71,5 +81,10 @@ 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.
+.PP
+\fBTk_GetButtonMask\fR returns the button mask corresponding to
+the button. E.g it will return \fIButton1Mask\fR for button \fIButton1\fR.
+.PP
+\fBTk_SendVirtualEvent\fR sends a virtual event to Tk's event queue.
.SH KEYWORDS
bind, callback, event, handler
diff --git a/doc/GetFont.3 b/doc/GetFont.3
index 0504916..9497556 100644
--- a/doc/GetFont.3
+++ b/doc/GetFont.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts
+Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FontGetDescription, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -23,6 +23,9 @@ Tk_Font
Tk_Font
\fBTk_GetFontFromObj(\fItkwin, objPtr\fB)\fR
.sp
+Tcl_Obj *
+\fBTk_FontGetDescription(\fItkfont\fB)\fR
+.sp
const char *
\fBTk_NameOfFont(\fItkfont\fB)\fR
.sp
@@ -88,6 +91,9 @@ windows or for different purposes), then a single Tk_Font will be
shared for all uses. The underlying resources will be freed automatically
when no-one is using the font anymore.
.PP
+The procedure \fBTk_FontGetDescription\fR returns information about the font
+description as a Tcl list. One possible result is "{{DejaVu Sans} -16 bold underline}".
+.PP
The procedure \fBTk_NameOfFont\fR is roughly the inverse of
\fBTk_GetFont\fR. Given a \fItkfont\fR that was created by
\fBTk_GetFont\fR (or \fBTk_AllocFontFromObj\fR), the return value is
diff --git a/doc/GetPixels.3 b/doc/GetPixels.3
index 6c31af9..568c601 100644
--- a/doc/GetPixels.3
+++ b/doc/GetPixels.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate between strings and screen units
+Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM, Tk_GetDoublePixelsFromObj \- translate between strings and screen units
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -18,6 +18,9 @@ int
\fBTk_GetPixelsFromObj(\fIinterp, tkwin, objPtr, intPtr\fB)\fR
.sp
int
+\fBTk_GetDoublePixelsFromObj(\fIinterp, tkwin, objPtr, doublePtr\fB)\fR
+.sp
+int
\fBTk_GetPixels(\fIinterp, tkwin, string, intPtr\fB)\fR
.sp
int
@@ -81,6 +84,9 @@ in \fIinterp\fR's result if \fIinterp\fR is not NULL.
value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetPixelsFromObj\fR with the same \fIobjPtr\fR.
.PP
+\fBTk_GetDoublePixelsFromObj\fR is identical to \fBTk_GetPixelsFromObj\fR
+except it returns a double not rounded to the nearest integer.
+.PP
\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
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index dd12cca..91a2585 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -25,13 +25,13 @@ int
Interpreter to use for error reporting.
.AP int objc in
Number of Tcl_Obj's in \fIobjv\fR array.
-.AP "Tcl_Obj *const" objv[] in
+.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 int argc in
Number of strings in \fIargv\fR array.
-.AP "const char" *argv[] in
+.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.
@@ -62,7 +62,8 @@ is returned as result and \fI*fractionPtr\fR is filled in with the
value.
If \fIobjv\fR has the \fBscroll\fR form, \fBTK_SCROLL_PAGES\fR
or \fBTK_SCROLL_UNITS\fR is returned and \fI*stepsPtr\fR is filled
-in with the \fInumber\fR value, which must be a proper integer.
+in with the \fInumber\fR value, which must be a integer or a float,
+but if it is a float then it is converted to an integer, rounded away from 0.
If an error occurs in parsing the arguments, \fBTK_SCROLL_ERROR\fR
is returned and an error message is left in interpreter
\fIinterp\fR's result.
diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3
index ccf0c11..ed47d26 100644
--- a/doc/ImgChanged.3
+++ b/doc/ImgChanged.3
@@ -14,10 +14,10 @@ Tk_ImageChanged \- notify widgets that image needs to be redrawn
.nf
\fB#include <tk.h>\fR
.sp
-\fBTk_ImageChanged\fR(\fIimageMaster, x, y, width, height, imageWidth, imageHeight\fR)
+\fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR)
.SH ARGUMENTS
-.AS Tk_ImageMaster imageHeight
-.AP Tk_ImageMaster imageMaster in
+.AS Tk_ImageModel imageHeight
+.AP Tk_ImageModel model in
Token for image, which was passed to image's \fIcreateProc\fR when
the image was created.
.AP int x in
@@ -42,7 +42,7 @@ whenever anything happens that requires the image to be redrawn.
As a result of calling \fBTk_ImageChanged\fR, any widgets using
the image are notified so that they can redisplay themselves
appropriately.
-The \fIimageMaster\fR argument identifies the image, and
+The \fImodel\fR argument identifies the image, and
\fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR
specify a rectangular region within the image that needs to
be redrawn.
diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3
index b34e797..d6418b5 100644
--- a/doc/MaintGeom.3
+++ b/doc/MaintGeom.3
@@ -14,67 +14,67 @@ Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window re
.nf
\fB#include <tk.h>\fR
.sp
-\fBTk_MaintainGeometry\fR(\fIslave, master, x, y, width, height\fR)
+\fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR)
.sp
-\fBTk_UnmaintainGeometry\fR(\fIslave, master\fR)
+\fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR)
.SH ARGUMENTS
-.AS Tk_Window master
-.AP Tk_Window slave in
+.AS Tk_Window container
+.AP Tk_Window window in
Window whose geometry is to be controlled.
-.AP Tk_Window master in
-Window relative to which \fIslave\fR's geometry will be controlled.
+.AP Tk_Window container in
+Window relative to which \fIwindow\fR's geometry will be controlled.
.AP int x in
-Desired x-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels
-from the inside of \fImaster\fR's left border to the outside of
-\fIslave\fR's left border.
+Desired x-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels
+from the inside of \fIcontainer\fR's left border to the outside of
+\fIwindow\fR's left border.
.AP int y in
-Desired y-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels
-from the inside of \fImaster\fR's top border to the outside of
-\fIslave\fR's top border.
+Desired y-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels
+from the inside of \fIcontainer\fR's top border to the outside of
+\fIwindow\fR's top border.
.AP int width in
-Desired width for \fIslave\fR, in pixels.
+Desired width for \fIwindow\fR, in pixels.
.AP int height in
-Desired height for \fIslave\fR, in pixels.
+Desired height for \fIwindow\fR, in pixels.
.BE
.SH DESCRIPTION
.PP
\fBTk_MaintainGeometry\fR and \fBTk_UnmaintainGeometry\fR make it
-easier for geometry managers to deal with slaves whose masters are not
+easier for geometry managers to deal with windows whose containers are not
their parents.
-Three problems arise if the master for a slave is not its parent:
+Three problems arise if the container for a window is not its parent:
.IP [1]
-The x- and y-position of the slave must be translated from the
-coordinate system of the master to that of the parent before
-positioning the slave.
+The x- and y-position of the window must be translated from the
+coordinate system of the container to that of the parent before
+positioning the window.
.IP [2]
-If the master window, or any of its ancestors up to the slave's
-parent, is moved, then the slave must be repositioned within its
+If the container window, or any of its ancestors up to the window's
+parent, is moved, then the window must be repositioned within its
parent in order to maintain the correct position relative to the
-master.
+container.
.IP [3]
-If the master or one of its ancestors is mapped or unmapped, then
-the slave must be mapped or unmapped to correspond.
+If the container or one of its ancestors is mapped or unmapped, then
+the window must be mapped or unmapped to correspond.
.LP
-None of these problems is an issue if the parent and master are
-the same. For example, if the master or one of its ancestors
-is unmapped, the slave is automatically removed by the screen
+None of these problems is an issue if the parent and container are
+the same. For example, if the container or one of its ancestors
+is unmapped, the window is automatically removed by the screen
by X.
.PP
-\fBTk_MaintainGeometry\fR deals with these problems for slaves
-whose masters are not their parents, as well as handling the simpler
-case of slaves whose masters are their parents.
+\fBTk_MaintainGeometry\fR deals with these problems for windows
+whose containers are not their parents, as well as handling the simpler
+case of windows whose container are their parents.
\fBTk_MaintainGeometry\fR is typically called by a window manager
-once it has decided where a slave should be positioned relative
-to its master.
+once it has decided where a window should be positioned relative
+to its container.
\fBTk_MaintainGeometry\fR translates the coordinates to the
-coordinate system of \fIslave\fR's parent and then moves and
-resizes the slave appropriately.
+coordinate system of \fIwindow\fR's parent and then moves and
+resizes the window appropriately.
Furthermore, it remembers the desired position and creates event
-handlers to monitor the master and all of its ancestors up
-to (but not including) the slave's parent.
+handlers to monitor the container and all of its ancestors up
+to (but not including) the window's parent.
If any of these windows is moved, mapped, or unmapped,
-the slave will be adjusted so that it is mapped only when the
-master is mapped and its geometry relative to the master
+the window will be adjusted so that it is mapped only when the
+container is mapped and its geometry relative to the container
remains as specified by \fIx\fR, \fIy\fR, \fIwidth\fR, and
\fIheight\fR.
.PP
@@ -83,17 +83,17 @@ if it decides that it does not want the window to appear on the
screen under any conditions, it calls \fBTk_UnmaintainGeometry\fR.
\fBTk_UnmaintainGeometry\fR unmaps the window and cancels any
previous calls to \fBTk_MaintainGeometry\fR for the
-\fImaster\fR\-\fIslave\fR pair, so that the slave's
+\fIcontainer\fR\-\fIwindow\fR pair, so that the window's
geometry and mapped state are no longer maintained
automatically.
\fBTk_UnmaintainGeometry\fR need not be called by a geometry
-manager if the slave, the master, or any of the master's ancestors
+manager if the window, the container, or any of the container's ancestors
is destroyed: Tk will call it automatically.
.PP
If \fBTk_MaintainGeometry\fR is called repeatedly for the same
-\fImaster\fR\-\fIslave\fR pair, the information from the most
+\fIcontainer\fR\-\fIwindow\fR pair, the information from the most
recent call supersedes any older information.
-If \fBTk_UnmaintainGeometry\fR is called for a \fImaster\fR\-\fIslave\fR
+If \fBTk_UnmaintainGeometry\fR is called for a \fIcontainer\fR\-\fIwindow\fR
pair that is is not currently managed, the call has no effect.
.SH KEYWORDS
-geometry manager, map, master, parent, position, slave, unmap
+geometry manager, map, container, parent, position, window, unmap
diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3
index ba12aca..0c72d69 100644
--- a/doc/ManageGeom.3
+++ b/doc/ManageGeom.3
@@ -32,7 +32,7 @@ Arbitrary one-word value to pass to geometry manager callbacks.
.PP
\fBTk_ManageGeometry\fR arranges for a particular geometry manager,
described by the \fImgrPtr\fR argument, to control the geometry
-of a particular slave window, given by \fItkwin\fR.
+of a particular content window, given by \fItkwin\fR.
If \fItkwin\fR was previously managed by some other geometry manager,
the previous manager loses control in favor of the new one.
If \fImgrPtr\fR is NULL, geometry management is cancelled for
@@ -44,7 +44,7 @@ the geometry manager:
typedef struct {
const char *\fIname\fR;
Tk_GeomRequestProc *\fIrequestProc\fR;
- Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR;
+ Tk_GeomLostContentProc *\fIlostContentProc\fR;
} \fBTk_GeomMgr\fR;
.CE
The \fIname\fR field is the textual name for the geometry manager,
@@ -53,7 +53,7 @@ by the command \fBwinfo manager\fR.
.PP
\fIrequestProc\fR is a procedure in the geometry manager that
will be invoked whenever \fBTk_GeometryRequest\fR is called by the
-slave to change its desired geometry.
+content window to change its desired geometry.
\fIrequestProc\fR should have arguments and results that match the
type \fBTk_GeomRequestProc\fR:
.CS
@@ -67,24 +67,24 @@ corresponding parameters passed to \fBTk_ManageGeometry\fR.
structure containing application-specific information about
how to manage \fItkwin\fR's geometry.
.PP
-The \fIlostSlaveProc\fR field of \fImgrPtr\fR points to another
+The \fIlostContentProc\fR field of \fImgrPtr\fR points to another
procedure in the geometry manager.
-Tk will invoke \fIlostSlaveProc\fR if some other manager
+Tk will invoke \fIlostContentProc\fR if some other manager
calls \fBTk_ManageGeometry\fR to claim
\fItkwin\fR away from the current geometry manager.
-\fIlostSlaveProc\fR is not invoked if \fBTk_ManageGeometry\fR is
+\fIlostContentProc\fR is not invoked if \fBTk_ManageGeometry\fR is
called with a NULL value for \fImgrPtr\fR (presumably the current
geometry manager has made this call, so it already knows that the
window is no longer managed), nor is it called if \fImgrPtr\fR
is the same as the window's current geometry manager.
-\fIlostSlaveProc\fR should have
+\fIlostContentProc\fR should have
arguments and results that match the following prototype:
.CS
-typedef void \fBTk_GeomLostSlaveProc\fR(
+typedef void \fBTk_GeomLostContentProc\fR(
ClientData \fIclientData\fR,
Tk_Window \fItkwin\fR);
.CE
-The parameters to \fIlostSlaveProc\fR will be identical to the
+The parameters to \fIlostContentProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
.SH KEYWORDS
callback, geometry, managed, request, unmanaged
diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3
index 8c191ce..781650f 100644
--- a/doc/NameOfImg.3
+++ b/doc/NameOfImg.3
@@ -14,10 +14,10 @@ Tk_NameOfImage \- Return name of image.
\fB#include <tk.h>\fR
.sp
const char *
-\fBTk_NameOfImage\fR(\fIimageMaster\fR)
+\fBTk_NameOfImage\fR(\fIimageModel\fR)
.SH ARGUMENTS
-.AS Tk_ImageMaster imageMaster
-.AP Tk_ImageMaster imageMaster in
+.AS Tk_ImageModel imageModel
+.AP Tk_ImageModel imageModel in
Token for image, which was passed to image manager's \fIcreateProc\fR when
the image was created.
.BE
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index cb04655..65fe8cd 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -60,7 +60,7 @@ no window-dependent options, then a NULL value may be supplied for
this argument.
.AP int objc in
Number of values in \fIobjv\fR.
-.AP Tcl_Obj "*const objv[]" in
+.AP Tcl_Obj "*const *objv" in
Command-line arguments for setting configuring options.
.AP Tk_SavedOptions *savePtr out
If not NULL, the structure pointed to by this argument is filled
diff --git a/doc/WindowId.3 b/doc/WindowId.3
index f937963..477efe1 100644
--- a/doc/WindowId.3
+++ b/doc/WindowId.3
@@ -9,7 +9,7 @@
.so man.macros
.BS
.SH NAME
-Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp \- retrieve information from Tk's local data structure
+Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_AlwaysShowSelection, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap, Tk_Interp, Tk_NewWindowObj \- retrieve information from Tk's local data structure
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -29,6 +29,9 @@ const char *
int
\fBTk_ScreenNumber\fR(\fItkwin\fR)
.sp
+int
+\fBTk_AlwaysShowSelection\fR(\fItkwin\fR)
+.sp
Screen *
\fBTk_Screen\fR(\fItkwin\fR)
.sp
@@ -97,6 +100,9 @@ Colormap
.sp
Tcl_Interp *
\fBTk_Interp\fR(\fItkwin\fR)
+.sp
+Tcl_Obj *
+\fBTk_NewWindowObj\fR(\fItkwin\fR)
.SH ARGUMENTS
.AS Tk_Window tkwin
.AP Tk_Window tkwin in
@@ -127,6 +133,8 @@ ASCII string identifying \fItkwin\fR's display. \fBTk_ScreenNumber\fR
returns the index of \fItkwin\fR's screen among all the screens
of \fItkwin\fR's display. \fBTk_Screen\fR returns a pointer to
the Xlib structure corresponding to \fItkwin\fR's screen.
+\fBTk_AlwaysShowSelection\fR indicates whether text/entry widgets
+should always display their selection, regardless of window focus.
.PP
\fBTk_X\fR, \fBTk_Y\fR, \fBTk_Width\fR, and \fBTk_Height\fR
return information about \fItkwin's\fR location within its
@@ -182,6 +190,8 @@ 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.
+.PP
+\fBTk_NewWindowObj\fR creates a new \fBTcl_Obj\fR from the window.
.SH KEYWORDS
attributes, colormap, depth, display, height, geometry manager,
identifier, mapped, requested size, screen, top-level,
diff --git a/doc/bind.n b/doc/bind.n
index 871e167..9210357 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -201,14 +201,26 @@ substitutions you would make when binding to these events.
Many contemporary mice support a mouse wheel, which is used
for scrolling documents without using the scrollbars. By rolling the
wheel, the system will generate \fBMouseWheel\fR events that the
-application can use to scroll. Like \fBKey\fR events the event is
-always routed to the window that currently has focus. When the event
+application can use to scroll. The event is routed to the
+window currently under the mouse pointer. When the event
is received you can use the \fB%D\fR substitution to get the
-\fIdelta\fR field for the event, which is a integer value describing how
+\fIdelta\fR field for the event, which is an integer value describing how
the mouse wheel has moved. The smallest value for which the
-system will report is defined by the OS. The sign of the
+system will report is defined by the OS. The sign of the
value determines which direction your widget should scroll. Positive
values should scroll up and negative values should scroll down.
+.RS
+.PP
+Horizontal scrolling uses \fBShift-MouseWheel\fR events, with positive
+\fB%D\fR \fIdelta\fR substitution indicating left scrolling and negative
+right scrolling.
+Horizontal scrolling events may fire from
+many different hardware units such as tilt wheels or touchpads. Horizontal
+scrolling can also be emulated by holding Shift and scrolling vertically.
+.RE
+.IP "\fBKeyPress\fR, \fBKeyRelease\fR" 5
+The \fBKeyPress\fR and \fBKeyRelease\fR events are generated
+whenever a key is pressed or released. \fBKeyPress\fR and \fBKeyRelease\fR
.IP "\fBKey\fR, \fBKeyRelease\fR" 5
The \fBKey\fR and \fBKeyRelease\fR events are generated
whenever a key is pressed or released. \fBKey\fR and \fBKeyRelease\fR
@@ -270,7 +282,8 @@ it is destroyed.
When the \fBDestroy\fR event is delivered
to a widget, it is in a
.QW half-dead
-state: the widget still exists, but most operations on it will fail.
+state: the widget still exists, but operations that involve it
+may return invalid results, or return an error.
.RE
.IP "\fBFocusIn\fR, \fBFocusOut\fR" 5
The \fBFocusIn\fR and \fBFocusOut\fR events are generated
diff --git a/doc/bitmap.n b/doc/bitmap.n
index 1751913..19716e1 100644
--- a/doc/bitmap.n
+++ b/doc/bitmap.n
@@ -90,7 +90,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/button.n b/doc/button.n
index 233feb6..70e0e65 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -109,7 +109,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/canvas.n b/doc/canvas.n
index 623154f..2367e2e 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -348,13 +348,13 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
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?
+\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg ...\fR?
.
For each item that meets the constraints specified by
\fIsearchSpec\fR and the \fIarg\fRs, add
@@ -602,7 +602,7 @@ the item is unaffected by the command.
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?
+\fIpathName \fBfind \fIsearchCommand \fR?\fIarg ...\fR?
.
This command returns a list consisting of all the items that
meet the constraints specified by \fIsearchCommand\fR and
@@ -1147,7 +1147,8 @@ total width of the canvas is off-screen to the left.
.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
If \fIwhat is \fBpages\fR then the view
@@ -1160,7 +1161,7 @@ of the \fBxScrollIncrement\fR option, if it is greater than zero,
or in units of one-tenth the window's width otherwise.
.RE
.TP
-\fIpathName \fByview \fI?args\fR?
+\fIpathName \fByview ?\fIargs\fR?
.
This command is used to query and change the vertical position of the
information displayed in the canvas's window.
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index bfefca4..411045f 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -192,7 +192,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/clipboard.n b/doc/clipboard.n
index 6f047dd..ee964df 100644
--- a/doc/clipboard.n
+++ b/doc/clipboard.n
@@ -12,7 +12,7 @@
.SH NAME
clipboard \- Manipulate Tk clipboard
.SH SYNOPSIS
-\fBclipboard \fIoption\fR ?\fIarg arg ...\fR?
+\fBclipboard \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/colors.n b/doc/colors.n
index 9234824..9d8d653 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -784,30 +784,23 @@ YellowGreen 154 205 50
.TP
\fBMac OS X\fR
.
-On macOS, the following additional system colors are available.
-This first group contains all colors available in the HIToolbox library.
-(Note that in some cases the actual color values may depend on the
-current Appearance.)
+On macOS, the following additional system colors are available. This
+first group contains all of the HIBrush colors available in the
+HIToolbox library. Note that on macOS 10.14 (Mojave) and later these
+colors are unlikely to match the color actually used for the purpose
+suggested by the color name.
.RS
.DS
systemActiveAreaFill
-systemAlertActiveText
systemAlertBackgroundActive
systemAlertBackgroundInactive
-systemAlertInactiveText
systemAlternatePrimaryHighlightColor
systemAppleGuideCoachmark
systemBevelActiveDark
systemBevelActiveLight
-systemBevelButtonActiveText
-systemBevelButtonInactiveText
-systemBevelButtonPressedText
-systemBevelButtonStickyActiveText
-systemBevelButtonStickyInactiveText
systemBevelInactiveDark
systemBevelInactiveLight
systemBlack
-systemBlackText
systemButtonActiveDarkHighlight
systemButtonActiveDarkShadow
systemButtonActiveLightHighlight
@@ -827,15 +820,10 @@ systemButtonPressedDarkHighlight
systemButtonPressedDarkShadow
systemButtonPressedLightHighlight
systemButtonPressedLightShadow
-systemButtonText
systemChasingArrows
-systemDialogActiveText
systemDialogBackgroundActive
systemDialogBackgroundInactive
-systemDialogInactiveText
systemDocumentWindowBackground
-systemDocumentWindowTitleActiveText
-systemDocumentWindowTitleInactiveText
systemDragHilite
systemDrawerBackground
systemFinderWindowBackground
@@ -843,101 +831,53 @@ systemFocusHighlight
systemHighlight
systemHighlightAlternate
systemHighlightSecondary
-systemHighlightText
systemIconLabelBackground
systemIconLabelBackgroundSelected
-systemIconLabelSelectedText
-systemIconLabelText
systemListViewBackground
systemListViewColumnDivider
systemListViewEvenRowBackground
systemListViewOddRowBackground
systemListViewSeparator
systemListViewSortColumnBackground
-systemListViewText
-systemListViewWindowHeaderBackground
systemMenu
systemMenuActive
-systemMenuActiveText
systemMenuBackground
systemMenuBackgroundSelected
-systemMenuDisabled
-systemMenuItemActiveText
-systemMenuItemDisabledText
-systemMenuItemSelectedText
-systemMenuText
-systemMetalBackground
-systemModelessDialogActiveText
systemModelessDialogBackgroundActive
systemModelessDialogBackgroundInactive
-systemModelessDialogInactiveText
systemMovableModalBackground
-systemMovableModalWindowTitleActiveText
-systemMovableModalWindowTitleInactiveText
-systemNotificationText
systemNotificationWindowBackground
-systemPlacardActiveText
-systemPlacardBackground
-systemPlacardInactiveText
-systemPlacardPressedText
systemPopupArrowActive
systemPopupArrowInactive
systemPopupArrowPressed
-systemPopupButtonActiveText
-systemPopupButtonInactiveText
-systemPopupButtonPressedText
-systemPopupLabelActiveText
-systemPopupLabelInactiveText
-systemPopupWindowTitleActiveText
-systemPopupWindowTitleInactiveText
systemPrimaryHighlightColor
-systemPushButtonActiveText
-systemPushButtonInactiveText
-systemPushButtonPressedText
-systemRootMenuActiveText
-systemRootMenuDisabledText
-systemRootMenuSelectedText
systemScrollBarDelimiterActive
systemScrollBarDelimiterInactive
-systemSecondaryGroupBoxBackground
systemSecondaryHighlightColor
systemSelectedTabTextColor
systemSheetBackground
systemSheetBackgroundOpaque
systemSheetBackgroundTransparent
systemStaticAreaFill
-systemSystemDetailText
-systemTabFrontActiveText
-systemTabFrontInactiveText
-systemTabNonFrontActiveText
-systemTabNonFrontInactiveText
-systemTabNonFrontPressedText
-systemTabPaneBackground
systemToolbarBackground
systemTransparent
systemUtilityWindowBackgroundActive
systemUtilityWindowBackgroundInactive
-systemUtilityWindowTitleActiveText
-systemUtilityWindowTitleInactiveText
systemWhite
-systemWhiteText
systemWindowBody
-systemWindowHeaderActiveText
-systemWindowHeaderBackground
-systemWindowHeaderInactiveText
.DE
.RE
.
-The second group of MacOS colors below are based on Apple's "semantic"
-NScolors. On OSX 10.14 (Mojave) and later these colors change value
-when Dark Mode is enabled. However, the change is only observable
-when the Apple window manager is drawing to the screen. So the
-\fBwinfo rgb\fR command will return the color coordinates used in the
-standard Aqua mode, even if Dark Mode has been selected in the system
-preferences. The numbered systemWindowBackgroundColors are used in
-the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a
-contrasting background. Each numbered color constrasts with its
-predecessor.
+Tk supports all of the NSColors in the macOS System ColorList. The
+convention for naming these colors is that the Tk name is generated by
+capitalizing the macOS name and adding the prefix "system". On OSX
+10.14 (Mojave) and later many of these "semantic" colors will appear
+differently depending on whether the NSWindow in which they are used has
+the Aqua or DarkAqua appearance. The System ColorList differs between
+releases of macOS and some colors, such as systemLinkColor and
+systemControlAccentColor, are simulated on older systems which did not
+provide them. All of the colors below are available on all supported
+macOS releases, but newer systems will support additional colors.
.RS
.DS
systemControlAccentColor
@@ -945,10 +885,21 @@ systemControlTextColor
systemDisabledControlTextColor
systemLabelColor
systemLinkColor
+systemPlaceholderTextColor
systemSelectedTextBackgroundColor
systemSelectedTextColor
+systemSeparatorColor
systemTextBackgroundColor
systemTextColor
+.DE
+.RE
+.
+The numbered systemWindowBackgroundColors below
+are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets
+to provide a contrasting background. Each numbered color constrasts
+with its predecessor.
+.RS
+.DS
systemWindowBackgroundColor
systemWindowBackgroundColor1
systemWindowBackgroundColor2
@@ -961,7 +912,6 @@ systemWindowBackgroundColor7
.RE
.TP
-
\fBWindows\fR
.
On Windows, the following additional system colors are available
@@ -969,19 +919,20 @@ On Windows, the following additional system colors are available
.RS
.DS
.ta 6c
-system3dDarkShadow systemHighlight
-system3dLight systemHighlightText
-systemActiveBorder systemInactiveBorder
-systemActiveCaption systemInactiveCaption
-systemAppWorkspace systemInactiveCaptionText
-systemBackground systemInfoBackground
-systemButtonFace systemInfoText
-systemButtonHighlight systemMenu
-systemButtonShadow systemMenuText
+system3dDarkShadow systemHighlightText
+system3dLight systemInactiveBorder
+systemActiveBorder systemInactiveCaption
+systemActiveCaption systemInactiveCaptionText
+systemAppWorkspace systemInfoBackground
+systemBackground systemInfoText
+systemButtonFace systemMenu
+systemButtonHighlight systemMenuText
+systemButtonShadow systemPlaceholderText
systemButtonText systemScrollbar
systemCaptionText systemWindow
systemDisabledText systemWindowFrame
systemGrayText systemWindowText
+systemHighlight
.DE
.RE
.SH "SEE ALSO"
diff --git a/doc/console.n b/doc/console.n
index d4d8a74..40b7426 100644
--- a/doc/console.n
+++ b/doc/console.n
@@ -25,9 +25,12 @@ 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 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).
+In TkAqua, this command is disabled when there is a startup script
+and stdin is \fB/dev/null\fR (as is the case e.g. when a bundled application
+embedding Tk is started by the macOS Launcher). To enable the command
+in that case, define the environment variable \fBTK_CONSOLE\fR. This can be
+done by modifying the Info.plist file by adding the LSEnvironment key
+to the main dict and setting its value to be a dict with the key \fBTK_CONSOLE\fR.
.PP
.TP
\fBconsole eval \fIscript\fR
diff --git a/doc/entry.n b/doc/entry.n
index 9eea51b..23b8cab 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -190,7 +190,7 @@ The \fBentry\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName subcommand \fR?\fIarg arg ...\fR?
+\fIpathName subcommand \fR?\fIarg ...\fR?
.CE
\fISubcommand\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -403,7 +403,8 @@ way through the text appears at the left edge of the window.
\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.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
diff --git a/doc/event.n b/doc/event.n
index f4eb426..0160e26 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -12,7 +12,7 @@
.SH NAME
event \- Miscellaneous event facilities: define virtual events and generate events
.SH SYNOPSIS
-\fBevent\fI option \fR?\fIarg arg ...\fR?
+\fBevent\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/focus.n b/doc/focus.n
index e3efcd3..a6b0575 100644
--- a/doc/focus.n
+++ b/doc/focus.n
@@ -15,7 +15,7 @@ focus \- Manage the input focus
.nf
\fBfocus\fR
\fBfocus \fIwindow\fR
-\fBfocus \fIoption\fR ?\fIarg arg ...\fR?
+\fBfocus \fIoption\fR ?\fIarg ...\fR?
.fi
.BE
.SH DESCRIPTION
diff --git a/doc/font.n b/doc/font.n
index 72f9270..4d2f5f4 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -12,7 +12,7 @@
.SH NAME
font \- Create and inspect fonts.
.SH SYNOPSIS
-\fBfont\fI option \fR?\fIarg arg ...\fR?
+\fBfont\fI option \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/fontchooser.n b/doc/fontchooser.n
index 65aa8e7..465af2e 100644
--- a/doc/fontchooser.n
+++ b/doc/fontchooser.n
@@ -11,7 +11,7 @@
.SH NAME
fontchooser \- control font selection dialog
.SH SYNOPSIS
-\fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value \-option value ...\fR?
+\fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value ...\fR?
.sp
\fBtk fontchooser\fR \fBshow\fR
.sp
@@ -31,7 +31,7 @@ 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?
+\fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value ...\fR?
.
Set or query one or more of the configurations options below (analogous to Tk
widget configuration).
diff --git a/doc/frame.n b/doc/frame.n
index 54e8e2f..5520f32 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -120,7 +120,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
@@ -135,7 +135,7 @@ by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBframe\fR
command.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?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
diff --git a/doc/grab.n b/doc/grab.n
index cee3ce7..259d68e 100644
--- a/doc/grab.n
+++ b/doc/grab.n
@@ -14,7 +14,7 @@ grab \- Confine pointer and keyboard events to a window sub-tree
.SH SYNOPSIS
\fBgrab \fR?\fB\-global\fR? \fIwindow\fR
.sp
-\fBgrab \fIoption \fR?\fIarg arg \fR...?
+\fBgrab \fIoption \fR?\fIarg \fR...?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/grid.n b/doc/grid.n
index 3da8cfb..684474b 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -17,30 +17,30 @@ grid \- Geometry manager that arranges widgets in a grid
.PP
The \fBgrid\fR command is used to communicate with the grid
geometry manager that arranges widgets in rows and columns inside
-of another window, called the geometry master (or master window).
+of another window, called the geometry container (or container window).
The \fBgrid\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
-\fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
+\fBgrid \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
.
-If the first argument to \fBgrid\fR is suitable as the first slave
+If the first argument to \fBgrid\fR is suitable as the first window
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
(see the \fBRELATIVE PLACEMENT\fR section below), then the command is
processed in the same way as \fBgrid configure\fR.
.TP
-\fBgrid anchor \fImaster\fR ?\fIanchor\fR?
+\fBgrid anchor \fIwindow\fR ?\fIanchor\fR?
.
-The anchor value controls how to place the grid within the master
+The anchor value controls how to place the grid within the container window
when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below
for further details. The default \fIanchor\fR is \fInw\fR.
.TP
-\fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
+\fBgrid bbox \fIwindow\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
.
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
+offset from the container 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
the command line, then the bounding box for that cell is returned, where the
@@ -48,18 +48,18 @@ 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?
+\fBgrid columnconfigure \fIwindow index \fR?\fI\-option value...\fR?
.
Query or set the column properties of the \fIindex\fR column of the
-geometry master, \fImaster\fR.
+geometry container, \fIwindow\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
a list of column indices to which the configuration options will operate on.
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.
+the options apply to all columns currently occupied be content windows. For
+a window name, that window must be a content of this container and the options
+apply to all columns currently occupied be the content.
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)
@@ -80,178 +80,178 @@ added to the largest window contained completely in that column when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
-If only the master window and index is specified, all the current settings
+If only the container window and index is specified, all the current settings
are returned in a list of
.QW "\-option value"
pairs.
.TP
-\fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
+\fBgrid configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
.
-The arguments consist of the names of one or more slave windows
+The arguments consist of the names of one or more content windows
followed by pairs of arguments that specify how
-to manage the slaves.
+to manage the content.
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
+location of a \fIwindow\fR, as described in the \fBRELATIVE PLACEMENT\fR
section, below.
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.
+Insert the window 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
+window is arranged just to the right of previous window specified on this
call to \fBgrid\fR, or column
.QW 0
-if it is the first slave. For each
-\fBx\fR that immediately precedes the \fIslave\fR, the column position
+if it is the first window. For each
+\fBx\fR that immediately precedes the \fIwindow\fR, the column position
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.
+Insert the window 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
+\fB\-in \fIcontainer\fR
.
-Insert the slave(s) in the master
-window given by \fIother\fR. The default is the first slave's
+Insert the window(s) in the container
+window given by \fIcontainer\fR. The default is the first window'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.
+leave on each side of the content. This is space is added
+inside the content border.
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.
+leave on the top and bottom of the content.
+This space is added inside the content 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.
+leave on each side of the content, in screen units.
\fIAmount\fR may be a list
of two values to specify padding for left and right separately.
The \fIamount\fR defaults to 0.
-This space is added outside the slave(s) border.
+This space is added outside the content 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.
+leave on the top and bottom of the content, in screen units.
\fIAmount\fR may be a list
of two values to specify padding for top and bottom separately.
The \fIamount\fR defaults to 0.
-This space is added outside the slave(s) border.
+This space is added outside the content border.
.TP
\fB\-row \fIn\fR
.
-Insert the slave so that it occupies the \fIn\fRth row in the grid.
+Insert the content 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
+content is arranged on the same row as the previous content specified on this
call to \fBgrid\fR, or the next row after the highest occupied row
-if this is the first slave.
+if this is the first content.
.TP
\fB\-rowspan \fIn\fR
.
-Insert the slave so that it occupies \fIn\fR rows in the grid.
+Insert the content 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
-of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is
+\fB^\fR characters instead of \fIcontent\fR that line up with the columns
+of this \fIcontent\fR, then the \fBrowspan\fR of this \fIcontent\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.
+If a content's cell is larger than its requested dimensions, this
+option may be used to position (or stretch) the content within its cell.
\fIStyle\fR is a string that contains zero or more of the characters
\fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR.
The string can optionally contain spaces or
commas, but they are ignored. Each letter refers to a side (north, south,
-east, or west) that the slave will
+east, or west) that the content 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
+specified, the content will be stretched to fill the entire
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 "" ,
-which causes the slave to be centered in its cavity, at its requested size.
+which causes the content to be centered in its cavity, at its requested size.
.LP
-If any of the slaves are already managed by the geometry manager
+If any of the content is already managed by the geometry manager
then any unspecified options for them retain their previous values rather
than receiving default values.
.RE
.TP
-\fBgrid forget \fIslave \fR?\fIslave ...\fR?
+\fBgrid forget \fIwindow \fR?\fIwindow ...\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.
+Removes each of the \fIwindow\fRs from grid for its
+container and unmaps their windows.
+The content will no longer be managed by the grid geometry manager.
The configuration options for that window are forgotten, so that if the
-slave is managed once more by the grid geometry manager, the initial
+window is managed once more by the grid geometry manager, the initial
default settings are used.
.RS
.PP
-.VS TIP518
-If the last slave of the master becomes unmanaged, this will also send
-the virtual event \fB<<NoManagedChild>>\fR to the master; the master
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
may choose to resize itself (or otherwise respond) to such a change.
-.VE TIP518
+.VE "TIP 518"
.RE
.TP
-\fBgrid info \fIslave\fR
+\fBgrid info \fIwindow\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
+the content given by \fIwindow\fR in the same option-value form that
might be specified to \fBgrid configure\fR.
The first two elements of the list are
-.QW "\fB\-in \fImaster\fR"
-where \fImaster\fR is the slave's master.
+.QW "\fB\-in \fIcontainer\fR"
+where \fIcontainer\fR is the windows's container window.
.TP
-\fBgrid location \fImaster x y\fR
+\fBgrid location \fIwindow 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 container 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?
+\fBgrid propagate \fIwindow\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
+then propagation is enabled for \fIwindow\fR, which must be a window
name (see \fBGEOMETRY PROPAGATION\fR below).
If \fIboolean\fR has a false boolean value then propagation is
-disabled for \fImaster\fR.
+disabled for \fIwindow\fR.
In either of these cases an empty string is returned.
If \fIboolean\fR is omitted then the command returns \fB0\fR or
\fB1\fR to indicate whether propagation is currently enabled
-for \fImaster\fR.
+for \fIwindow\fR.
Propagation is enabled by default.
.TP
-\fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR?
+\fBgrid rowconfigure \fIwindow index \fR?\fI\-option value...\fR?
.
Query or set the row properties of the \fIindex\fR row of the
-geometry master, \fImaster\fR.
+geometry container, \fIwindow\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
a list of row indices to which the configuration options will operate on.
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.
+the options apply to all rows currently occupied by content windows. For
+a window name, that window must be a content window of this container and the options
+apply to all rows currently occupied by the container window.
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)
@@ -272,99 +272,102 @@ added to the largest window contained completely in that row when the
grid geometry manager requests a size from the containing window.
If only an option is specified, with no value,
the current value of that option is returned.
-If only the master window and index is specified, all the current settings
+If only the container window and index is specified, all the current settings
are returned in a list of
.QW "-option value"
pairs.
.TP
-\fBgrid remove \fIslave \fR?\fIslave ...\fR?
+\fBgrid remove \fIwindow \fR?\fIwindow ...\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.
+Removes each of the \fIwindow\fRs from grid for its
+container and unmaps their windows.
+The content will no longer be managed by the grid geometry manager.
However, the configuration options for that window are remembered,
-so that if the
-slave is managed once more by the grid geometry manager, the previous
-values are retained.
+so that if the content window is managed once more by the grid
+geometry manager, the previous values are retained.
.RS
.PP
-.VS TIP518
-If the last slave of the master becomes unmanaged, this will also send
-the virtual event \fB<<NoManagedChild>>\fR to the master; the master
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
may choose to resize itself (or otherwise respond) to such a change.
-.VE TIP518
+.VE "TIP 518"
.RE
.TP
-\fBgrid size \fImaster\fR
+\fBgrid size \fIcontainer\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
+Returns the size of the grid (in columns then rows) for \fIcontainer\fR.
+The size is determined either by the \fIcontent\fR occupying the largest
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?
+\fBgrid content \fIwindow\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.
+If no options are supplied, a list of all of the content in \fIwindow\fR
+is returned, most recently managed first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
-causes only the slaves in the row (or column) specified by \fIvalue\fR
+causes only the content in the row (or column) specified by \fIvalue\fR
to be returned.
+.TP
+\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
+.
+Synonym for . \fBgrid content \fIwindow\fR ?\fI\-option value\fR?
.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,
+information for each content. This permits content 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 \fIcontent\fR,
default values are chosen for
\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
+at the time the \fIcontent\fR is managed. The values are chosen
+based upon the current layout of the grid, the position of the \fIcontent\fR
+relative to other \fIcontent\fRs in the same grid command, and the presence
of the characters \fB\-\fR, \fBx\fR, and \fB^\fR in \fBgrid\fR
-command where \fIslave\fR names are normally expected.
+command where \fIcontent\fR names are normally expected.
.RS
.TP
\fB\-\fR
.
-This increases the \fB\-columnspan\fR of the \fIslave\fR to the left. Several
+This increases the \fB\-columnspan\fR of the \fIcontent\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
+may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIcontent\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.
+This leaves an empty column between the \fIcontent\fR on the left and
+the \fIcontent\fR on the right.
.TP
\fB^\fR
.
-This extends the \fB\-rowspan\fR of the \fIslave\fR above the \fB^\fR's
+This extends the \fB\-rowspan\fR of the \fIcontent\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.
+columns spanned by the \fIcontent\fR above it.
.RE
.SH "THE GRID ALGORITHM"
.PP
-The grid geometry manager lays out its slaves in three steps.
-In the first step, the minimum size needed to fit all of the slaves
+The grid geometry manager lays out its content in three steps.
+In the first step, the minimum size needed to fit all of the content
is computed, then (if propagation is turned on), a request is made
-of the master window to become that size.
+of the container window to become that size.
In the second step, the requested size is compared against the actual size
-of the master. If the sizes are different, then spaces is added to or taken
+of the container. If the sizes are different, then spaces is added to or taken
away from the layout as needed.
-For the final step, each slave is positioned in its row(s) and column(s)
+For the final step, each content 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 \fB\-columnspan\fR and \fB\-rowspan\fR values are one,
+first looks at all content 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
+plus the size of the largest content, whichever is greater. After that
the rows or columns in each uniform group adapt to each other. Then
-the slaves whose row-spans or column-spans are greater than one are
+the content 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
+in order to accommodate these content, then extra space is added to each
row or column in the group according to its \fIweight\fR. For each
group whose weights are all zero, the additional space is apportioned
equally.
@@ -385,11 +388,11 @@ 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
-For masters whose size is larger than the requested layout, the additional
+For containers 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 weights are zero, the layout is placed within its container according to
the \fIanchor\fR value.
-For masters whose size is smaller than the requested layout, space is taken
+For containers whose size is smaller than the requested layout, space is taken
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
@@ -397,34 +400,34 @@ when all the rows or columns are at their minimum sizes, the layout is
placed and clipped according to the \fIanchor\fR value.
.SH "GEOMETRY PROPAGATION"
.PP
-The grid geometry manager normally computes how large a master must be to
-just exactly meet the needs of its slaves, and it sets the
-requested width and height of the master to these dimensions.
+The grid geometry manager normally computes how large a container must be to
+just exactly meet the needs of its content, and it sets the
+requested width and height of the container to these dimensions.
This causes geometry information to propagate up through a
window hierarchy to a top-level window so that the entire
sub-tree sizes itself to fit the needs of the leaf windows.
However, the \fBgrid propagate\fR command may be used to
-turn off propagation for one or more masters.
+turn off propagation for one or more containers.
If propagation is disabled then grid will not set
-the requested width and height of the master window.
-This may be useful if, for example, you wish for a master
+the requested width and height of the container window.
+This may be useful if, for example, you wish for a container
window to have a fixed size that you specify.
-.SH "RESTRICTIONS ON MASTER WINDOWS"
+.SH "RESTRICTIONS ON CONTAINER WINDOWS"
.PP
-The master for each slave must either be the slave's parent
-(the default) or a descendant of the slave's parent.
+The container for each content must either be the content's parent
+(the default) or a descendant of the content's parent.
This restriction is necessary to guarantee that the
-slave can be placed over any part of its master that is
-visible without danger of the slave being clipped by its parent.
-In addition, all slaves in one call to \fBgrid\fR must have the same master.
+content can be placed over any part of its container that is
+visible without danger of the content being clipped by its parent.
+In addition, all content in one call to \fBgrid\fR must have the same container.
.SH "STACKING ORDER"
.PP
-If the master for a slave is not its parent then you must make sure
-that the slave is higher in the stacking order than the master.
-Otherwise the master will obscure the slave and it will appear as
-if the slave has not been managed correctly.
-The easiest way to make sure the slave is higher than the master is
-to create the master window first: the most recently created window
+If the container for a content is not its parent then you must make sure
+that the content is higher in the stacking order than the container.
+Otherwise the container will obscure the content and it will appear as
+if the content has not been managed correctly.
+The easiest way to make sure the content is higher than the container is
+to create the container window first: the most recently created window
will be highest in the stacking order.
.SH CREDITS
.PP
diff --git a/doc/image.n b/doc/image.n
index 70f5acf..b620076 100644
--- a/doc/image.n
+++ b/doc/image.n
@@ -12,7 +12,7 @@
.SH NAME
image \- Create and manipulate images
.SH SYNOPSIS
-\fBimage\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBimage\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/label.n b/doc/label.n
index 107175e..290ac8a 100644
--- a/doc/label.n
+++ b/doc/label.n
@@ -75,7 +75,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 857208e..89f56c4 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -95,7 +95,7 @@ name is the same as the path name of the labelframe's window. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the labelframe widget's path name. \fIOption\fR and the \fIarg\fRs
@@ -108,7 +108,7 @@ by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBlabelframe\fR
command.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?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
diff --git a/doc/listbox.n b/doc/listbox.n
index ef3ae1c..02bd169 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -136,7 +136,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
@@ -383,7 +383,8 @@ total width of the listbox text is off-screen to the left.
.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
-\fINumber\fR must be an integer.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
If \fIwhat\fR is \fBpages\fR then the view adjusts by
diff --git a/doc/loadTk.n b/doc/loadTk.n
index 3673e98..e1c93c8 100644
--- a/doc/loadTk.n
+++ b/doc/loadTk.n
@@ -11,7 +11,7 @@
.SH NAME
safe::loadTk \- Load Tk into a safe interpreter.
.SH SYNOPSIS
-\fBsafe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
+\fBsafe::loadTk \fIchild\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
.BE
.SH DESCRIPTION
.PP
@@ -43,13 +43,13 @@ the \fBSECURITY ISSUES\fR section below for implementation details.
Please read the \fBsafe\fR manual page for Tcl to learn about the basic
security considerations for Safe Tcl.
.PP
-\fBsafe::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 parent
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
+Tk initialization is now safe with respect to not trusting the child's state
+for startup. \fBsafe::loadTk\fR registers the child's name so when the Tk
+initialization (\fBTk_SafeInit\fR) is called and in turn calls the parent's
\fBsafe::InitTk\fR it will return the desired \fBargv\fR equivalent
(\fB\-use\fR \fIwindowId\fR, correct \fB\-display\fR, etc.)
.PP
@@ -62,8 +62,8 @@ 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
-interpreter, slave interpreter, source
+alias, auto-loading, auto_mkindex, load, parent interpreter, safe
+interpreter, child interpreter, source
'\" Local Variables:
'\" mode: nroff
'\" End:
diff --git a/doc/menu.n b/doc/menu.n
index c6fcec3..7568820 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -303,7 +303,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
diff --git a/doc/menubar.n b/doc/menubar.n
index c3be85d..eeeb208 100644
--- a/doc/menubar.n
+++ b/doc/menubar.n
@@ -14,7 +14,7 @@ tk_menuBar, tk_bindForTraversal \- Obsolete support for menu bars
.SH SYNOPSIS
\fBtk_menuBar \fIframe \fR?\fImenu menu ...\fR?
.sp
-\fBtk_bindForTraversal \fIarg arg ... \fR
+\fBtk_bindForTraversal \fIarg ... \fR
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 1f596ce..ba874d5 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -117,7 +117,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/message.n b/doc/message.n
index 280c072..eb83d2f 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -106,7 +106,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/options.n b/doc/options.n
index 56e65dd..b1af80d 100644
--- a/doc/options.n
+++ b/doc/options.n
@@ -230,8 +230,7 @@ that is when the widget is empty. The placeholder text is displayed using
the values of the \fB\-font\fR and \fB\-justify\fR options.
.OP \-placeholderforeground placeholderForeground PlaceholderForeground
Specifies the foreground color to use when the placeholder text is
-displayed. If this option is the empty string, the default color gray70
-is used.
+displayed. The default color is platform-specific.
.OP \-relief relief Relief
Specifies the 3-D effect desired for the widget. Acceptable
values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR,
diff --git a/doc/pack.n b/doc/pack.n
index 980dd6e..da09a6d 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -22,16 +22,16 @@ packing them in order around the edges of the parent.
The \fBpack\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
-\fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
+\fBpack \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
If the first argument to \fBpack\fR is a window name (any value
starting with
.QW . ),
then the command is processed in the same way as \fBpack configure\fR.
.TP
-\fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
-The arguments consist of the names of one or more slave windows
+\fBpack configure \fIwindow \fR?\fIwindow ...\fR? ?\fIoptions\fR?
+The arguments consist of the names of one or more content windows
followed by pairs of arguments that specify how
-to manage the slaves.
+to manage the content.
See \fBTHE PACKER ALGORITHM\fR below for details on how the options
are used by the packer.
The following options are supported:
@@ -39,232 +39,236 @@ The following options are supported:
.TP
\fB\-after \fIother\fR
\fIOther\fR must the name of another window.
-Use its master as the master for the slaves, and insert
-the slaves just after \fIother\fR in the packing order.
+Use its container as the container for the content, and insert
+the content just after \fIother\fR in the packing order.
.TP
\fB\-anchor \fIanchor\fR
\fIAnchor\fR must be a valid anchor position such as \fBn\fR
-or \fBsw\fR; it specifies where to position each slave in its
+or \fBsw\fR; it specifies where to position each content in its
parcel.
Defaults to \fBcenter\fR.
.TP
\fB\-before \fIother\fR
\fIOther\fR must the name of another window.
-Use its master as the master for the slaves, and insert
-the slaves just before \fIother\fR in the packing order.
+Use its container as the container for the content, and insert
+the content just before \fIother\fR in the packing order.
.TP
\fB\-expand \fIboolean\fR
-Specifies whether the slaves should be expanded to consume
-extra space in their master.
+Specifies whether the content should be expanded to consume
+extra space in their container.
\fIBoolean\fR may have any proper boolean value, such as \fB1\fR
or \fBno\fR.
Defaults to 0.
.TP
\fB\-fill \fIstyle\fR
-If a slave's parcel is larger than its requested dimensions, this
-option may be used to stretch the slave.
+If a content's parcel is larger than its requested dimensions, this
+option may be used to stretch the content.
\fIStyle\fR must have one of the following values:
.RS
.TP
\fBnone\fR
-Give the slave its requested dimensions plus any internal padding
+Give the content its requested dimensions plus any internal padding
requested with \fB\-ipadx\fR or \fB\-ipady\fR. This is the default.
.TP
\fBx\fR
-Stretch the slave horizontally to fill the entire width of its
+Stretch the content horizontally to fill the entire width of its
parcel (except leave external padding as specified by \fB\-padx\fR).
.TP
\fBy\fR
-Stretch the slave vertically to fill the entire height of its
+Stretch the content vertically to fill the entire height of its
parcel (except leave external padding as specified by \fB\-pady\fR).
.TP
\fBboth\fR
-Stretch the slave both horizontally and vertically.
+Stretch the content both horizontally and vertically.
.RE
.TP
-\fB\-in \fIother\fR
-Insert the slave(s) at the end of the packing order for the master
-window given by \fIother\fR.
+\fB\-in \fIcontainer\fR
+Insert the window at the end of the packing order for the container
+window given by \fIcontainer\fR.
.TP
\fB\-ipadx \fIamount\fR
\fIAmount\fR specifies how much horizontal internal padding to
-leave on each side of the slave(s).
+leave on each side of the content.
\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
\fIAmount\fR specifies how much vertical internal padding to
-leave on each side of the slave(s).
+leave on each side of the content.
\fIAmount\fR defaults to 0.
.TP
\fB\-padx \fIamount\fR
\fIAmount\fR specifies how much horizontal external padding to
-leave on each side of the slave(s). \fIAmount\fR may be a list
+leave on each side of the content. \fIAmount\fR may be a list
of two values to specify padding for left and right separately.
\fIAmount\fR defaults to 0.
.TP
\fB\-pady \fIamount\fR
\fIAmount\fR specifies how much vertical external padding to
-leave on each side of the slave(s). \fIAmount\fR may be a list
+leave on each side of the content. \fIAmount\fR may be a list
of two values to specify padding for top and bottom separately.
\fIAmount\fR defaults to 0.
.TP
\fB\-side \fIside\fR
-Specifies which side of the master the slave(s) will be packed against.
+Specifies which side of the container the content will be packed against.
Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
Defaults to \fBtop\fR.
.LP
If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified
-then each of the slaves will be inserted at the end of the packing list
+then each of the content will be inserted at the end of the packing list
for its parent unless it is already managed by the packer (in which
case it will be left where it is).
-If one of these options is specified then all the slaves will be
+If one of these options is specified then all the content will be
inserted at the specified point.
-If any of the slaves are already managed by the geometry manager
+If any of the content are already managed by the geometry manager
then any unspecified options for them retain their previous values rather
than receiving default values.
.RE
.TP
-\fBpack forget \fIslave \fR?\fIslave ...\fR?
-Removes each of the \fIslave\fRs from the packing order for its
-master and unmaps their windows.
-The slaves will no longer be managed by the packer.
+\fBpack forget \fIwindow \fR?\fIwindow ...\fR?
+Removes each of the \fIwindow\fRs from the packing order for its
+container and unmaps their windows.
+The content will no longer be managed by the packer.
.RS
.PP
-.VS TIP518
-If the last slave of the master becomes unmanaged, this will also send
-the virtual event \fB<<NoManagedChild>>\fR to the master; the master
+.VS "TIP 518"
+If the last content window of the container becomes unmanaged, this will also send
+the virtual event \fB<<NoManagedChild>>\fR to the container; the container
may choose to resize itself (or otherwise respond) to such a change.
-.VE TIP518
+.VE "TIP 518"
.RE
.TP
-\fBpack info \fIslave\fR
+\fBpack info \fIwindow\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
+the window given by \fIwindow\fR in the same option-value form that
might be specified to \fBpack configure\fR.
The first two elements of the list are
-.QW "\fB\-in \fImaster\fR"
-where \fImaster\fR is the slave's master.
+.QW "\fB\-in \fIcontainer\fR"
+where \fIcontainer\fR is the window's container.
.TP
-\fBpack propagate \fImaster\fR ?\fIboolean\fR?
+\fBpack propagate \fIcontainer\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
+then propagation is enabled for \fIcontainer\fR, which must be a window
name (see \fBGEOMETRY PROPAGATION\fR below).
If \fIboolean\fR has a false boolean value then propagation is
-disabled for \fImaster\fR.
+disabled for \fIcontainer\fR.
In either of these cases an empty string is returned.
If \fIboolean\fR is omitted then the command returns \fB0\fR or
\fB1\fR to indicate whether propagation is currently enabled
-for \fImaster\fR.
+for \fIcontainer\fR.
Propagation is enabled by default.
.TP
-\fBpack slaves \fImaster\fR
-Returns a list of all of the slaves in the packing order for \fImaster\fR.
-The order of the slaves in the list is the same as their order in
+\fBpack content \fIwindow\fR
+Returns a list of all of the content windows in the packing order for \fIwindow\fR.
+The order of the content windows in the list is the same as their order in
the packing order.
-If \fImaster\fR has no slaves then an empty string is returned.
+If \fIwindow\fR has no content then an empty string is returned.
+.TP
+\fBpack slaves \fIwindow\fR
+.
+Synonym for . \fBpack content \fIwindow\fR
.SH "THE PACKER ALGORITHM"
.PP
-For each master the packer maintains an ordered list of slaves
-called the \fIpacking list\fR.
+For each container the packer maintains an ordered list of content
+windows called the \fIpacking list\fR.
The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration
-options are used to specify the master for each slave and the slave's
+options are used to specify the container for each content and the content's
position in the packing list.
-If none of these options is given for a slave then the slave
+If none of these options is given for a content then the content
is added to the end of the packing list for its parent.
.PP
-The packer arranges the slaves for a master by scanning the
+The packer arranges the content windows for a container by scanning the
packing list in order.
-At the time it processes each slave, a rectangular area within
-the master is still unallocated.
-This area is called the \fIcavity\fR; for the first slave it
-is the entire area of the master.
+At the time it processes each content, a rectangular area within
+the container is still unallocated.
+This area is called the \fIcavity\fR; for the first content it
+is the entire area of the container.
.PP
-For each slave the packer carries out the following steps:
+For each content the packer carries out the following steps:
.IP [1]
-The packer allocates a rectangular \fIparcel\fR for the slave
-along the side of the cavity given by the slave's \fB\-side\fR option.
+The packer allocates a rectangular \fIparcel\fR for the content
+along the side of the cavity given by the content's \fB\-side\fR option.
If the side is top or bottom then the width of the parcel is
the width of the cavity and its height is the requested height
-of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options.
+of the content plus the \fB\-ipady\fR and \fB\-pady\fR options.
For the left or right side the height of the parcel is
the height of the cavity and the width is the requested width
-of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
+of the content plus the \fB\-ipadx\fR and \fB\-padx\fR options.
The parcel may be enlarged further because of the \fB\-expand\fR
option (see \fBEXPANSION\fR below)
.IP [2]
-The packer chooses the dimensions of the slave.
-The width will normally be the slave's requested width plus
+The packer chooses the dimensions of the content.
+The width will normally be the content's requested width plus
twice its \fB\-ipadx\fR option and the height will normally be
-the slave's requested height plus twice its \fB\-ipady\fR
+the content's requested height plus twice its \fB\-ipady\fR
option.
However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR
-then the width of the slave is expanded to fill the width of the parcel,
+then the width of the content is expanded to fill the width of the parcel,
minus twice the \fB\-padx\fR option.
If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR
-then the height of the slave is expanded to fill the width of the parcel,
+then the height of the content is expanded to fill the width of the parcel,
minus twice the \fB\-pady\fR option.
.IP [3]
-The packer positions the slave over its parcel.
-If the slave is smaller than the parcel then the \fB\-anchor\fR
-option determines where in the parcel the slave will be placed.
+The packer positions the content over its parcel.
+If the content is smaller than the parcel then the \fB\-anchor\fR
+option determines where in the parcel the content will be placed.
If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given
amount of external padding will always be left between the
-slave and the edges of the parcel.
+content and the edges of the parcel.
.PP
-Once a given slave has been packed, the area of its parcel
+Once a given content has been packed, the area of its parcel
is subtracted from the cavity, leaving a smaller rectangular
-cavity for the next slave.
-If a slave does not use all of its parcel, the unused space
-in the parcel will not be used by subsequent slaves.
+cavity for the next content.
+If a content does not use all of its parcel, the unused space
+in the parcel will not be used by subsequent content.
If the cavity should become too small to meet the needs of
-a slave then the slave will be given whatever space is
+a content then the content will be given whatever space is
left in the cavity.
-If the cavity shrinks to zero size, then all remaining slaves
+If the cavity shrinks to zero size, then all remaining content
on the packing list will be unmapped from the screen until
-the master window becomes large enough to hold them again.
+the container window becomes large enough to hold them again.
.SS "EXPANSION"
.PP
-If a master window is so large that there will be extra space
-left over after all of its slaves have been packed, then the
-extra space is distributed uniformly among all of the slaves
+If a container window is so large that there will be extra space
+left over after all of its content have been packed, then the
+extra space is distributed uniformly among all of the content
for which the \fB\-expand\fR option is set.
Extra horizontal space is distributed among the expandable
-slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
+content whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
and extra vertical space is distributed among the expandable
-slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
+content whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
.SS "GEOMETRY PROPAGATION"
.PP
-The packer normally computes how large a master must be to
-just exactly meet the needs of its slaves, and it sets the
-requested width and height of the master to these dimensions.
+The packer normally computes how large a container must be to
+just exactly meet the needs of its content, and it sets the
+requested width and height of the container to these dimensions.
This causes geometry information to propagate up through a
window hierarchy to a top-level window so that the entire
sub-tree sizes itself to fit the needs of the leaf windows.
However, the \fBpack propagate\fR command may be used to
-turn off propagation for one or more masters.
+turn off propagation for one or more containers.
If propagation is disabled then the packer will not set
the requested width and height of the packer.
-This may be useful if, for example, you wish for a master
+This may be useful if, for example, you wish for a container
window to have a fixed size that you specify.
-.SH "RESTRICTIONS ON MASTER WINDOWS"
+.SH "RESTRICTIONS ON CONTAINER WINDOWS"
.PP
-The master for each slave must either be the slave's parent
-(the default) or a descendant of the slave's parent.
+The container for each content must either be the content's parent
+(the default) or a descendant of the content's parent.
This restriction is necessary to guarantee that the
-slave can be placed over any part of its master that is
-visible without danger of the slave being clipped by its parent.
+content can be placed over any part of its container that is
+visible without danger of the content being clipped by its parent.
.SH "PACKING ORDER"
.PP
-If the master for a slave is not its parent then you must make sure
-that the slave is higher in the stacking order than the master.
-Otherwise the master will obscure the slave and it will appear as
-if the slave has not been packed correctly.
-The easiest way to make sure the slave is higher than the master is
-to create the master window first: the most recently created window
+If the container for a content is not its parent then you must make sure
+that the content is higher in the stacking order than the container.
+Otherwise the container will obscure the content and it will appear as
+if the content has not been packed correctly.
+The easiest way to make sure the content is higher than the container is
+to create the container window first: the most recently created window
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.
+the stacking order of either the container or the content.
.SH EXAMPLE
.PP
.CS
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 9fc2b72..cad256a 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -92,7 +92,7 @@ the same as the path name of the panedwindow's window. This command
may be used to invoke various operations on the widget. It has the
following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as
the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs
@@ -330,7 +330,7 @@ When a pane is resized from outside (e.g. it is packed to expand and
fill, and the containing toplevel is resized), space is added to the final
(rightmost or bottommost) pane in the window.
.PP
-Unlike slave windows managed by e.g. pack or grid, the panes managed by a
+Unlike child windows managed by e.g. pack or grid, the panes managed by a
panedwindow do not change width or height to accommodate changes in the
requested widths or heights of the panes, once these have become mapped.
Therefore it may be advisable, particularly when creating layouts
diff --git a/doc/photo.n b/doc/photo.n
index 2673985..3b206f5 100644
--- a/doc/photo.n
+++ b/doc/photo.n
@@ -28,7 +28,7 @@ photo \- Full-color images
\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 \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
.fi
.BE
@@ -128,7 +128,7 @@ This command may be used to invoke various operations
on the image.
It has the following general form:
.CS
-\fIimageName option \fR?\fIarg arg ...\fR?
+\fIimageName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -394,7 +394,7 @@ 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 \fR?\fIarg arg ...\fR?
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg ...\fR?
.
Allows examination and manipulation of the transparency information in
the photo image. Several subcommands are available:
diff --git a/doc/place.n b/doc/place.n
index 3ebaf20..d887ee7 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -18,26 +18,26 @@ place \- Geometry manager for fixed or rubber-sheet placement
.PP
The placer is a geometry manager for Tk.
It provides simple fixed placement of windows, where you specify
-the exact size and location of one window, called the \fIslave\fR,
-within another window, called the \fImaster\fR.
+the exact size and location of one window, called the \fIcontent\fR,
+within another window, called the \fIcontainer\fR.
The placer also provides rubber-sheet placement, where you specify the
-size and location of the slave in terms of the dimensions of
-the master, so that the slave changes size and location
-in response to changes in the size of the master.
+size and location of the content in terms of the dimensions of
+the container, so that the content changes size and location
+in response to changes in the size of the container.
Lastly, the placer allows you to mix these styles of placement so
-that, for example, the slave has a fixed width and height but is
-centered inside the master.
+that, for example, the content has a fixed width and height but is
+centered inside the container.
.PP
.TP
\fBplace \fIwindow option value \fR?\fIoption value ...\fR?
-Arrange for the placer to manage the geometry of a slave whose
+Arrange for the placer to manage the geometry of a content whose
pathName is \fIwindow\fR. The remaining arguments consist of one or
more \fIoption\-value\fR pairs that specify the way in which
\fIwindow\fR's geometry is managed. \fIOption\fR may have any of the
values accepted by the \fBplace configure\fR command.
.TP
\fBplace configure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
-Query or modify the geometry options of the slave given by
+Query or modify the geometry options of the content given by
\fIwindow\fR. If no \fIoption\fR is specified, this command returns a
list describing the available options (see \fBTk_ConfigureInfo\fR for
information on the format of this list). If \fIoption\fR is specified
@@ -59,27 +59,27 @@ The anchor point is in terms of the outer area of \fIwindow\fR
including its border, if any.
Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of
\fIwindow\fR's border will appear at the given (x,y) location
-in the master.
+in the container.
The anchor position defaults to \fBnw\fR.
.TP
\fB\-bordermode \fImode\fR
\fIMode\fR determines the degree to which borders within the
-master are used in determining the placement of the slave.
+container are used in determining the placement of the content.
The default and most common value is \fBinside\fR.
-In this case the placer considers the area of the master to
-be the innermost area of the master, inside any border:
+In this case the placer considers the area of the container to
+be the innermost area of the container, inside any border:
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
+means \fIwindow\fR will fill the area inside the container's
border.
.RS
.PP
If \fImode\fR is \fBoutside\fR then the placer considers
-the area of the master to include its border;
+the area of the container to include its border;
this mode is typically used when placing \fIwindow\fR
-outside its master, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.
+outside its container, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.
Lastly, \fImode\fR may be specified as \fBignore\fR, in which
-case borders are ignored: the area of the master is considered
+case borders are ignored: the area of the container 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.
@@ -94,61 +94,61 @@ If \fIsize\fR is an empty string, or if no \fB\-height\fR or
\fB\-relheight\fR option is specified, then the height requested
internally by the window will be used.
.TP
-\fB\-in \fImaster\fR
-\fIMaster\fR specifies the path name of the window relative
+\fB\-in \fIcontainer\fR
+\fIContainer\fR specifies the path name of the window relative
to which \fIwindow\fR is to be placed.
-\fIMaster\fR must either be \fIwindow\fR's parent or a descendant
+\fIContainer\fR must either be \fIwindow\fR's parent or a descendant
of \fIwindow\fR's parent.
-In addition, \fImaster\fR and \fIwindow\fR must both be descendants
+In addition, \fIcontainer\fR and \fIwindow\fR must both be descendants
of the same top-level window.
These restrictions are necessary to guarantee
-that \fIwindow\fR is visible whenever \fImaster\fR is visible.
-If this option is not specified then the master defaults to
+that \fIwindow\fR is visible whenever \fIcontainer\fR is visible.
+If this option is not specified then the other window defaults to
\fIwindow\fR's parent.
.TP
\fB\-relheight \fIsize\fR
\fISize\fR specifies the height for \fIwindow\fR.
In this case the height is specified as a floating-point number
-relative to the height of the master: 0.5 means \fIwindow\fR will
-be half as high as the master, 1.0 means \fIwindow\fR will have
-the same height as the master, and so on.
-If both \fB\-height\fR and \fB\-relheight\fR are specified for a slave,
+relative to the height of the container: 0.5 means \fIwindow\fR will
+be half as high as the container, 1.0 means \fIwindow\fR will have
+the same height as the container, and so on.
+If both \fB\-height\fR and \fB\-relheight\fR are specified for a content,
their values are summed. For example, \fB\-relheight 1.0 \-height \-2\fR
-makes the slave 2 pixels shorter than the master.
+makes the content 2 pixels shorter than the container.
.TP
\fB\-relwidth \fIsize\fR
\fISize\fR specifies the width for \fIwindow\fR.
In this case the width is specified as a floating-point number
-relative to the width of the master: 0.5 means \fIwindow\fR will
-be half as wide as the master, 1.0 means \fIwindow\fR will have
-the same width as the master, and so on.
-If both \fB\-width\fR and \fB\-relwidth\fR are specified for a slave,
+relative to the width of the container: 0.5 means \fIwindow\fR will
+be half as wide as the container, 1.0 means \fIwindow\fR will have
+the same width as the container, and so on.
+If both \fB\-width\fR and \fB\-relwidth\fR are specified for a content,
their values are summed. For example, \fB\-relwidth 1.0 \-width 5\fR
-makes the slave 5 pixels wider than the master.
+makes the content 5 pixels wider than the container.
.TP
\fB\-relx \fIlocation\fR
-\fILocation\fR specifies the x-coordinate within the master window
+\fILocation\fR specifies the x-coordinate within the container window
of the anchor point for \fIwindow\fR.
In this case the location is specified in a relative fashion
as a floating-point number: 0.0 corresponds to the left edge
-of the master and 1.0 corresponds to the right edge of the master.
+of the container and 1.0 corresponds to the right edge of the container.
\fILocation\fR need not be in the range 0.0\-1.0.
-If both \fB\-x\fR and \fB\-relx\fR are specified for a slave
+If both \fB\-x\fR and \fB\-relx\fR are specified for a content
then their values are summed. For example, \fB\-relx 0.5 \-x \-2\fR
-positions the left edge of the slave 2 pixels to the left of the
-center of its master.
+positions the left edge of the content 2 pixels to the left of the
+center of its container.
.TP
\fB\-rely \fIlocation\fR
-\fILocation\fR specifies the y-coordinate within the master window
+\fILocation\fR specifies the y-coordinate within the container window
of the anchor point for \fIwindow\fR.
In this case the value is specified in a relative fashion
as a floating-point number: 0.0 corresponds to the top edge
-of the master and 1.0 corresponds to the bottom edge of the master.
+of the container and 1.0 corresponds to the bottom edge of the container.
\fILocation\fR need not be in the range 0.0\-1.0.
-If both \fB\-y\fR and \fB\-rely\fR are specified for a slave
+If both \fB\-y\fR and \fB\-rely\fR are specified for a content
then their values are summed. For example, \fB\-rely 0.5 \-x 3\fR
-positions the top edge of the slave 3 pixels below the
-center of its master.
+positions the top edge of the content 3 pixels below the
+center of its container.
.TP
\fB\-width \fIsize\fR
\fISize\fR specifies the width for \fIwindow\fR in screen units
@@ -160,18 +160,18 @@ or \fB\-relwidth\fR option is specified, then the width requested
internally by the window will be used.
.TP
\fB\-x \fIlocation\fR
-\fILocation\fR specifies the x-coordinate within the master window
+\fILocation\fR specifies the x-coordinate within the container window
of the anchor point for \fIwindow\fR.
The location is specified in screen units (i.e. any of the forms
accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
-of the master window.
+of the container window.
.TP
\fB\-y \fIlocation\fR
-\fILocation\fR specifies the y-coordinate within the master window
+\fILocation\fR specifies the y-coordinate within the container window
of the anchor point for \fIwindow\fR.
The location is specified in screen units (i.e. any of the forms
accepted by \fBTk_GetPixels\fR) and need not lie within the bounds
-of the master window.
+of the container window.
.PP
If the same value is specified separately with
two different options, such as \fB\-x\fR and \fB\-relx\fR, then
@@ -191,9 +191,13 @@ The list consists of \fIoption\-value\fR pairs in exactly the
same form as might be specified to the \fBplace configure\fR
command.
.TP
+\fBplace content \fIwindow\fR
+Returns a list of all the content windows for which \fIwindow\fR is the container.
+If there is no content for \fIwindow\fR then an empty string is returned.
+.TP
\fBplace slaves \fIwindow\fR
-Returns a list of all the slave windows for which \fIwindow\fR is the master.
-If there are no slaves for \fIwindow\fR then an empty string is returned.
+.
+Synonym for . \fBplace content \fIwindow\fR
.PP
If the configuration of a window has been retrieved with
\fBplace info\fR, that configuration can be restored later by
@@ -202,8 +206,8 @@ for the window and then invoking \fBplace configure\fR with
the saved information.
.SH "FINE POINTS"
.PP
-It is not necessary for the master window to be the parent
-of the slave window.
+It is not necessary for the container window to be the parent
+of the content window.
This feature is useful in at least two situations.
First, for complex window layouts it means you can create a
hierarchy of subwindows whose only purpose
@@ -221,7 +225,7 @@ can specify options for the real children
without being aware of the structure of the geometry-management
hierarchy.
.PP
-A second reason for having a master different than the slave's
+A second reason for having a container different than the content's
parent is to tie two siblings together.
For example, the placer can be used to force a window always to
be positioned centered just below one of its
@@ -229,12 +233,12 @@ siblings by specifying the configuration
.CS
\fB\-in \fIsibling\fB \-relx 0.5 \-rely 1.0 \-anchor n \-bordermode outside\fR
.CE
-Whenever the sibling is repositioned in the future, the slave
+Whenever the sibling is repositioned in the future, the content
will be repositioned as well.
.PP
Unlike many other geometry managers (such as the packer)
the placer does not make any attempt to manipulate the geometry of
-the master windows or the parents of slave windows (i.e. it does not
+the container windows or the parents of content windows (i.e. it does not
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.
@@ -249,7 +253,7 @@ label .l \-text "In the\enMiddle!" \-bg black \-fg white
.SH "SEE ALSO"
grid(n), pack(n)
.SH KEYWORDS
-geometry manager, height, location, master, place, rubber sheet, slave, width
+geometry manager, height, location, container, place, rubber sheet, content, width
'\" Local Variables:
'\" mode: nroff
'\" End:
diff --git a/doc/radiobutton.n b/doc/radiobutton.n
index fceb1ec..2169515 100644
--- a/doc/radiobutton.n
+++ b/doc/radiobutton.n
@@ -176,7 +176,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scale.n b/doc/scale.n
index d6407a0..0499d0a 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -138,7 +138,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index 5a062ce..4f808f4 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -103,7 +103,7 @@ name is \fIpathName\fR. This
command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
@@ -223,7 +223,8 @@ it is slightly less than what fits in the window, so that there
is a slight overlap between the old and new views.
\fINumber\fR is either 1, which means the next page should
become visible, or \-1, which means that the previous page should
-become visible.
+become visible. Fractional number are rounded away from 0, so
+scrolling 0.001 pages has the same effect as scrolling 1 page.
.TP
\fIprefix \fBscroll \fInumber \fBunits\fR
.
@@ -232,7 +233,9 @@ The units are defined in whatever way makes sense for the widget,
such as characters or lines in a text widget.
\fINumber\fR is either 1, which means one unit should scroll off
the top or left of the window, or \-1, which means that one unit
-should scroll off the bottom or right of the window.
+should scroll off the bottom or right of the window. Fractional
+numbers are rounded away from 0, so scrolling 0.001 units has
+the same effect as scrolling 1 unit.
.SH "OLD COMMAND SYNTAX"
.PP
In versions of Tk before 4.0, the \fBset\fR and \fBget\fR widget
diff --git a/doc/selection.n b/doc/selection.n
index ec678fa..a26c5d9 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -12,7 +12,7 @@
.SH NAME
selection \- Manipulate the X selection
.SH SYNOPSIS
-\fBselection \fIoption\fR ?\fIarg arg ...\fR?
+\fBselection \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
@@ -150,7 +150,7 @@ A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR se
.PP
On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients.
.PP
-On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves.
+On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its child interpreters which are not safe interpreters.
.PP
.SH SECURITY
.PP
diff --git a/doc/send.n b/doc/send.n
index e33a504..f200128 100644
--- a/doc/send.n
+++ b/doc/send.n
@@ -12,7 +12,7 @@
.SH NAME
send \- Execute a command in a different application
.SH SYNOPSIS
-\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg arg ...\fR?
+\fBsend ?\fIoptions\fR? \fIapp cmd \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/spinbox.n b/doc/spinbox.n
index 39961aa..6c8801d 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -239,7 +239,7 @@ The \fBspinbox\fR command creates a new Tcl command whose
name is \fIpathName\fR. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.
@@ -470,7 +470,8 @@ way through the text appears at the left edge of the window.
\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.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
\fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation
of one of these.
If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR
diff --git a/doc/text.n b/doc/text.n
index 8915f71..60a55af 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -1052,7 +1052,7 @@ The \fBtext\fR command creates a new Tcl command whose name is the same as the
path name of the text's window. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as the text
widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact
@@ -1082,7 +1082,7 @@ satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==,
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers
to an earlier character in the text than \fIindex2\fR, and so on.
.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?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
@@ -1095,7 +1095,7 @@ 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 \fBtext\fR command.
.TP
-\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR
+\fIpathName \fBcount\fR ?\fIoptions\fR? \fIindex1 index2\fR
.
Counts the number of relevant things between the two indices. If \fIindex1\fR
is after \fIindex2\fR, the result will be a negative number (and this holds
@@ -1281,7 +1281,7 @@ must have a create script.) In this case an empty string is returned, and you
must query the window by its index position to get more information.
.RE
.TP
-\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBedit \fIoption \fR?\fIarg ...\fR?
.
This command controls the undo mechanism and the modified flag. The exact
behavior of the command depends on the \fIoption\fR argument that follows the
@@ -1349,7 +1349,7 @@ given, then, within each range, only those characters which are not elided
will be returned. This may have the effect that some of the returned ranges
are empty strings.
.TP
-\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBimage \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded images. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBtag\fR
@@ -1414,7 +1414,7 @@ effect as if a separate \fIpathName \fBinsert\fR widget command had been
issued for each pair, in order. The last \fItagList\fR argument may be
omitted.
.TP
-\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBmark \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate marks. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The
@@ -1694,7 +1694,7 @@ calculations, the scheduling is immediate. The command returns the empty
string. \fBbgerror\fR is called on \fIcommand\fR failure.
.RE
.TP
-\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBtag \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate tags. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBtag\fR argument. The
@@ -1861,7 +1861,7 @@ file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command
has no effect. This command returns an empty string.
.RE
.TP
-\fIpathName \fBwindow \fIoption \fR?\fIarg arg ...\fR?
+\fIpathName \fBwindow \fIoption \fR?\fIarg ...\fR?
.
This command is used to manipulate embedded windows. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBwindow\fR
diff --git a/doc/tk.n b/doc/tk.n
index 43ce64d..d32f4f7 100644
--- a/doc/tk.n
+++ b/doc/tk.n
@@ -12,7 +12,7 @@
.SH NAME
tk \- Manipulate Tk internal state
.SH SYNOPSIS
-\fBtk\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBtk\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/tk_mac.n b/doc/tk_mac.n
index a4206a9..2ce1374 100644
--- a/doc/tk_mac.n
+++ b/doc/tk_mac.n
@@ -218,11 +218,17 @@ support.
.TP
\fB::tk::mac::standardAboutPanel\fR
.
-Brings the standard Cocoa about panel to the front, with all its information
-filled in from your application bundle files (standard about panel with no
-options specified). See Apple Technote TN2179 and the AppKit documentation for
--[NSApplication orderFrontStandardAboutPanelWithOptions:] for details on the
-Info.plist keys and app bundle files used by the about panel.
+Brings the standard Cocoa about panel to the front with information filled in
+from the application bundle files. The panel displays the application icon and
+the values associated to the info.plist keys named CFBundleName,
+CFBundleShortVersionString, NSAboutPanelOptionVersion and
+NSHumanReadableCopyright. If a file named \fICredits.html\fR or
+\fICredits.rtf\fR exists in the bundle's Resources directory then its contents
+will be displayed in a scrolling text box at the bottom of the dialog. See the
+documentation for -[NSApplication orderFrontStandardAboutPanelWithOptions:]
+for more details. A hook is also provided for a custom About dialog. If a Tcl
+proc named tkAboutDialog is defined in the main interpreter then that
+procedure will be called instead of opening the standardAboutPanel.
.SH "SYSTEM CONFIGURATION"
.PP
There are a number of additional global configuration options that control the
diff --git a/doc/toplevel.n b/doc/toplevel.n
index c56e035..a7c11d4 100644
--- a/doc/toplevel.n
+++ b/doc/toplevel.n
@@ -139,7 +139,7 @@ command may be used to invoke various
operations on the widget. It has the following general form:
.PP
.CS
-\fIpathName option \fR?\fIarg arg ...\fR?
+\fIpathName option \fR?\fIarg ...\fR?
.CE
.PP
\fIPathName\fR is the name of the command, which is the same as
diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3
index 09d59e0..0f8a171 100644
--- a/doc/ttk_Geometry.3
+++ b/doc/ttk_Geometry.3
@@ -66,8 +66,9 @@ Extra padding (in pixels) to add uniformly to each side of a region.
.AP short bottom in
Extra padding (in pixels) to add to the bottom of a region.
.AP Ttk_Box box in
-.AP "Ttk_Box *" box_rtn out
Specifies a rectangular region.
+.AP "Ttk_Box *" box_rtn out
+A rectangular region.
.AP int height in
The height in pixels of a region.
.AP "Tcl_Interp *" interp in
@@ -79,13 +80,14 @@ String value contains a symbolic name
to be converted to an enumerated value or bitmask.
Internal rep may be be modified to cache corresponding value.
.AP Ttk_Padding padding in
-.AP "Ttk_Padding *" padding_rtn out
Extra padding to add on the inside of a region.
+.AP "Ttk_Padding *" padding_rtn out
+Padding present in the inside of a region.
.AP Ttk_Box parcel in
A rectangular region, allocated from a cavity.
.AP int relief in
One of the standard Tk relief options
-(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.).
+(\fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, etc.).
See \fBTk_GetReliefFromObj\fR.
.AP short right in
Extra padding (in pixels) to add to the right side of a region.
@@ -95,13 +97,13 @@ One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR,
.AP unsigned sticky in
A bitmask containing one or more of the bits
\fBTTK_STICK_W\fR (west, or left),
-\fBTTK_STICK_E\fR (east, or right,
+\fBTTK_STICK_E\fR (east, or right),
\fBTTK_STICK_N\fR (north, or top), and
\fBTTK_STICK_S\fR (south, or bottom).
-\fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E),
-\fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S),
-and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR
-are synonyms for (TTK_FILL_X|TTK_FILL_Y).
+\fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR),
+\fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR),
+and \fBTTK_FILL_BOTH\fR
+is a synonym for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR).
See also: \fIgrid(n)\fR.
.AP Tk_Window tkwin in
Window whose screen geometry determines
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
index 3ec3e77..ec61428 100644
--- a/doc/ttk_combobox.n
+++ b/doc/ttk_combobox.n
@@ -19,7 +19,7 @@ the user may select the value of the text field from among the
values in the list.
.SO ttk_widget
\-class \-cursor \-takefocus
-\-style \-placeholder
+\-style \-placeholder \-placeholderforeground
.SE
.\" ALSO: Other entry widget options
.SH "WIDGET-SPECIFIC OPTIONS"
@@ -142,12 +142,16 @@ are:
.RS
Can only be changed when using non-native and non-graphical themes.
.RE
+\fB\-insertcolor\fP \fIcolor\fP
+.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-postoffset\fP \fIpadding\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n
index 552700a..9a2d429 100644
--- a/doc/ttk_entry.n
+++ b/doc/ttk_entry.n
@@ -26,7 +26,7 @@ standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command.
\-class \-cursor
\-font \-foreground
\-style
-\-takefocus \-xscrollcommand \-placeholder
+\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-exportselection exportSelection ExportSelection
@@ -448,12 +448,16 @@ Some themes use a graphical background and their field background colors cannot
.RE
\fB\-foreground\fP \fIcolor\fP
.br
+\fB\-insertcolor\fP \fIcolor\fP
+.br
\fB\-insertwidth\fP \fIamount\fP
.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-relief\fP \fIrelief\fP
.br
\fB\-selectbackground\fP \fIcolor\fP
diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n
index 3b399ee..c146dd1 100644
--- a/doc/ttk_intro.n
+++ b/doc/ttk_intro.n
@@ -86,7 +86,7 @@ ttk::\fBstyle layout\fR Horizontal.TScrollbar {
Scrollbar.trough \-children {
Scrollbar.leftarrow \-side left \-sticky w
Scrollbar.rightarrow \-side right \-sticky e
- Scrollbar.thumb \-side left \-expand true \-sticky ew
+ Scrollbar.thumb \-sticky ew
}
}
.CE
diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n
index ae32a44..efbfe6c 100644
--- a/doc/ttk_notebook.n
+++ b/doc/ttk_notebook.n
@@ -20,7 +20,7 @@ ttk::notebook \- Multi-paned container widget
.SH DESCRIPTION
A \fBttk::notebook\fR widget manages a collection of windows
and displays a single one at a time.
-Each slave window is associated with a \fItab\fR,
+Each content window is associated with a \fItab\fR,
which the user may select to change the currently-displayed window.
.SO ttk_widget
\-class \-cursor \-takefocus
@@ -56,11 +56,11 @@ Either \fBnormal\fR, \fBdisabled\fR or \fBhidden\fR.
If \fBdisabled\fR, then the tab is not selectable.
If \fBhidden\fR, then the tab is not shown.
.OP \-sticky sticky Sticky
-Specifies how the slave window is positioned within the pane area.
+Specifies how the content window is positioned within the pane area.
Value is a string containing zero or more of the characters
\fBn, s, e,\fR or \fBw\fR.
Each letter refers to a side (north, south, east, or west)
-that the slave window will
+that the content window will
.QW stick
to, as per the \fBgrid\fR geometry manager.
.OP \-padding padding Padding
@@ -86,7 +86,7 @@ any of the following forms:
.IP \(bu
An integer between zero and the number of tabs;
.IP \(bu
-The name of a slave window;
+The name of a content window;
.IP \(bu
A positional specification of the form
.QW @\fIx\fR,\fIy\fR ,
@@ -156,7 +156,7 @@ See \fIttk::widget(n)\fR.
.TP
\fIpathname \fBselect\fR ?\fItabid\fR?
Selects the specified tab.
-The associated slave window will be displayed,
+The associated content window will be displayed,
and the previously-selected window (if different) is unmapped.
If \fItabid\fR is omitted, returns the widget name of the
currently selected pane.
diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n
index c18f987..49dc8ff 100644
--- a/doc/ttk_spinbox.n
+++ b/doc/ttk_spinbox.n
@@ -22,7 +22,7 @@ of the \fBttk::entry\fR widget including support of the
to a Tcl variable.
.SO ttk_widget
\-class \-cursor \-state \-style
-\-takefocus \-xscrollcommand \-placeholder
+\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground
.SE
.SO ttk_entry
\-validate \-validatecommand
@@ -107,10 +107,16 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored.
.br
\fB\-foreground\fP \fIcolor\fP
.br
+\fB\-insertcolor\fP \fIcolor\fP
+.br
+\fB\-insertwidth\fP \fIamount\fP
+.br
\fB\-lightcolor\fP \fIcolor\fP
.br
\fB\-padding\fP \fIpadding\fP
.br
+\fB\-placeholderforeground\fP \fIcolor\fP
+.br
\fB\-selectbackground\fP \fIcolor\fP
.br
\fB\-selectforeground\fP \fIcolor\fP
diff --git a/doc/ttk_style.n b/doc/ttk_style.n
index db80d95..5d7b5d1 100644
--- a/doc/ttk_style.n
+++ b/doc/ttk_style.n
@@ -34,28 +34,8 @@ The \fBttk::style\fR command takes the following arguments:
\fBttk::style configure \fIstyle\fR ?\fI\-option\fR ?\fIvalue option value...\fR? ?
Sets the default value of the specified option(s) in \fIstyle\fR.
.TP
-\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
-Sets dynamic values of the specified option(s) in \fIstyle\fR.
-Each \fIstatespec / value\fR pair is examined in order;
-the value corresponding to the first matching \fIstatespec\fR
-is used.
-.TP
-\fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR??
-Returns the value specified for \fI\-option\fR in style \fIstyle\fR
-in state \fIstate\fR, using the standard lookup rules for element options.
-\fIstate\fR is a list of state names; if omitted,
-it defaults to all bits off (the
-.QW normal
-state).
-If the \fIdefault\fR argument is present, it is used as a fallback
-value in case no specification for \fI\-option\fR is found.
-.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
-.TP
-\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
-Define the widget layout for style \fIstyle\fR.
-See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR.
-If \fIlayoutSpec\fR is omitted, return the layout specification
-for style \fIstyle\fR.
+\fBttk::style element\fR \fIargs\fR
+.RS
.TP
\fBttk::style element create\fR \fIelementName\fR \fItype\fR ?\fIargs...\fR?
Creates a new element in the current theme of type \fItype\fR.
@@ -70,6 +50,33 @@ Returns the list of elements defined in the current theme.
.TP
\fBttk::style element options \fIelement\fR
Returns the list of \fIelement\fR's options.
+.RE
+.TP
+\fBttk::style layout \fIstyle\fR ?\fIlayoutSpec\fR?
+Define the widget layout for style \fIstyle\fR.
+See \fBLAYOUTS\fR below for the format of \fIlayoutSpec\fR.
+If \fIlayoutSpec\fR is omitted, return the layout specification
+for style \fIstyle\fR.
+.TP
+\fBttk::style lookup \fIstyle\fR \fI\-option \fR?\fIstate \fR?\fIdefault\fR??
+Returns the value specified for \fI\-option\fR in style \fIstyle\fR
+in state \fIstate\fR, using the standard lookup rules for element options.
+\fIstate\fR is a list of state names; if omitted,
+it defaults to all bits off (the
+.QW normal
+state).
+If the \fIdefault\fR argument is present, it is used as a fallback
+value in case no specification for \fI\-option\fR is found.
+.\" Otherwise -- signal error? return empty string? Leave unspecified for now.
+.TP
+\fBttk::style map \fIstyle\fR ?\fI\-option\fB { \fIstatespec value...\fB }\fR?
+Sets dynamic values of the specified option(s) in \fIstyle\fR.
+Each \fIstatespec / value\fR pair is examined in order;
+the value corresponding to the first matching \fIstatespec\fR
+is used.
+.TP
+\fBttk::style theme\fR \fIargs\fR
+.RS
.TP
\fBttk::style theme create\fR \fIthemeName\fR ?\fB\-parent \fIbasedon\fR? ?\fB\-settings \fIscript...\fR ?
Creates a new theme. It is an error if \fIthemeName\fR already exists.
@@ -78,19 +85,20 @@ styles, elements, and layouts from the parent theme \fIbasedon\fR.
If \fB\-settings\fR is present, \fIscript\fR is evaluated in the
context of the new theme as per \fBttk::style theme settings\fR.
.TP
+\fBttk::style theme names\fR
+Returns a list of all known themes.
+.TP
\fBttk::style theme settings \fIthemeName\fR \fIscript\fR
Temporarily sets the current theme to \fIthemeName\fR,
evaluate \fIscript\fR, then restore the previous theme.
Typically \fIscript\fR simply defines styles and elements,
though arbitrary Tcl code may appear.
.TP
-\fBttk::style theme names\fR
-Returns a list of all known themes.
-.TP
\fBttk::style theme use\fR ?\fIthemeName\fR?
Without an argument the result is the name of the current theme.
Otherwise this command sets the current theme to \fIthemeName\fR,
and refreshes all widgets.
+.RE
.SH LAYOUTS
.PP
A \fIlayout\fR specifies a list of elements, each followed
@@ -98,19 +106,40 @@ by one or more options specifying how to arrange the element.
The layout mechanism uses a simplified version of the \fBpack\fR
geometry manager: given an initial cavity,
each element is allocated a parcel.
+Then the parcel actually used by the element is adjusted within
+the allocated parcel.
Valid options are:
+.\" -border should remain undocumented for now (dubious usefulness)
+.\" .TP
+.\" \fB\-border\fR \fIboolean\fR
+.\" Specifies whether the element is drawn after its children. Defaults to 0.
+.TP
+\fB\-children { \fIsublayout...\fB }\fR
+Specifies a list of elements to place inside the element.
+.TP
+\fB\-expand\fR \fIboolean\fR
+Specifies whether the allocated parcel is the entire cavity. If so,
+simultaneous specification of \fB\-side\fR is ignored.
+Defaults to 0.
.TP
\fB\-side \fIside\fR
Specifies which side of the cavity to place the element;
one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
-If omitted, the element occupies the entire cavity.
+For instance, \fB\-side top\fR allocates the parcel along the top of
+the cavity having width and height respectively the width of the cavity
+and the height of the element.
+If omitted, the allocated parcel is the entire cavity (same effect
+as \fB\-expand\fR 1).
.TP
\fB\-sticky\fR \fB[\fInswe\fB]\fR
-Specifies where the element is placed inside its allocated parcel.
-.TP
-\fB\-children { \fIsublayout... \fB}\fR
-Specifies a list of elements to place inside the element.
-.\" Also: -border, -unit, -expand: may go away.
+Specifies the actual parcel position and size inside the allocated parcel.
+If specified as an empty string then the actual parcel is centered in
+the allocated parcel. Default is \fBnswe\fR.
+.\" -unit should remain undocumented for now (dubious usefulness)
+.\" .TP
+.\" \fB\-unit\fR \fIboolean\fR
+.\" Specifies whether the element propagates its state to its children.
+.\" Defaults to 0.
.PP
For example:
.CS
diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n
index 73affdd..7bab661 100644
--- a/doc/ttk_widget.n
+++ b/doc/ttk_widget.n
@@ -152,13 +152,14 @@ to zero, then automatic wrapping is not performed; otherwise
the text is split into lines such that no line is longer
than the specified value.
.SH "ENTRY OPTIONS"
-The following option is supported by entry, spinbox and combobox:
+The following options are supported by entry, spinbox and combobox:
.OP \-placeholder placeHolder PlaceHolder
Specifies a help text string to display if no text is otherwise displayed,
that is when the widget is empty. The placeholder text is displayed using
-the values of the \fB\-font\fR and \fB\-justify\fR options. The foreground
-color of the placeholder text can be changed using the
-\fB\-placeholderforeground\fR style option.
+the values of the \fB\-font\fR, \fB\-justify\fR and
+\fB\-placeholderforeground\fR options.
+.OP \-placeholderforeground placeHolderForeground PlaceHolderForeground
+Specifies the foreground color of the placeholder text.
.SH "COMPATIBILITY OPTIONS"
This option is only available for themed widgets that have
.QW corresponding
@@ -256,7 +257,8 @@ way through the content appears at the left edge of the window.
\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.
+\fINumber\fR must be an integer or a float, but if it is a float then
+it is converted to an integer, rounded away from 0.
\fIWhat\fR must be either \fBpages\fR or \fBunits\fR.
'\" or an abbreviation of one of these, but we don't document that.
If \fIwhat\fR is
diff --git a/doc/winfo.n b/doc/winfo.n
index fed5c39..5651f2c 100644
--- a/doc/winfo.n
+++ b/doc/winfo.n
@@ -12,7 +12,7 @@
.SH NAME
winfo \- Return window-related information
.SH SYNOPSIS
-\fBwinfo\fR \fIoption \fR?\fIarg arg ...\fR?
+\fBwinfo\fR \fIoption \fR?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
diff --git a/doc/wish.1 b/doc/wish.1
index f7d97d9..115911e 100644
--- a/doc/wish.1
+++ b/doc/wish.1
@@ -12,7 +12,7 @@
.SH NAME
wish \- Simple windowing shell
.SH SYNOPSIS
-\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg arg ...\fR?
+\fBwish\fR ?\fB\-encoding \fIname\fR? ?\fIfileName arg ...\fR?
.SH OPTIONS
.IP "\fB\-encoding \fIname\fR" 20
Specifies the encoding of the text stored in \fIfileName\fR.
diff --git a/doc/wm.n b/doc/wm.n
index aae68d9..5e6c394 100644
--- a/doc/wm.n
+++ b/doc/wm.n
@@ -708,18 +708,18 @@ case the command returns an empty string. If \fIstring\fR is not
specified then the command returns the current title for the
\fIwindow\fR. The title for a window defaults to its name.
.TP
-\fBwm transient \fIwindow\fR ?\fImaster\fR?
+\fBwm transient \fIwindow\fR ?\fIcontainer\fR?
.
-If \fImaster\fR is specified, then the window manager is informed that
+If \fIcontainer\fR is specified, then the window manager is informed that
\fIwindow\fR is a transient window (e.g. pull-down menu) working on
-behalf of \fImaster\fR (where \fImaster\fR is the path name for a
-top-level window). If \fImaster\fR is specified as an empty string
+behalf of \fIcontainer\fR (where \fIcontainer\fR is the path name for a
+top-level window). If \fIcontainer\fR is specified as an empty string
then \fIwindow\fR is marked as not being a transient window any more.
Otherwise the command returns the path name of \fIwindow\fR's current
-master, or an empty string if \fIwindow\fR is not currently a
+container, or an empty string if \fIwindow\fR is not currently a
transient window. A transient window will mirror state changes in the
-master and inherit the state of the master when initially mapped. The
-directed graph with an edge from each transient to its master must be
+container and inherit the state of the container when initially mapped. The
+directed graph with an edge from each transient to its container must be
acyclic. In particular, it is an error to attempt to make a window a
transient of itself. The window manager may also decorate a transient
window differently, removing some features normally present (e.g.,
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
index 7bb13d2..3f3e38e 100644
--- a/generic/nanosvg.h
+++ b/generic/nanosvg.h
@@ -33,27 +33,28 @@
extern "C" {
#endif
-// NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes.
-//
-// The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
-//
-// NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
-//
-// The shapes in the SVG images are transformed by the viewBox and converted to specified units.
-// That is, you should get the same looking data as your designed in your favorite app.
-//
-// NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
-// to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
-//
-// The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
-// DPI (dots-per-inch) controls how the unit conversion is done.
-//
-// If you don't know or care about the units stuff, "px" and 96 should get you going.
+/* NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes.
+ *
+ * The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
+ *
+ * NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
+ *
+ * The shapes in the SVG images are transformed by the viewBox and converted to specified units.
+ * That is, you should get the same looking data as your designed in your favorite app.
+ *
+ * NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
+ * to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
+ *
+ * The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
+ * DPI (dots-per-inch) controls how the unit conversion is done.
+ *
+ * If you don't know or care about the units stuff, "px" and 96 should get you going.
+ */
/* Example Usage:
- // Load
- NSVGImage* image;
+ // Load SVG
+ NSVGimage* image;
image = nsvgParseFromFile("test.svg", "px", 96);
printf("size: %f x %f\n", image->width, image->height);
// Use...
@@ -85,8 +86,8 @@ extern "C" {
#define NANOSVG_free free
#endif
-// float emulation for MS VC6++ compiler
-#if (_MSC_VER == 1200)
+/* float emulation for MS VC6++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#define tanf(a) (float)tan(a)
#define cosf(a) (float)cos(a)
#define sinf(a) (float)sin(a)
@@ -98,8 +99,8 @@ extern "C" {
#define fmodf(a,b) (float)fmod(a,b)
#define floorf(a) (float)floor(a)
#endif
-// float emulation for MS VC8++ compiler
-#if (_MSC_VER == 1400)
+/* float emulation for MS VC8++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1400)
#define fabsf(a) (float)fabs(a)
#endif
@@ -160,55 +161,55 @@ typedef struct NSVGpaint {
typedef struct NSVGpath
{
- float* pts; // Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ...
- int npts; // Total number of bezier points.
- char closed; // Flag indicating if shapes should be treated as closed.
- float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
- struct NSVGpath* next; // Pointer to next path, or NULL if last element.
+ float* pts; /* Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... */
+ int npts; /* Total number of bezier points. */
+ char closed; /* Flag indicating if shapes should be treated as closed. */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ struct NSVGpath* next; /* Pointer to next path, or NULL if last element. */
} NSVGpath;
typedef struct NSVGshape
{
- char id[64]; // Optional 'id' attr of the shape or its group
- NSVGpaint fill; // Fill paint
- NSVGpaint stroke; // Stroke paint
- float opacity; // Opacity of the shape.
- float strokeWidth; // Stroke width (scaled).
- float strokeDashOffset; // Stroke dash offset (scaled).
- float strokeDashArray[8]; // Stroke dash array (scaled).
- char strokeDashCount; // Number of dash values in dash array.
- char strokeLineJoin; // Stroke join type.
- char strokeLineCap; // Stroke cap type.
- float miterLimit; // Miter limit
- char fillRule; // Fill rule, see NSVGfillRule.
- unsigned char flags; // Logical or of NSVG_FLAGS_* flags
- float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
- NSVGpath* paths; // Linked list of paths in the image.
- struct NSVGshape* next; // Pointer to next shape, or NULL if last element.
+ char id[64]; /* Optional 'id' attr of the shape or its group */
+ NSVGpaint fill; /* Fill paint */
+ NSVGpaint stroke; /* Stroke paint */
+ float opacity; /* Opacity of the shape. */
+ float strokeWidth; /* Stroke width (scaled). */
+ float strokeDashOffset; /* Stroke dash offset (scaled). */
+ float strokeDashArray[8]; /* Stroke dash array (scaled). */
+ char strokeDashCount; /* Number of dash values in dash array. */
+ char strokeLineJoin; /* Stroke join type. */
+ char strokeLineCap; /* Stroke cap type. */
+ float miterLimit; /* Miter limit */
+ char fillRule; /* Fill rule, see NSVGfillRule. */
+ unsigned char flags; /* Logical or of NSVG_FLAGS_* flags */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ NSVGpath* paths; /* Linked list of paths in the image. */
+ struct NSVGshape* next; /* Pointer to next shape, or NULL if last element. */
} NSVGshape;
typedef struct NSVGimage
{
- float width; // Width of the image.
- float height; // Height of the image.
- NSVGshape* shapes; // Linked list of shapes in the image.
+ float width; /* Width of the image. */
+ float height; /* Height of the image. */
+ NSVGshape* shapes; /* Linked list of shapes in the image. */
} NSVGimage;
-// Parses SVG file from a file, returns SVG image as paths.
+/* Parses SVG file from a file, returns SVG image as paths. */
NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi);
-// Parses SVG file from a null terminated string, returns SVG image as paths.
-// Important note: changes the string.
+/* Parses SVG file from a null terminated string, returns SVG image as paths. */
+/* Important note: changes the string. */
NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi);
-// Deletes list of paths.
+/* Deletes list of paths. */
NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#ifdef __cplusplus
}
#endif
-#endif // NANOSVG_H
+#endif /* NANOSVG_H */
#ifdef NANOSVG_IMPLEMENTATION
@@ -217,7 +218,7 @@ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#include <math.h>
#define NSVG_PI (3.14159265358979323846264338327f)
-#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
+#define NSVG_KAPPA90 (0.5522847493f) /* Length proportional to radius of a cubic bezier handle for 90deg arcs. */
#define NSVG_ALIGN_MIN 0
#define NSVG_ALIGN_MID 1
@@ -230,14 +231,14 @@ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16))
#ifdef _MSC_VER
- #pragma warning (disable: 4996) // Switch off security warnings
- #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings
+ #pragma warning (disable: 4996) /* Switch off security warnings */
+ #pragma warning (disable: 4100) /* Switch off unreferenced formal parameter warnings */
#ifdef __cplusplus
#define NSVG_INLINE inline
#else
#define NSVG_INLINE
#endif
- #if !defined(strtoll) // old MSVC versions do not have strtoll()
+ #if !defined(strtoll) /* old MSVC versions do not have strtoll() */
#define strtoll _strtoi64
#endif
#else
@@ -255,16 +256,11 @@ static int nsvg__isdigit(char c)
return c >= '0' && c <= '9';
}
-static int nsvg__isnum(char c)
-{
- return strchr("0123456789+-.eE", c) != 0;
-}
-
static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; }
static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; }
-// Simple XML parser
+/* Simple XML parser */
#define NSVG_XML_TAG 1
#define NSVG_XML_CONTENT 2
@@ -274,7 +270,7 @@ static void nsvg__parseContent(char* s,
void (*contentCb)(void* ud, const char* s),
void* ud)
{
- // Trim start white spaces
+ /* Trim start white spaces */
while (*s && nsvg__isspace(*s)) s++;
if (!*s) return;
@@ -289,15 +285,15 @@ static void nsvg__parseElement(char* s,
{
const char* attr[NSVG_XML_MAX_ATTRIBS];
int nattr = 0;
- char* name;
+ char* cbname;
int start = 0;
int end = 0;
char quote;
- // Skip white space after the '<'
+ /* Skip white space after the '<' */
while (*s && nsvg__isspace(*s)) s++;
- // Check if the tag is end tag
+ /* Check if the tag is end tag */
if (*s == '/') {
s++;
end = 1;
@@ -305,21 +301,21 @@ static void nsvg__parseElement(char* s,
start = 1;
}
- // Skip comments, data and preprocessor stuff.
+ /* Skip comments, data and preprocessor stuff. */
if (!*s || *s == '?' || *s == '!')
return;
- // Get tag name
- name = s;
+ /* Get tag name */
+ cbname = s;
while (*s && !nsvg__isspace(*s)) s++;
if (*s) { *s++ = '\0'; }
- // Get attribs
+ /* Get attribs */
while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
char* name = NULL;
char* value = NULL;
- // Skip white space before the attrib name
+ /* Skip white space before the attrib name */
while (*s && nsvg__isspace(*s)) s++;
if (!*s) break;
if (*s == '/') {
@@ -327,35 +323,35 @@ static void nsvg__parseElement(char* s,
break;
}
name = s;
- // Find end of the attrib name.
+ /* Find end of the attrib name. */
while (*s && !nsvg__isspace(*s) && *s != '=') s++;
if (*s) { *s++ = '\0'; }
- // Skip until the beginning of the value.
+ /* Skip until the beginning of the value. */
while (*s && *s != '\"' && *s != '\'') s++;
if (!*s) break;
quote = *s;
s++;
- // Store value and find the end of it.
+ /* Store value and find the end of it. */
value = s;
while (*s && *s != quote) s++;
if (*s) { *s++ = '\0'; }
- // Store only well formed attributes
+ /* Store only well formed attributes */
if (name && value) {
attr[nattr++] = name;
attr[nattr++] = value;
}
}
- // List terminator
+ /* List terminator */
attr[nattr++] = 0;
attr[nattr++] = 0;
- // Call callbacks.
+ /* Call callbacks. */
if (start && startelCb)
- (*startelCb)(ud, name, attr);
+ (*startelCb)(ud, cbname, attr);
if (end && endelCb)
- (*endelCb)(ud, name);
+ (*endelCb)(ud, cbname);
}
NANOSVG_SCOPE
@@ -370,13 +366,13 @@ int nsvg__parseXML(char* input,
int state = NSVG_XML_CONTENT;
while (*s) {
if (*s == '<' && state == NSVG_XML_CONTENT) {
- // Start of a tag
+ /* Start of a tag */
*s++ = '\0';
nsvg__parseContent(mark, contentCb, ud);
mark = s;
state = NSVG_XML_TAG;
} else if (*s == '>' && state == NSVG_XML_TAG) {
- // Start of a content or new tag.
+ /* Start of a content or new tag. */
*s++ = '\0';
nsvg__parseContent(mark, contentCb, ud);
nsvg__parseElement(mark, startelCb, endelCb, ud);
@@ -620,18 +616,18 @@ static void nsvg__curveBounds(float* bounds, float* curve)
float* v2 = &curve[4];
float* v3 = &curve[6];
- // Start the bounding box by end points
+ /* Start the bounding box by end points */
bounds[0] = nsvg__minf(v0[0], v3[0]);
bounds[1] = nsvg__minf(v0[1], v3[1]);
bounds[2] = nsvg__maxf(v0[0], v3[0]);
bounds[3] = nsvg__maxf(v0[1], v3[1]);
- // Bezier curve fits inside the convex hull of it's control points.
- // If control points are inside the bounds, we're done.
+ /* Bezier curve fits inside the convex hull of it's control points. */
+ /* If control points are inside the bounds, we're done. */
if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds))
return;
- // Add bezier curve inflection points in X and Y.
+ /* Add bezier curve inflection points in X and Y. */
for (i = 0; i < 2; i++) {
a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i];
b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i];
@@ -673,7 +669,7 @@ static NSVGparser* nsvg__createParser(void)
if (p->image == NULL) goto error;
memset(p->image, 0, sizeof(NSVGimage));
- // Init style
+ /* Init style */
nsvg__xformIdentity(p->attr[0].xform);
memset(p->attr[0].id, 0, sizeof p->attr[0].id);
p->attr[0].fillColor = NSVG_RGB(0,0,0);
@@ -795,9 +791,11 @@ static void nsvg__lineTo(NSVGparser* p, float x, float y)
static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y)
{
- nsvg__addPoint(p, cpx1, cpy1);
- nsvg__addPoint(p, cpx2, cpy2);
- nsvg__addPoint(p, x, y);
+ if (p->npts > 0) {
+ nsvg__addPoint(p, cpx1, cpy1);
+ nsvg__addPoint(p, cpx2, cpy2);
+ nsvg__addPoint(p, x, y);
+ }
}
static NSVGattrib* nsvg__getAttr(NSVGparser* p)
@@ -857,7 +855,7 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi;
case NSVG_UNITS_IN: return c.value * p->dpi;
case NSVG_UNITS_EM: return c.value * attr->fontSize;
- case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; // x-height of Helvetica.
+ case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; /* x-height of Helvetica. */
case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length;
default: return c.value;
}
@@ -867,7 +865,9 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
{
NSVGgradientData* grad = p->gradients;
- while (grad) {
+ if (id == NULL || *id == '\0')
+ return NULL;
+ while (grad != NULL) {
if (strcmp(grad->id, id) == 0)
return grad;
grad = grad->next;
@@ -884,26 +884,33 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
NSVGgradient* grad;
float ox, oy, sw, sh, sl;
int nstops = 0;
+ int refIter;
data = nsvg__findGradientData(p, id);
if (data == NULL) return NULL;
- // TODO: use ref to fill in all unset values too.
+ /* TODO: use ref to fill in all unset values too. */
ref = data;
+ refIter = 0;
while (ref != NULL) {
+ NSVGgradientData* nextRef = NULL;
if (stops == NULL && ref->stops != NULL) {
stops = ref->stops;
nstops = ref->nstops;
break;
}
- ref = nsvg__findGradientData(p, ref->ref);
+ nextRef = nsvg__findGradientData(p, ref->ref);
+ if (nextRef == ref) break; /* prevent infite loops on malformed data */
+ ref = nextRef;
+ refIter++;
+ if (refIter > 32) break; /* prevent infite loops on malformed data */
}
if (stops == NULL) return NULL;
grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
if (grad == NULL) return NULL;
- // The shape width and height.
+ /* The shape width and height. */
if (data->units == NSVG_OBJECT_SPACE) {
ox = localBounds[0];
oy = localBounds[1];
@@ -923,7 +930,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh);
x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw);
y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh);
- // Calculate transform aligned to the line
+ /* Calculate transform aligned to the line */
dx = x2 - x1;
dy = y2 - y1;
grad->xform[0] = dy; grad->xform[1] = -dx;
@@ -936,7 +943,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw);
fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh);
r = nsvg__convertToPixels(p, data->radial.r, 0, sl);
- // Calculate transform aligned to the circle
+ /* Calculate transform aligned to the circle */
grad->xform[0] = r; grad->xform[1] = 0;
grad->xform[2] = 0; grad->xform[3] = r;
grad->xform[4] = cx; grad->xform[5] = cy;
@@ -1024,7 +1031,7 @@ static void nsvg__addShape(NSVGparser* p)
shape->paths = p->plist;
p->plist = NULL;
- // Calculate shape bounds
+ /* Calculate shape bounds */
shape->bounds[0] = shape->paths->bounds[0];
shape->bounds[1] = shape->paths->bounds[1];
shape->bounds[2] = shape->paths->bounds[2];
@@ -1036,7 +1043,7 @@ static void nsvg__addShape(NSVGparser* p)
shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]);
}
- // Set fill
+ /* Set fill */
if (attr->hasFill == 0) {
shape->fill.type = NSVG_PAINT_NONE;
} else if (attr->hasFill == 1) {
@@ -1053,7 +1060,7 @@ static void nsvg__addShape(NSVGparser* p)
}
}
- // Set stroke
+ /* Set stroke */
if (attr->hasStroke == 0) {
shape->stroke.type = NSVG_PAINT_NONE;
} else if (attr->hasStroke == 1) {
@@ -1069,10 +1076,10 @@ static void nsvg__addShape(NSVGparser* p)
shape->stroke.type = NSVG_PAINT_NONE;
}
- // Set flags
+ /* Set flags */
shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00);
- // Add to tail
+ /* Add to tail */
if (p->image->shapes == NULL)
p->image->shapes = shape;
else
@@ -1099,6 +1106,10 @@ static void nsvg__addPath(NSVGparser* p, char closed)
if (closed)
nsvg__lineTo(p, p->pts[0], p->pts[1]);
+ /* Expect 1 + N*3 points (N = number of cubic bezier segments). */
+ if ((p->npts % 3) != 1)
+ return;
+
path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath));
if (path == NULL) goto error;
memset(path, 0, sizeof(NSVGpath));
@@ -1108,11 +1119,11 @@ static void nsvg__addPath(NSVGparser* p, char closed)
path->closed = closed;
path->npts = p->npts;
- // Transform path.
+ /* Transform path. */
for (i = 0; i < p->npts; ++i)
nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform);
- // Find bounds
+ /* Find bounds */
for (i = 0; i < path->npts-1; i += 3) {
curve = &path->pts[i*2];
nsvg__curveBounds(bounds, curve);
@@ -1141,20 +1152,20 @@ error:
}
}
-// We roll our own string to float because the std library one uses locale and messes things up.
+/* We roll our own string to float because the std library one uses locale and messes things up. */
static double nsvg__atof(const char* s)
{
char* cur = (char*)s;
char* end = NULL;
double res = 0.0, sign = 1.0;
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
__int64 intPart = 0, fracPart = 0;
#else
long long intPart = 0, fracPart = 0;
#endif
char hasIntPart = 0, hasFracPart = 0;
- // Parse optional sign
+ /* Parse optional sign */
if (*cur == '+') {
cur++;
} else if (*cur == '-') {
@@ -1162,10 +1173,10 @@ static double nsvg__atof(const char* s)
cur++;
}
- // Parse integer part
+ /* Parse integer part */
if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-#if (_MSC_VER == 1200)
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
intPart = strtol(cur, &end, 10);
#else
intPart = strtoll(cur, &end, 10);
@@ -1177,12 +1188,12 @@ static double nsvg__atof(const char* s)
}
}
- // Parse fractional part.
+ /* Parse fractional part. */
if (*cur == '.') {
- cur++; // Skip '.'
+ cur++; /* Skip '.' */
if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-#if (_MSC_VER == 1200)
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
fracPart = strtol(cur, &end, 10);
#else
fracPart = strtoll(cur, &end, 10);
@@ -1195,15 +1206,15 @@ static double nsvg__atof(const char* s)
}
}
- // A valid number should have integer or fractional part.
+ /* A valid number should have integer or fractional part. */
if (!hasIntPart && !hasFracPart)
return 0.0;
- // Parse optional exponent
+ /* Parse optional exponent */
if (*cur == 'e' || *cur == 'E') {
int expPart = 0;
- cur++; // skip 'E'
- expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
+ cur++; /* skip 'E' */
+ expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */
if (cur != end) {
res *= pow(10.0, (double)expPart);
}
@@ -1218,27 +1229,27 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
const int last = size-1;
int i = 0;
- // sign
+ /* sign */
if (*s == '-' || *s == '+') {
if (i < last) it[i++] = *s;
s++;
}
- // integer part
+ /* integer part */
while (*s && nsvg__isdigit(*s)) {
if (i < last) it[i++] = *s;
s++;
}
if (*s == '.') {
- // decimal point
+ /* decimal point */
if (i < last) it[i++] = *s;
s++;
- // fraction part
+ /* fraction part */
while (*s && nsvg__isdigit(*s)) {
if (i < last) it[i++] = *s;
s++;
}
}
- // exponent
+ /* exponent */
if (*s == 'e' || *s == 'E') {
if (i < last) it[i++] = *s;
s++;
@@ -1259,13 +1270,13 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
static const char* nsvg__getNextPathItem(const char* s, char* it)
{
it[0] = '\0';
- // Skip white spaces and commas
+ /* Skip white spaces and commas */
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
if (!*s) return s;
if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) {
s = nsvg__parseNumber(s, it, 64);
} else {
- // Parse command
+ /* Parse command */
it[0] = *s++;
it[1] = '\0';
return s;
@@ -1278,8 +1289,8 @@ static unsigned int nsvg__parseColorHex(const char* str)
{
unsigned int c = 0, r = 0, g = 0, b = 0;
int n = 0;
- str++; // skip #
- // Calculate number of characters.
+ str++; /* skip # */
+ /* Calculate number of characters. */
while(str[n] && !nsvg__isspace(str[n]))
n++;
if (n == 6) {
@@ -1531,6 +1542,15 @@ static int nsvg__parseUnits(const char* units)
return NSVG_UNITS_USER;
}
+static int nsvg__isCoordinate(const char* s)
+{
+ /* optional sign */
+ if (*s == '-' || *s == '+')
+ s++;
+ /* must have at least one digit */
+ return nsvg__isdigit(*s);
+}
+
static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
{
NSVGcoordinate coord = {0, NSVG_UNITS_USER};
@@ -1670,25 +1690,32 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
+ int len;
nsvg__xformIdentity(xform);
while (*str)
{
if (strncmp(str, "matrix", 6) == 0)
- str += nsvg__parseMatrix(t, str);
+ len = nsvg__parseMatrix(t, str);
else if (strncmp(str, "translate", 9) == 0)
- str += nsvg__parseTranslate(t, str);
+ len = nsvg__parseTranslate(t, str);
else if (strncmp(str, "scale", 5) == 0)
- str += nsvg__parseScale(t, str);
+ len = nsvg__parseScale(t, str);
else if (strncmp(str, "rotate", 6) == 0)
- str += nsvg__parseRotate(t, str);
+ len = nsvg__parseRotate(t, str);
else if (strncmp(str, "skewX", 5) == 0)
- str += nsvg__parseSkewX(t, str);
+ len = nsvg__parseSkewX(t, str);
else if (strncmp(str, "skewY", 5) == 0)
- str += nsvg__parseSkewY(t, str);
+ len = nsvg__parseSkewY(t, str);
else{
++str;
continue;
}
+ if (len != 0) {
+ str += len;
+ } else {
+ ++str;
+ continue;
+ }
nsvg__xformPremultiply(xform, t);
}
@@ -1697,7 +1724,7 @@ static void nsvg__parseTransform(float* xform, const char* str)
static void nsvg__parseUrl(char* id, const char* str)
{
int i = 0;
- str += 4; // "url(";
+ str += 4; /* "url("; */
if (*str == '#')
str++;
while (i < 63 && *str != ')') {
@@ -1715,7 +1742,7 @@ static char nsvg__parseLineCap(const char* str)
return NSVG_CAP_ROUND;
else if (strcmp(str, "square") == 0)
return NSVG_CAP_SQUARE;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_CAP_BUTT;
}
@@ -1727,7 +1754,7 @@ static char nsvg__parseLineJoin(const char* str)
return NSVG_JOIN_ROUND;
else if (strcmp(str, "bevel") == 0)
return NSVG_JOIN_BEVEL;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_JOIN_MITER;
}
@@ -1737,7 +1764,7 @@ static char nsvg__parseFillRule(const char* str)
return NSVG_FILLRULE_NONZERO;
else if (strcmp(str, "evenodd") == 0)
return NSVG_FILLRULE_EVENODD;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_FILLRULE_NONZERO;
}
@@ -1745,9 +1772,9 @@ static const char* nsvg__getNextDashItem(const char* s, char* it)
{
int n = 0;
it[0] = '\0';
- // Skip white spaces and commas
+ /* Skip white spaces and commas */
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
- // Advance until whitespace, comma or end.
+ /* Advance until whitespace, comma or end. */
while (*s && (!nsvg__isspace(*s) && *s != ',')) {
if (n < 63)
it[n++] = *s;
@@ -1763,11 +1790,11 @@ static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* str
int count = 0, i;
float sum = 0.0f;
- // Handle "none"
+ /* Handle "none" */
if (str[0] == 'n')
return 0;
- // Parse dashes
+ /* Parse dashes */
while (*str) {
str = nsvg__getNextDashItem(str, item);
if (!*item) break;
@@ -1796,7 +1823,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
} else if (strcmp(name, "display") == 0) {
if (strcmp(value, "none") == 0)
attr->visible &= ~NSVG_VIS_DISPLAY;
- // Don't reset ->visible on display:inline, one display:none hides the whole subtree
+ /* Don't reset ->visible on display:inline, one display:none hides the whole subtree */
} else if (strcmp(name, "visibility") == 0) {
if (strcmp(value, "hidden") == 0) {
@@ -1888,7 +1915,7 @@ static int nsvg__parseNameValue(NSVGparser* p, const char* start, const char* en
val = str;
- // Right Trim
+ /* Right Trim */
while (str > start && (*str == ':' || nsvg__isspace(*str))) --str;
++str;
@@ -1913,13 +1940,13 @@ static void nsvg__parseStyle(NSVGparser* p, const char* str)
const char* end;
while (*str) {
- // Left Trim
+ /* Left Trim */
while(*str && nsvg__isspace(*str)) ++str;
start = str;
while(*str && *str != ';') ++str;
end = str;
- // Right Trim
+ /* Right Trim */
while (end > start && (*end == ';' || nsvg__isspace(*end))) --end;
++end;
@@ -1966,8 +1993,11 @@ static int nsvg__getArgsPerElement(char cmd)
case 'a':
case 'A':
return 7;
+ case 'z':
+ case 'Z':
+ return 0;
}
- return 0;
+ return -1;
}
static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
@@ -2091,7 +2121,7 @@ static void nsvg__pathQuadBezTo(NSVGparser* p, float* cpx, float* cpy,
y2 = args[3];
}
- // Convert to cubic bezier
+ /* Convert to cubic bezier */
cx1 = x1 + 2.0f/3.0f*(cx - x1);
cy1 = y1 + 2.0f/3.0f*(cy - y1);
cx2 = x2 + 2.0f/3.0f*(cx - x2);
@@ -2124,7 +2154,7 @@ static void nsvg__pathQuadBezShortTo(NSVGparser* p, float* cpx, float* cpy,
cx = 2*x1 - *cpx2;
cy = 2*y1 - *cpy2;
- // Convert to cubix bezier
+ /* Convert to cubix bezier */
cx1 = x1 + 2.0f/3.0f*(cx - x1);
cy1 = y1 + 2.0f/3.0f*(cy - y1);
cx2 = x2 + 2.0f/3.0f*(cx - x2);
@@ -2156,7 +2186,7 @@ static float nsvg__vecang(float ux, float uy, float vx, float vy)
static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
{
- // Ported from canvg (https://code.google.com/p/canvg/)
+ /* Ported from canvg (https://code.google.com/p/canvg/) */
float rx, ry, rotx;
float x1, y1, x2, y2, cx, cy, dx, dy, d;
float x1p, y1p, cxp, cyp, s, sa, sb;
@@ -2167,14 +2197,14 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
int i, ndivs;
float hda, kappa;
- rx = fabsf(args[0]); // y radius
- ry = fabsf(args[1]); // x radius
- rotx = args[2] / 180.0f * NSVG_PI; // x rotation angle
- fa = fabsf(args[3]) > 1e-6 ? 1 : 0; // Large arc
- fs = fabsf(args[4]) > 1e-6 ? 1 : 0; // Sweep direction
- x1 = *cpx; // start point
+ rx = fabsf(args[0]); /* y radius */
+ ry = fabsf(args[1]); /* x radius */
+ rotx = args[2] / 180.0f * NSVG_PI; /* x rotation angle */
+ fa = fabsf(args[3]) > 1e-6 ? 1 : 0; /* Large arc */
+ fs = fabsf(args[4]) > 1e-6 ? 1 : 0; /* Sweep direction */
+ x1 = *cpx; /* start point */
y1 = *cpy;
- if (rel) { // end point
+ if (rel) { /* end point */
x2 = *cpx + args[5];
y2 = *cpy + args[6];
} else {
@@ -2186,7 +2216,7 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
dy = y1 - y2;
d = sqrtf(dx*dx + dy*dy);
if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) {
- // The arc degenerates to a line
+ /* The arc degenerates to a line */
nsvg__lineTo(p, x2, y2);
*cpx = x2;
*cpy = y2;
@@ -2196,9 +2226,9 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
sinrx = sinf(rotx);
cosrx = cosf(rotx);
- // Convert to center point parameterization.
- // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
- // 1) Compute x1', y1'
+ /* Convert to center point parameterization. */
+ /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */
+ /* 1) Compute x1', y1' */
x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f;
y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f;
d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry);
@@ -2207,7 +2237,7 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
rx *= d;
ry *= d;
}
- // 2) Compute cx', cy'
+ /* 2) Compute cx', cy' */
s = 0.0f;
sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p);
sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p);
@@ -2219,33 +2249,33 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
cxp = s * rx * y1p / ry;
cyp = s * -ry * x1p / rx;
- // 3) Compute cx,cy from cx',cy'
+ /* 3) Compute cx,cy from cx',cy' */
cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp;
cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp;
- // 4) Calculate theta1, and delta theta.
+ /* 4) Calculate theta1, and delta theta. */
ux = (x1p - cxp) / rx;
uy = (y1p - cyp) / ry;
vx = (-x1p - cxp) / rx;
vy = (-y1p - cyp) / ry;
- a1 = nsvg__vecang(1.0f,0.0f, ux,uy); // Initial angle
- da = nsvg__vecang(ux,uy, vx,vy); // Delta angle
+ a1 = nsvg__vecang(1.0f,0.0f, ux,uy); /* Initial angle */
+ da = nsvg__vecang(ux,uy, vx,vy); /* Delta angle */
-// if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI;
-// if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0;
+/* if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; */
+/* if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; */
if (fs == 0 && da > 0)
da -= 2 * NSVG_PI;
else if (fs == 1 && da < 0)
da += 2 * NSVG_PI;
- // Approximate the arc using cubic spline segments.
+ /* Approximate the arc using cubic spline segments. */
t[0] = cosrx; t[1] = sinrx;
t[2] = -sinrx; t[3] = cosrx;
t[4] = cx; t[5] = cy;
- // Split arc into max 90 degree segments.
- // The loop assumes an iteration per end point (including start and end), this +1.
+ /* Split arc into max 90 degree segments. */
+ /* The loop assumes an iteration per end point (including start and end), this +1. */
ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f);
hda = (da / (float)ndivs) / 2.0f;
kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda));
@@ -2256,8 +2286,8 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
a = a1 + da * ((float)i/(float)ndivs);
dx = cosf(a);
dy = sinf(a);
- nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); // position
- nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); // tangent
+ nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); /* position */
+ nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); /* tangent */
if (i > 0)
nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y);
px = x;
@@ -2277,6 +2307,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
float args[10];
int nargs;
int rargs = 0;
+ char initPoint;
float cpx, cpy, cpx2, cpy2;
const char* tmp[4];
char closedFlag;
@@ -2299,13 +2330,14 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
nsvg__resetPath(p);
cpx = 0; cpy = 0;
cpx2 = 0; cpy2 = 0;
+ initPoint = 0;
closedFlag = 0;
nargs = 0;
while (*s) {
s = nsvg__getNextPathItem(s, item);
if (!*item) break;
- if (nsvg__isnum(item[0])) {
+ if (cmd != '\0' && nsvg__isCoordinate(item)) {
if (nargs < 10)
args[nargs++] = (float)nsvg__atof(item);
if (nargs >= rargs) {
@@ -2313,11 +2345,12 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
case 'm':
case 'M':
nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
- // Moveto can be followed by multiple coordinate pairs,
- // which should be treated as linetos.
+ /* Moveto can be followed by multiple coordinate pairs, */
+ /* which should be treated as linetos. */
cmd = (cmd == 'm') ? 'l' : 'L';
rargs = nsvg__getArgsPerElement(cmd);
cpx2 = cpx; cpy2 = cpy;
+ initPoint = 1;
break;
case 'l':
case 'L':
@@ -2367,34 +2400,43 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
}
} else {
cmd = item[0];
- rargs = nsvg__getArgsPerElement(cmd);
if (cmd == 'M' || cmd == 'm') {
- // Commit path.
+ /* Commit path. */
if (p->npts > 0)
nsvg__addPath(p, closedFlag);
- // Start new subpath.
+ /* Start new subpath. */
nsvg__resetPath(p);
closedFlag = 0;
nargs = 0;
- } else if (cmd == 'Z' || cmd == 'z') {
+ } else if (initPoint == 0) {
+ /* Do not allow other commands until initial point has been set (moveTo called once). */
+ cmd = '\0';
+ }
+ if (cmd == 'Z' || cmd == 'z') {
closedFlag = 1;
- // Commit path.
+ /* Commit path. */
if (p->npts > 0) {
- // Move current point to first point
+ /* Move current point to first point */
cpx = p->pts[0];
cpy = p->pts[1];
cpx2 = cpx; cpy2 = cpy;
nsvg__addPath(p, closedFlag);
}
- // Start new subpath.
+ /* Start new subpath. */
nsvg__resetPath(p);
nsvg__moveTo(p, cpx, cpy);
closedFlag = 0;
nargs = 0;
}
+ rargs = nsvg__getArgsPerElement(cmd);
+ if (rargs == -1) {
+ /* Command not recognized */
+ cmd = '\0';
+ rargs = 0;
+ }
}
}
- // Commit path.
+ /* Commit path. */
if (p->npts)
nsvg__addPath(p, closedFlag);
}
@@ -2408,7 +2450,7 @@ static void nsvg__parseRect(NSVGparser* p, const char** attr)
float y = 0.0f;
float w = 0.0f;
float h = 0.0f;
- float rx = -1.0f; // marks not set
+ float rx = -1.0f; /* marks not set */
float ry = -1.0f;
int i;
@@ -2439,7 +2481,7 @@ static void nsvg__parseRect(NSVGparser* p, const char** attr)
nsvg__lineTo(p, x+w, y+h);
nsvg__lineTo(p, x, y+h);
} else {
- // Rounded rectangle
+ /* Rounded rectangle */
nsvg__moveTo(p, x+rx, y);
nsvg__lineTo(p, x+w-rx, y);
nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry);
@@ -2596,24 +2638,24 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight);
} else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
if (strstr(attr[i + 1], "none") != 0) {
- // No uniform scaling
+ /* No uniform scaling */
p->alignType = NSVG_ALIGN_NONE;
} else {
- // Parse X align
+ /* Parse X align */
if (strstr(attr[i + 1], "xMin") != 0)
p->alignX = NSVG_ALIGN_MIN;
else if (strstr(attr[i + 1], "xMid") != 0)
p->alignX = NSVG_ALIGN_MID;
else if (strstr(attr[i + 1], "xMax") != 0)
p->alignX = NSVG_ALIGN_MAX;
- // Parse X align
+ /* Parse X align */
if (strstr(attr[i + 1], "yMin") != 0)
p->alignY = NSVG_ALIGN_MIN;
else if (strstr(attr[i + 1], "yMid") != 0)
p->alignY = NSVG_ALIGN_MID;
else if (strstr(attr[i + 1], "yMax") != 0)
p->alignY = NSVG_ALIGN_MAX;
- // Parse meet/slice
+ /* Parse meet/slice */
p->alignType = NSVG_ALIGN_MEET;
if (strstr(attr[i + 1], "slice") != 0)
p->alignType = NSVG_ALIGN_SLICE;
@@ -2708,7 +2750,7 @@ static void nsvg__parseGradientStop(NSVGparser* p, const char** attr)
nsvg__parseAttr(p, attr[i], attr[i + 1]);
}
- // Add stop to the last gradient.
+ /* Add stop to the last gradient. */
grad = p->gradients;
if (grad == NULL) return;
@@ -2716,7 +2758,7 @@ static void nsvg__parseGradientStop(NSVGparser* p, const char** attr)
grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops);
if (grad->stops == NULL) return;
- // Insert
+ /* Insert */
idx = grad->nstops-1;
for (i = 0; i < grad->nstops-1; i++) {
if (curAttr->stopOffset < grad->stops[i].offset) {
@@ -2740,7 +2782,7 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
NSVGparser* p = (NSVGparser*)ud;
if (p->defsFlag) {
- // Skip everything but gradients in defs
+ /* Skip everything but gradients in defs */
if (strcmp(el, "linearGradient") == 0) {
nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT);
} else if (strcmp(el, "radialGradient") == 0) {
@@ -2755,7 +2797,7 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
nsvg__pushAttr(p);
nsvg__parseAttribs(p, attr);
} else if (strcmp(el, "path") == 0) {
- if (p->pathFlag) // Do not allow nested paths.
+ if (p->pathFlag) /* Do not allow nested paths. */
return;
nsvg__pushAttr(p);
nsvg__parsePath(p, attr);
@@ -2908,7 +2950,7 @@ static float nsvg__viewAlign(float content, float container, int type)
return 0;
else if (type == NSVG_ALIGN_MAX)
return container - content;
- // mid
+ /* mid */
return (container - content) * 0.5f;
}
@@ -2930,7 +2972,7 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
int i;
float* pt;
- // Guess image size if not set completely.
+ /* Guess image size if not set completely. */
nsvg__imageBounds(p, bounds);
if (p->viewWidth == 0) {
@@ -2958,23 +3000,23 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
ty = -p->viewMiny;
sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0;
sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0;
- // Unit scaling
+ /* Unit scaling */
us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f);
- // Fix aspect ratio
+ /* Fix aspect ratio */
if (p->alignType == NSVG_ALIGN_MEET) {
- // fit whole image into viewbox
+ /* fit whole image into viewbox */
sx = sy = nsvg__minf(sx, sy);
tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
} else if (p->alignType == NSVG_ALIGN_SLICE) {
- // fill whole viewbox with image
+ /* fill whole viewbox with image */
sx = sy = nsvg__maxf(sx, sy);
tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
}
- // Transform
+ /* Transform */
sx *= us;
sy *= us;
avgs = (sx+sy) / 2.0f;
@@ -3027,7 +3069,7 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi)
nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p);
- // Scale to viewBox
+ /* Scale to viewBox */
nsvg__scaleToViewbox(p, units);
ret = p->image;
@@ -3054,7 +3096,7 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
data = (char*)NANOSVG_malloc(size+1);
if (data == NULL) goto error;
if (fread(data, 1, size, fp) != size) goto error;
- data[size] = '\0'; // Must be null terminated.
+ data[size] = '\0'; /* Must be null terminated. */
fclose(fp);
image = nsvgParse(data, units, dpi);
NANOSVG_free(data);
diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h
index 2720ce5..b288bcf 100644
--- a/generic/nanosvgrast.h
+++ b/generic/nanosvgrast.h
@@ -59,23 +59,24 @@ typedef struct NSVGrasterizer NSVGrasterizer;
nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
*/
-// Allocated rasterizer context.
+/* Allocated rasterizer context. */
NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void);
-// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
-// r - pointer to rasterizer context
-// image - pointer to image to rasterize
-// tx,ty - image offset (applied after scaling)
-// scale - image scale
-// dst - pointer to destination image data, 4 bytes per pixel (RGBA)
-// w - width of the image to render
-// h - height of the image to render
-// stride - number of bytes per scaleline in the destination buffer
+/* Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
+ * r - pointer to rasterizer context
+ * image - pointer to image to rasterize
+ * tx,ty - image offset (applied after scaling)
+ * scale - image scale
+ * dst - pointer to destination image data, 4 bytes per pixel (RGBA)
+ * w - width of the image to render
+ * h - height of the image to render
+ * stride - number of bytes per scaleline in the destination buffer
NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r,
NSVGimage* image, float tx, float ty, float scale,
unsigned char* dst, int w, int h, int stride);
+ */
-// Deletes rasterizer context.
+/* Deletes rasterizer context. */
NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*);
@@ -83,7 +84,7 @@ NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*);
}
#endif
-#endif // NANOSVGRAST_H
+#endif /* NANOSVGRAST_H */
#ifdef NANOSVGRAST_IMPLEMENTATION
@@ -202,17 +203,17 @@ static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur)
{
NSVGmemPage *newp;
- // If using existing chain, return the next page in chain
+ /* If using existing chain, return the next page in chain */
if (cur != NULL && cur->next != NULL) {
return cur->next;
}
- // Alloc new page
+ /* Alloc new page */
newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage));
if (newp == NULL) return NULL;
memset(newp, 0, sizeof(NSVGmemPage));
- // Add to linked list
+ /* Add to linked list */
if (cur != NULL)
cur->next = newp;
else
@@ -302,7 +303,7 @@ static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float
{
NSVGedge* e;
- // Skip horizontal edges
+ /* Skip horizontal edges */
if (y0 == y1)
return;
@@ -388,15 +389,15 @@ static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
for (path = shape->paths; path != NULL; path = path->next) {
r->npoints = 0;
- // Flatten path
+ /* Flatten path */
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
for (i = 0; i < path->npts-1; i += 3) {
float* p = &path->pts[i*2];
nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0);
}
- // Close path
+ /* Close path */
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
- // Build edges
+ /* Build edges */
for (i = 0, j = r->npoints-1; i < r->npoints; j = i++)
nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y);
}
@@ -619,20 +620,20 @@ static int nsvg__curveDivs(float r, float arc, float tol)
static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth)
{
- int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); // Calculate divisions per half circle.
+ int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); /* Calculate divisions per half circle. */
NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0};
NSVGpoint* p0, *p1;
int j, s, e;
- // Build stroke edges
+ /* Build stroke edges */
if (closed) {
- // Looping
+ /* Looping */
p0 = &points[npoints-1];
p1 = &points[0];
s = 0;
e = npoints;
} else {
- // Add cap
+ /* Add cap */
p0 = &points[0];
p1 = &points[1];
s = 1;
@@ -644,7 +645,7 @@ static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints
firstLeft = left;
firstRight = right;
} else {
- // Add cap
+ /* Add cap */
float dx = p1->x - p0->x;
float dy = p1->y - p0->y;
nsvg__normalize(&dx, &dy);
@@ -671,11 +672,11 @@ static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints
}
if (closed) {
- // Loop it
+ /* Loop it */
nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y);
nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y);
} else {
- // Add cap
+ /* Add cap */
float dx = p1->x - p0->x;
float dy = p1->y - p0->y;
nsvg__normalize(&dx, &dy);
@@ -696,15 +697,15 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
for (i = 0; i < r->npoints; i++) {
- // Calculate segment direction and length
+ /* Calculate segment direction and length */
p0->dx = p1->x - p0->x;
p0->dy = p1->y - p0->y;
p0->len = nsvg__normalize(&p0->dx, &p0->dy);
- // Advance
+ /* Advance */
p0 = p1++;
}
- // calculate joins
+ /* calculate joins */
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
for (j = 0; j < r->npoints; j++) {
@@ -713,7 +714,7 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
dly0 = -p0->dx;
dlx1 = p1->dy;
dly1 = -p1->dx;
- // Calculate extrusions
+ /* Calculate extrusions */
p1->dmx = (dlx0 + dlx1) * 0.5f;
p1->dmy = (dly0 + dly1) * 0.5f;
dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy;
@@ -726,15 +727,15 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
p1->dmy *= s2;
}
- // Clear flags, but keep the corner.
+ /* Clear flags, but keep the corner. */
p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0;
- // Keep track of left turns.
+ /* Keep track of left turns. */
cross = p1->dx * p0->dy - p0->dx * p1->dy;
if (cross > 0.0f)
p1->flags |= NSVG_PT_LEFT;
- // Check to see if the corner needs to be beveled.
+ /* Check to see if the corner needs to be beveled. */
if (p1->flags & NSVG_PT_CORNER) {
if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) {
p1->flags |= NSVG_PT_BEVEL;
@@ -756,7 +757,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
float lineWidth = shape->strokeWidth * scale;
for (path = shape->paths; path != NULL; path = path->next) {
- // Flatten path
+ /* Flatten path */
r->npoints = 0;
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER);
for (i = 0; i < path->npts-1; i += 3) {
@@ -768,7 +769,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
closed = path->closed;
- // If the first and last points are the same, remove the last, mark as closed path.
+ /* If the first and last points are the same, remove the last, mark as closed path. */
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) {
@@ -785,20 +786,20 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
if (closed)
nsvg__appendPathPoint(r, r->points[0]);
- // Duplicate points -> points2.
+ /* Duplicate points -> points2. */
nsvg__duplicatePoints(r);
r->npoints = 0;
cur = r->points2[0];
nsvg__appendPathPoint(r, cur);
- // Figure out dash offset.
+ /* Figure out dash offset. */
allDashLen = 0;
for (j = 0; j < shape->strokeDashCount; j++)
allDashLen += shape->strokeDashArray[j];
if (shape->strokeDashCount & 1)
allDashLen *= 2.0f;
- // Find location inside pattern
+ /* Find location inside pattern */
dashOffset = fmodf(shape->strokeDashOffset, allDashLen);
if (dashOffset < 0.0f)
dashOffset += allDashLen;
@@ -815,22 +816,22 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
float dist = sqrtf(dx*dx + dy*dy);
if ((totalDist + dist) > dashLen) {
- // Calculate intermediate point
+ /* Calculate intermediate point */
float d = (dashLen - totalDist) / dist;
float x = cur.x + dx * d;
float y = cur.y + dy * d;
nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER);
- // Stroke
+ /* Stroke */
if (r->npoints > 1 && dashState) {
nsvg__prepareStroke(r, miterLimit, lineJoin);
nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
}
- // Advance dash pattern
+ /* Advance dash pattern */
dashState = !dashState;
idash = (idash+1) % shape->strokeDashCount;
dashLen = shape->strokeDashArray[idash] * scale;
- // Restart
+ /* Restart */
cur.x = x;
cur.y = y;
cur.flags = NSVG_PT_CORNER;
@@ -844,7 +845,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
j++;
}
}
- // Stroke any leftover path
+ /* Stroke any leftover path */
if (r->npoints > 1 && dashState)
nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
} else {
@@ -871,24 +872,24 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
float dxdy;
if (r->freelist != NULL) {
- // Restore from freelist.
+ /* Restore from freelist. */
z = r->freelist;
r->freelist = z->next;
} else {
- // Alloc new edge.
+ /* Alloc new edge. */
z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge));
if (z == NULL) return NULL;
}
dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
-// STBTT_assert(e->y0 <= start_point);
- // round dx down to avoid going too far
+/* STBTT_assert(e->y0 <= start_point); */
+ /* round dx down to avoid going too far */
if (dxdy < 0)
z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
else
z->dx = (int)floorf(NSVG__FIX * dxdy);
z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
-// z->x -= off_x * FIX;
+/* z->x -= off_x * FIX; */
z->ey = e->y1;
z->next = 0;
z->dir = e->dir;
@@ -910,52 +911,53 @@ static void nsvg__fillScanline(unsigned char* scanline, int len, int x0, int x1,
if (j > *xmax) *xmax = j;
if (i < len && j >= 0) {
if (i == j) {
- // x0,x1 are the same pixel, so compute combined coverage
+ /* x0,x1 are the same pixel, so compute combined coverage */
scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT));
} else {
- if (i >= 0) // add antialiasing for x0
+ if (i >= 0) /* add antialiasing for x0 */
scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT));
else
- i = -1; // clip
+ i = -1; /* clip */
- if (j < len) // add antialiasing for x1
+ if (j < len) /* add antialiasing for x1 */
scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT));
else
- j = len; // clip
+ j = len; /* clip */
- for (++i; i < j; ++i) // fill pixels between x0 and x1
+ for (++i; i < j; ++i) /* fill pixels between x0 and x1 */
scanline[i] = (unsigned char)(scanline[i] + maxWeight);
}
}
}
-// note: this routine clips fills that extend off the edges... ideally this
-// wouldn't happen, but it could happen if the truetype glyph bounding boxes
-// are wrong, or if the user supplies a too-small bitmap
+/* note: this routine clips fills that extend off the edges... ideally this
+ * wouldn't happen, but it could happen if the truetype glyph bounding boxes
+ * are wrong, or if the user supplies a too-small bitmap
+ */
static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule)
{
- // non-zero winding fill
+ /* non-zero winding fill */
int x0 = 0, w = 0;
if (fillRule == NSVG_FILLRULE_NONZERO) {
- // Non-zero
+ /* Non-zero */
while (e != NULL) {
if (w == 0) {
- // if we're currently at zero, we need to record the edge start point
+ /* if we're currently at zero, we need to record the edge start point */
x0 = e->x; w += e->dir;
} else {
int x1 = e->x; w += e->dir;
- // if we went to zero, we need to draw
+ /* if we went to zero, we need to draw */
if (w == 0)
nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax);
}
e = e->next;
}
} else if (fillRule == NSVG_FILLRULE_EVENODD) {
- // Even-odd
+ /* Even-odd */
while (e != NULL) {
if (w == 0) {
- // if we're currently at zero, we need to record the edge start point
+ /* if we're currently at zero, we need to record the edge start point */
x0 = e->x; w = 1;
} else {
int x1 = e->x; w = 0;
@@ -1013,12 +1015,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
int r,g,b;
int a = nsvg__div255((int)cover[0] * ca);
int ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1033,8 +1035,8 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
dst += 4;
}
} else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) {
- // TODO: spread modes.
- // TODO: plenty of opportunities to optimize.
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
float fx, fy, dx, gy;
float* t = cache->xform;
int i, cr, cg, cb, ca;
@@ -1056,12 +1058,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
a = nsvg__div255((int)cover[0] * ca);
ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1077,9 +1079,9 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
fx += dx;
}
} else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) {
- // TODO: spread modes.
- // TODO: plenty of opportunities to optimize.
- // TODO: focus (fx,fy)
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
+ /* TODO: focus (fx,fy) */
float fx, fy, dx, gx, gy, gd;
float* t = cache->xform;
int i, cr, cg, cb, ca;
@@ -1103,12 +1105,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
a = nsvg__div255((int)cover[0] * ca);
ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1131,7 +1133,7 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
NSVGactiveEdge *active = NULL;
int y, s;
int e = 0;
- int maxWeight = (255 / NSVG__SUBSAMPLES); // weight per vertical scanline
+ int maxWeight = (255 / NSVG__SUBSAMPLES); /* weight per vertical scanline */
int xmin, xmax;
for (y = 0; y < r->height; y++) {
@@ -1139,25 +1141,25 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
xmin = r->width;
xmax = 0;
for (s = 0; s < NSVG__SUBSAMPLES; ++s) {
- // find center of pixel for this scanline
+ /* find center of pixel for this scanline */
float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f;
NSVGactiveEdge **step = &active;
- // update all active edges;
- // remove all active edges that terminate before the center of this scanline
+ /* update all active edges; */
+ /* remove all active edges that terminate before the center of this scanline */
while (*step) {
NSVGactiveEdge *z = *step;
if (z->ey <= scany) {
- *step = z->next; // delete from list
-// NSVG__assert(z->valid);
+ *step = z->next; /* delete from list */
+/* NSVG__assert(z->valid); */
nsvg__freeActive(r, z);
} else {
- z->x += z->dx; // advance to position for current scanline
- step = &((*step)->next); // advance through list
+ z->x += z->dx; /* advance to position for current scanline */
+ step = &((*step)->next); /* advance through list */
}
}
- // resort the list if needed
+ /* resort the list if needed */
for (;;) {
int changed = 0;
step = &active;
@@ -1175,24 +1177,24 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
if (!changed) break;
}
- // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline
+ /* insert all edges that start before the center of this scanline -- omit ones that also end on this scanline */
while (e < r->nedges && r->edges[e].y0 <= scany) {
if (r->edges[e].y1 > scany) {
NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany);
if (z == NULL) break;
- // find insertion point
+ /* find insertion point */
if (active == NULL) {
active = z;
} else if (z->x < active->x) {
- // insert at front
+ /* insert at front */
z->next = active;
active = z;
} else {
- // find thing to insert AFTER
+ /* find thing to insert AFTER */
NSVGactiveEdge* p = active;
while (p->next && p->next->x < z->x)
p = p->next;
- // at this point, p->next->x is NOT < z->x
+ /* at this point, p->next->x is NOT < z->x */
z->next = p->next;
p->next = z;
}
@@ -1200,11 +1202,11 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
e++;
}
- // now process all active edges in non-zero fashion
+ /* now process all active edges in non-zero fashion */
if (active != NULL)
nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule);
}
- // Blit
+ /* Blit */
if (xmin < 0) xmin = 0;
if (xmax > r->width-1) xmax = r->width-1;
if (xmin <= xmax) {
@@ -1218,7 +1220,7 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int str
{
int x,y;
- // Unpremultiply
+ /* Unpremultiply */
for (y = 0; y < h; y++) {
unsigned char *row = &image[y*stride];
for (x = 0; x < w; x++) {
@@ -1232,7 +1234,7 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int str
}
}
- // Defringe
+ /* Defringe */
for (y = 0; y < h; y++) {
unsigned char *row = &image[y*stride];
for (x = 0; x < w; x++) {
@@ -1411,7 +1413,7 @@ void nsvgRasterize(NSVGrasterizer* r,
nsvg__flattenShape(r, shape, scale);
- // Scale and translate edges
+ /* Scale and translate edges */
for (i = 0; i < r->nedges; i++) {
e = &r->edges[i];
e->x0 = tx + e->x0;
@@ -1420,10 +1422,10 @@ void nsvgRasterize(NSVGrasterizer* r,
e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
}
- // Rasterize edges
+ /* Rasterize edges */
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
- // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->fill, shape->opacity);
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule);
@@ -1435,9 +1437,9 @@ void nsvgRasterize(NSVGrasterizer* r,
nsvg__flattenShapeStroke(r, shape, scale);
-// dumpEdges(r, "edge.svg");
+/* dumpEdges(r, "edge.svg"); */
- // Scale and translate edges
+ /* Scale and translate edges */
for (i = 0; i < r->nedges; i++) {
e = &r->edges[i];
e->x0 = tx + e->x0;
@@ -1446,10 +1448,10 @@ void nsvgRasterize(NSVGrasterizer* r,
e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
}
- // Rasterize edges
+ /* Rasterize edges */
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
- // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO);
diff --git a/generic/tk.decls b/generic/tk.decls
index a77720f..4a4f01d 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -403,7 +403,7 @@ declare 97 {
Tk_ImageChangedProc *changeProc, ClientData clientData)
}
declare 98 {
- ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+ ClientData Tk_GetImageModelData(Tcl_Interp *interp,
const char *name, const Tk_ImageType **typePtrPtr)
}
declare 99 {
@@ -472,7 +472,7 @@ declare 116 {
Tk_Window Tk_IdToWindow(Display *display, Window window)
}
declare 117 {
- void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+ void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth, int imageHeight)
}
declare 118 {
@@ -486,8 +486,8 @@ declare 120 {
int width, int height)
}
declare 121 {
- void Tk_MaintainGeometry(Tk_Window slave,
- Tk_Window master, int x, int y, int width, int height)
+ void Tk_MaintainGeometry(Tk_Window window,
+ Tk_Window container, int x, int y, int width, int height)
}
declare 122 {
Tk_Window Tk_MainWindow(Tcl_Interp *interp)
@@ -539,7 +539,7 @@ declare 136 {
const char *Tk_NameOfFont(Tk_Font font)
}
declare 137 {
- const char *Tk_NameOfImage(Tk_ImageMaster imageMaster)
+ const char *Tk_NameOfImage(Tk_ImageModel model)
}
declare 138 {
const char *Tk_NameOfJoinStyle(int join)
@@ -692,7 +692,7 @@ declare 180 {
void Tk_Ungrab(Tk_Window tkwin)
}
declare 181 {
- void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master)
+ void Tk_UnmaintainGeometry(Tk_Window window, Tk_Window container)
}
declare 182 {
void Tk_UnmapWindow(Tk_Window tkwin)
@@ -1069,6 +1069,28 @@ declare 273 {
void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
}
+# TIP#580
+declare 274 {
+ int Tk_AlwaysShowSelection(Tk_Window tkwin)
+}
+declare 275 {
+ unsigned Tk_GetButtonMask(unsigned button)
+}
+declare 276 {
+ int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, double *doublePtr)
+}
+declare 277 {
+ Tcl_Obj *Tk_NewWindowObj(Tk_Window tkwin)
+}
+declare 278 {
+ void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName,
+ Tcl_Obj *detail)
+}
+declare 279 {
+ Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont)
+}
+
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
@@ -1099,37 +1121,24 @@ declare 5 win {
################################
# Aqua specific functions
-
-declare 0 aqua {
- void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
-}
-declare 1 aqua {
- void Tk_MacOSXTurnOffMenus(void)
-}
-declare 2 aqua {
- void Tk_MacOSXTkOwnsCursor(int tkOwnsIt)
-}
-declare 3 aqua {
- void TkMacOSXInitMenus(Tcl_Interp *interp)
-}
+# Stub removed because the function no longer exists.
+#declare 3 aqua {
+# void TkMacOSXInitMenus(Tcl_Interp *interp)
+#}
declare 4 aqua {
void TkMacOSXInitAppleEvents(Tcl_Interp *interp)
}
declare 5 aqua {
- void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
declare 6 aqua {
void TkMacOSXInvalClipRgns(Tk_Window tkwin)
}
-declare 7 aqua {
- void *TkMacOSXGetDrawablePort(Drawable drawable)
-}
+# Stub removed because it just returned NULL.
+#declare 7 aqua {
+# void *TkMacOSXGetDrawablePort(Drawable drawable)
+#}
declare 8 aqua {
void *TkMacOSXGetRootControl(Drawable drawable)
}
@@ -1140,27 +1149,17 @@ declare 10 aqua {
int Tk_MacOSXIsAppInFront(void)
}
declare 11 aqua {
- void Tk_MacOSXSetEmbedHandler_(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
+ Tk_Window Tk_MacOSXGetTkWindow(void *w)
}
declare 12 aqua {
- void Tk_MacOSXTurnOffMenus_(void)
+ void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable)
}
+# Replaces TkMacOSXDrawable
declare 13 aqua {
- void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt)
-}
-declare 14 aqua {
- void TkMacOSXInitMenus_(Tcl_Interp *interp)
-}
-declare 15 aqua {
- void TkMacOSXInitAppleEvents_(Tcl_Interp *interp)
+ void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable)
}
declare 16 aqua {
- void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
diff --git a/generic/tk.h b/generic/tk.h
index 5efd2cb..0c7c69f 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -122,13 +122,14 @@ extern "C" {
* Dummy types that are used by clients:
*/
+#define Tk_ImageMaster Tk_ImageModel
typedef struct Tk_BindingTable_ *Tk_BindingTable;
typedef struct Tk_Canvas_ *Tk_Canvas;
typedef struct Tk_Cursor_ *Tk_Cursor;
typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler;
typedef struct Tk_Font_ *Tk_Font;
typedef struct Tk_Image__ *Tk_Image;
-typedef struct Tk_ImageMaster_ *Tk_ImageMaster;
+typedef struct Tk_ImageModel_ *Tk_ImageModel;
typedef struct Tk_OptionTable_ *Tk_OptionTable;
typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo;
typedef struct Tk_TextLayout_ *Tk_TextLayout;
@@ -650,21 +651,22 @@ typedef struct Tk_ClassProcs {
* the geometry manager to carry out certain functions.
*/
+#define Tk_GeomLostSlaveProc Tk_GeomLostContentProc
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
-typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin);
+typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin);
typedef struct Tk_GeomMgr {
const char *name; /* Name of the geometry manager (command used
* to invoke it, or name of widget class that
* allows embedded widgets). */
Tk_GeomRequestProc *requestProc;
- /* Procedure to invoke when a slave's
+ /* Procedure to invoke when a content's
* requested geometry changes. */
- Tk_GeomLostSlaveProc *lostSlaveProc;
- /* Procedure to invoke when a slave is taken
+ Tk_GeomLostContentProc *lostContentProc;
+ /* Procedure to invoke when content is taken
* away from one geometry manager by another.
* NULL means geometry manager doesn't care
- * when slaves are lost. */
+ * when content lost. */
} Tk_GeomMgr;
/*
@@ -1047,13 +1049,17 @@ typedef struct Tk_Item {
* lines, circles, etc.) that can form part of a canvas widget.
*/
-#ifdef USE_OLD_CANVAS
+#if defined(USE_OLD_CANVAS) && TCL_MAJOR_VERSION < 9
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv);
typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv, int flags);
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, char **argv);
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ int beforeThis, char *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, char *indexString, int *indexPtr);
#else
typedef int (Tk_ItemCreateProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, Tcl_Obj *const objv[]);
@@ -1062,6 +1068,17 @@ typedef int (Tk_ItemConfigureProc)(Tcl_Interp *interp, Tk_Canvas canvas,
int flags);
typedef int (Tk_ItemCoordProc)(Tcl_Interp *interp, Tk_Canvas canvas,
Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]);
+#if TCL_MAJOR_VERSION > 8
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t beforeThis, Tcl_Obj *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, Tcl_Obj *indexString, size_t *indexPtr);
+#else
+typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ int beforeThis, Tcl_Obj *string);
+typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
+ Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
+#endif
#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemDeleteProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
Display *display);
@@ -1081,39 +1098,21 @@ typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double scaleY);
typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
double deltaX, double deltaY);
-#ifdef USE_OLD_CANVAS
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, char *indexString, int *indexPtr);
-#elif TCL_MAJOR_VERSION > 8
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, Tcl_Obj *indexString, size_t *indexPtr);
-#else
-typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas,
- Tk_Item *itemPtr, Tcl_Obj *indexString, int *indexPtr);
-#endif /* USE_OLD_CANVAS */
#if TCL_MAJOR_VERSION > 8
typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
size_t index);
typedef size_t (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
size_t offset, char *buffer, size_t maxBytes);
+typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
+ size_t first, size_t last);
#else
typedef void (Tk_ItemCursorProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int index);
typedef int (Tk_ItemSelectionProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int offset, char *buffer, int maxBytes);
-#endif
-#ifdef USE_OLD_CANVAS
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int beforeThis, char *string);
-#elif TCL_MAJOR_VERSION > 8
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- size_t beforeThis, Tcl_Obj *string);
-#else
-typedef void (Tk_ItemInsertProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
- int beforeThis, Tcl_Obj *string);
-#endif /* USE_OLD_CANVAS */
typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr,
int first, int last);
+#endif
#ifndef __NO_OLD_CONFIG
@@ -1304,21 +1303,21 @@ typedef struct Tk_Outline {
*/
typedef struct Tk_ImageType Tk_ImageType;
-#ifdef USE_OLD_IMAGE
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && defined(USE_OLD_IMAGE)
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc,
- char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *masterDataPtr);
+ char **argv, Tk_ImageType *typePtr, Tk_ImageModel model,
+ ClientData *clientDataPtr);
#else
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, int objc,
- Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *masterDataPtr);
+ Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model,
+ ClientData *clientDataPtr);
#endif /* USE_OLD_IMAGE */
-typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData);
-typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display,
+typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData);
+typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display,
Drawable drawable, int imageX, int imageY, int width, int height,
int drawableX, int drawableY);
-typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display);
-typedef void (Tk_ImageDeleteProc) (ClientData masterData);
+typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display);
+typedef void (Tk_ImageDeleteProc) (ClientData clientData);
typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y,
int width, int height, int imageWidth, int imageHeight);
typedef int (Tk_ImagePostscriptProc) (ClientData clientData,
diff --git a/generic/tkBind.c b/generic/tkBind.c
index e8827b3..3416f52 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -59,7 +59,9 @@
/*
* In old implementation (the one that used an event ring), <Double-1> and <1><1> were
- * equivalent sequences. However it is logical to give <Double-1> higher precedence.
+ * equivalent sequences. However it is logical to give <Double-1> higher precedence
+ * since it is more specific. Indeed <Double-1> includes time and space requirements,
+ * which is not the case for <1><1>.
* This is achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1.
*/
@@ -135,17 +137,10 @@ typedef struct {
* this count considers the detail (keySym or button). */
} Event;
-/*
- * We need a structure providing a list of pattern sequences.
- */
-
-typedef unsigned EventMask;
-typedef unsigned long ModMask;
-
struct PatSeq; /* forward declaration */
/* We need this array for bookkeeping the last matching modifier mask per pattern. */
-TK_ARRAY_DEFINE(PSModMaskArr, ModMask);
+TK_ARRAY_DEFINE(PSModMaskArr, unsigned);
typedef struct PSEntry {
TK_DLIST_LINKS(PSEntry); /* Makes this struct a double linked list; must be first entry. */
@@ -201,7 +196,7 @@ typedef struct Tk_BindingTable_ {
/* Containing the most recent event for every event type. */
PromArr *promArr; /* Contains the promoted pattern sequences. */
Event *curEvent; /* Pointing to most recent event. */
- ModMask curModMask; /* Containing the current modifier mask. */
+ unsigned curModMask; /* Containing the current modifier mask. */
LookupTables lookupTables; /* Containing hash tables for fast lookup. */
Tcl_HashTable objectTable; /* Used to map from an object to a list of patterns associated with
* that object. Keys are ClientData, values are (PatSeq *). */
@@ -263,7 +258,7 @@ typedef struct {
typedef struct {
unsigned eventType; /* Type of X event, e.g. ButtonPress. */
unsigned count; /* Multi-event count, e.g. double-clicks, triple-clicks, etc. */
- ModMask modMask; /* Mask of modifiers that must be present (zero means no modifiers
+ unsigned modMask; /* Mask of modifiers that must be present (zero means no modifiers
* are required). */
Info info; /* Additional information that must match event. Normally this is zero,
* meaning no additional information must match. For KeyPress and
@@ -414,7 +409,7 @@ static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */
typedef struct {
const char *name; /* Name of modifier. */
- ModMask mask; /* Button/modifier mask value, such as Button1Mask. */
+ unsigned mask; /* Button/modifier mask value, such as Button1Mask. */
unsigned flags; /* Various flags; see below for definitions. */
} ModInfo;
@@ -460,10 +455,20 @@ static const ModInfo modArray[] = {
{"Button9", Button9Mask, 0},
{"Mod1", Mod1Mask, 0},
{"M1", Mod1Mask, 0},
+#ifdef MAC_OSX_TK
{"Command", Mod1Mask, 0},
+#elif defined (_WIN32)
+ {"Command", ControlMask, 0},
+#else
+ {"Command", META_MASK, 0},
+#endif
{"Mod2", Mod2Mask, 0},
{"M2", Mod2Mask, 0},
+#ifdef MAC_OSX_TK
{"Option", Mod2Mask, 0},
+#else
+ {"Option", ALT_MASK, 0},
+#endif
{"Mod3", Mod3Mask, 0},
{"M3", Mod3Mask, 0},
{"Mod4", Mod4Mask, 0},
@@ -719,7 +724,7 @@ static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPt
unsigned scriptCount, Tcl_DString *dsPtr);
static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables,
ClientData object, const char *eventString, int create,
- int allowVirtual, EventMask *maskPtr);
+ int allowVirtual, unsigned *maskPtr);
static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr);
static const char * GetField(const char *p, char *copy, unsigned size);
static Tcl_Obj * GetPatternObj(const PatSeq *psPtr);
@@ -735,8 +740,7 @@ static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSLi
static int NameToWindow(Tcl_Interp *interp, Tk_Window main,
Tcl_Obj *objPtr, Tk_Window *tkwinPtr);
static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr,
- TkPattern *patPtr, EventMask *eventMaskPtr);
-static void DoWarp(ClientData clientData);
+ TkPattern *patPtr, unsigned *eventMaskPtr);
static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr,
Tcl_Obj *object, int onlyConsiderDetailedEvents);
static void ClearLookupTable(LookupTables *lookupTables, ClientData object);
@@ -767,8 +771,8 @@ static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_
static int
IsSubsetOf(
- ModMask lhsMask, /* this is a subset */
- ModMask rhsMask) /* of this bit field? */
+ unsigned lhsMask, /* this is a subset */
+ unsigned rhsMask) /* of this bit field? */
{
return (lhsMask & rhsMask) == lhsMask;
}
@@ -798,8 +802,10 @@ static unsigned
GetButtonNumber(
const char *field)
{
+ unsigned button;
assert(field);
- return (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0;
+ button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0;
+ return (button > 3) ? (button + 4) : button;
}
static Time
@@ -854,6 +860,20 @@ CountSpecialized(
return sndCount - fstCount;
}
+int
+IsKeyEventType(
+ unsigned eventType)
+{
+ return eventType == KeyPress || eventType == KeyRelease;
+}
+
+int
+IsButtonEventType(
+ unsigned eventType)
+{
+ return eventType == ButtonPress || eventType == ButtonRelease;
+}
+
static int
MatchEventNearby(
const XEvent *lhs, /* previous button event */
@@ -861,7 +881,7 @@ MatchEventNearby(
{
assert(lhs);
assert(rhs);
- assert(lhs->type == ButtonPress || lhs->type == ButtonRelease);
+ assert(IsButtonEventType(lhs->type));
assert(lhs->type == rhs->type);
/* assert: lhs->xbutton.time <= rhs->xbutton.time */
@@ -873,16 +893,16 @@ MatchEventNearby(
static int
MatchEventRepeat(
- const XEvent *lhs, /* previous key event */
- const XEvent *rhs) /* current key event */
+ const XKeyEvent *lhs, /* previous key event */
+ const XKeyEvent *rhs) /* current key event */
{
assert(lhs);
assert(rhs);
- assert(lhs->type == KeyPress || lhs->type == KeyRelease);
+ assert(IsKeyEventType(lhs->type));
assert(lhs->type == rhs->type);
- /* assert: lhs->xkey.time <= rhs->xkey.time */
- return TestNearbyTime(rhs->xkey.time, lhs->xkey.time);
+ /* assert: lhs->time <= rhs->time */
+ return lhs->keycode == rhs->keycode && TestNearbyTime(lhs->time, rhs->time);
}
static void
@@ -941,11 +961,10 @@ ClearList(
static PSEntry *
FreePatSeqEntry(
- PSList *pool,
+ TCL_UNUSED(PSList *),
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
- (void)pool;
PSModMaskArr_Free(&entry->lastModMaskArr);
ckfree(entry);
@@ -961,13 +980,13 @@ ResolveModifiers(
if (dispPtr->metaModMask) {
if (modMask & META_MASK) {
- modMask &= ~(ModMask)META_MASK;
+ modMask &= ~META_MASK;
modMask |= dispPtr->metaModMask;
}
}
if (dispPtr->altModMask) {
if (modMask & ALT_MASK) {
- modMask &= ~(ModMask)ALT_MASK;
+ modMask &= ~ALT_MASK;
modMask |= dispPtr->altModMask;
}
}
@@ -977,7 +996,7 @@ ResolveModifiers(
static int
ButtonNumberFromState(
- ModMask state)
+ unsigned state)
{
if (!(state & ALL_BUTTONS)) { return 0; }
if (state & Button1Mask) { return 1; }
@@ -1632,7 +1651,7 @@ Tk_CreateBinding(
* existing binding will always be replaced. */
{
PatSeq *psPtr;
- EventMask eventMask;
+ unsigned eventMask;
char *oldStr;
char *newStr;
@@ -2157,7 +2176,7 @@ Tk_BindEvent(
TkDisplay *dispPtr;
TkDisplay *oldDispPtr;
Event *curEvent;
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
BindInfo *bindInfoPtr;
Tcl_InterpState interpState;
LookupTables *physTables;
@@ -2213,7 +2232,7 @@ Tk_BindEvent(
* Ignore the event completely if it is an Enter, Leave, FocusIn, or
* FocusOut event with detail NotifyInferior. The reason for ignoring
* these events is that we don't want transitions between a window and its
- * children to visible to bindings on the parent: this would cause
+ * children to be visible to bindings on the parent: this would cause
* problems for mega-widgets, since the internal structure of a
* mega-widget isn't supposed to be visible to people watching the parent.
*
@@ -2297,7 +2316,7 @@ Tk_BindEvent(
switch (eventPtr->type) {
case KeyPress:
case KeyRelease:
- if (MatchEventRepeat(&curEvent->xev, eventPtr)) {
+ if (MatchEventRepeat(&curEvent->xev.xkey, &eventPtr->xkey)) {
if (curEvent->xev.xkey.keycode == eventPtr->xkey.keycode) {
++curEvent->countDetailed;
} else {
@@ -2447,7 +2466,6 @@ Tk_BindEvent(
LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables;
PatSeq *matchPtr = matchPtrArr[k];
PatSeq *mPtr;
- PSList *psl[2];
/*
* Note that virtual events cannot promote.
@@ -2521,13 +2539,13 @@ Tk_BindEvent(
switch (patPtr->eventType) {
case ButtonPress:
case ButtonRelease:
- if (curEvent->xev.type == KeyPress || curEvent->xev.type == KeyRelease) {
+ if (IsKeyEventType(curEvent->xev.type)) {
RemoveListEntry(&bindPtr->lookupTables.entryPool, psEntry);
}
break;
case KeyPress:
case KeyRelease:
- if (curEvent->xev.type == ButtonPress || curEvent->xev.type == ButtonRelease) {
+ if (IsButtonEventType(curEvent->xev.type)) {
RemoveListEntry(&bindPtr->lookupTables.entryPool, psEntry);
}
break;
@@ -2725,8 +2743,8 @@ static int
CompareModMasks(
const PSModMaskArr *fstModMaskArr,
const PSModMaskArr *sndModMaskArr,
- ModMask fstModMask,
- ModMask sndModMask)
+ unsigned fstModMask,
+ unsigned sndModMask)
{
int fstCount = 0;
int sndCount = 0;
@@ -2750,11 +2768,11 @@ CompareModMasks(
assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr));
for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) {
- ModMask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i);
- ModMask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i);
+ unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i);
+ unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i);
- if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; }
- if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; }
+ if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; }
+ if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; }
}
}
@@ -2784,8 +2802,9 @@ MatchPatterns(
PSEntry *psEntry;
PatSeq *bestPtr;
PatSeq *bestPhysPtr;
- ModMask bestModMask;
+ unsigned bestModMask;
const PSModMaskArr *bestModMaskArr = NULL;
+ int i, isModKeyOnly = 0;
assert(dispPtr);
assert(bindPtr);
@@ -2800,6 +2819,26 @@ MatchPatterns(
bestPhysPtr = NULL;
window = curEvent->xev.xany.window;
+ /*
+ * Modifier key events interlaced between patterns parts of a
+ * sequence shall not prevent a sequence from ultimately
+ * matching. Example: when trying to trigger <a><Control-c>
+ * from the keyboard, the sequence of events actually seen is
+ * <a> then <Control_L> (possibly repeating if the key is hold
+ * down), and finally <Control-c>. At the time <Control_L> is
+ * seen, we shall keep the <a><Control-c> pattern sequence in
+ * the promotion list, otherwise it is impossible to trigger
+ * it from the keyboard. See bug [16ef161925].
+ */
+ if (IsKeyEventType(curEvent->xev.type)) {
+ for (i = 0; i < dispPtr->numModKeyCodes; ++i) {
+ if (dispPtr->modKeyCodes[i] == curEvent->xev.xkey.keycode) {
+ isModKeyOnly = 1;
+ break;
+ }
+ }
+ }
+
for (psEntry = PSList_First(psList); psEntry; psEntry = PSList_Next(psEntry)) {
if (patIndex == 0 || psEntry->window == window) {
PatSeq* psPtr = psEntry->psPtr;
@@ -2814,6 +2853,12 @@ MatchPatterns(
: VirtPatIsBound(bindPtr, psPtr, object, physPtrPtr)) {
TkPattern *patPtr = psPtr->pats + patIndex;
+ /* ignore modifier key events, and KeyRelease events if the current event
+ * is of a different type (e.g. a Button event)
+ */
+ psEntry->keepIt = isModKeyOnly || \
+ ((patPtr->eventType != (unsigned) curEvent->xev.type) && curEvent->xev.type == KeyRelease);
+
if (patPtr->eventType == (unsigned) curEvent->xev.type
&& (curEvent->xev.type != CreateNotify
|| curEvent->xev.xcreatewindow.parent == window)
@@ -2824,12 +2869,13 @@ MatchPatterns(
* cannot be done in ParseEventDescription, otherwise this function would
* be the better place.
*/
- ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask);
- ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
+ unsigned modMask = ResolveModifiers(dispPtr, patPtr->modMask);
+ unsigned curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
psEntry->expired = 1; /* remove it from promotion list */
+ psEntry->keepIt = 0; /* don't keep matching patterns */
- if ((modMask & ~curModMask) == 0) {
+ if (IsSubsetOf(modMask, curModMask)) {
unsigned count = patPtr->info ? curEvent->countDetailed : curEvent->countAny;
if (patIndex < PSModMaskArr_Size(psEntry->lastModMaskArr)) {
@@ -3476,7 +3522,7 @@ DeleteVirtualEventTable(
* already defined, the new definition augments those that already exist.
*
* Results:
- * The return value is TCL_ERROR if an error occured while creating the
+ * The return value is TCL_ERROR if an error occurred while creating the
* virtual binding. In this case, an error message will be left in the
* interp's result. If all went well then the return value is TCL_OK.
*
@@ -3820,7 +3866,7 @@ HandleEventGenerate(
Tk_Window tkwin;
Tk_Window tkwin2;
TkWindow *mainPtr;
- EventMask eventMask;
+ unsigned eventMask;
Tcl_Obj *userDataObj;
int synch;
int warp;
@@ -4004,6 +4050,9 @@ HandleEventGenerate(
return TCL_ERROR;
}
if (flags & BUTTON) {
+ if (number >= Button4) {
+ number += (Button8 - Button4);
+ }
event.general.xbutton.button = number;
} else {
badOpt = 1;
@@ -4358,17 +4407,6 @@ HandleEventGenerate(
}
/*
- * Now we have constructed the event, inject it into the event handling
- * code.
- */
-
- if (synch) {
- Tk_HandleEvent(&event.general);
- } else {
- Tk_QueueWindowEvent(&event.general, pos);
- }
-
- /*
* We only allow warping if the window is mapped.
*/
@@ -4377,11 +4415,6 @@ HandleEventGenerate(
Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display, event.general.xmotion.window);
- if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
- Tcl_DoWhenIdle(DoWarp, dispPtr);
- dispPtr->flags |= TK_DISPLAY_IN_WARP;
- }
-
if (warpWindow != dispPtr->warpWindow) {
if (warpWindow) {
Tcl_Preserve(warpWindow);
@@ -4394,6 +4427,31 @@ HandleEventGenerate(
dispPtr->warpMainwin = mainWin;
dispPtr->warpX = event.general.xmotion.x;
dispPtr->warpY = event.general.xmotion.y;
+
+ /*
+ * Warping with respect to a window will be done when Tk_handleEvent
+ * below will run the event handlers and in particular TkPointerEvent.
+ * This allows to make grabs and warping work together robustly, that
+ * is without depending on a precise sequence of events.
+ * Warping with respect to the whole screen (i.e. dispPtr->warpWindow
+ * is NULL) is run directly here.
+ */
+
+ if (!dispPtr->warpWindow) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
+ }
+
+ /*
+ * Now we have constructed the event, inject it into the event handling
+ * code.
+ */
+
+ if (synch) {
+ Tk_HandleEvent(&event.general);
+ } else {
+ Tk_QueueWindowEvent(&event.general, pos);
}
}
@@ -4466,46 +4524,47 @@ NameToWindow(
/*
*-------------------------------------------------------------------------
*
- * DoWarp --
+ * TkDoWarpWrtWin --
*
- * Perform Warping of X pointer. Executed as an idle handler only.
+ * Perform warping of mouse pointer with respect to a window.
*
* Results:
* None
*
* Side effects:
- * X Pointer will move to a new location.
+ * Mouse pointer moves to a new location.
*
*-------------------------------------------------------------------------
*/
-static void
-DoWarp(
- ClientData clientData)
+void
+TkDoWarpWrtWin(
+ TkDisplay *dispPtr)
{
- TkDisplay *dispPtr = (TkDisplay *)clientData;
-
- assert(clientData);
+ assert(dispPtr);
/*
- * DoWarp was scheduled only if the window was mapped. It needs to be
- * still mapped at the time the present idle callback is executed. Also
- * one needs to guard against window destruction in the meantime.
- * Finally, the case warpWindow == NULL is special in that it means
- * the whole screen.
+ * A NULL warpWindow means warping with respect to the whole screen.
+ * We want to warp here only if we're warping with respect to a window.
*/
- if (!dispPtr->warpWindow ||
- (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None)) {
- TkpWarpPointer(dispPtr);
- XForceScreenSaver(dispPtr->display, ScreenSaverReset);
- }
-
if (dispPtr->warpWindow) {
- Tcl_Release(dispPtr->warpWindow);
- dispPtr->warpWindow = NULL;
+
+ /*
+ * Warping with respect to a window can only be done if the window is
+ * mapped. This was checked in HandleEvent. The window needs to be
+ * still mapped at the time the present code is executed. Also
+ * one needs to guard against window destruction in the meantime,
+ * which could have happened as a side effect of an event handler.
+ */
+
+ if (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
+ Tcl_Release(dispPtr->warpWindow);
+ dispPtr->warpWindow = NULL;
}
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
/*
@@ -4592,7 +4651,7 @@ FindSequence(
* 1 means create. */
int allowVirtual, /* 0 means that virtual events are not allowed in the sequence.
* 1 otherwise. */
- EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this
+ unsigned *maskPtr) /* *maskPtr is filled in with the event types on which this
* pattern sequence depends. */
{
unsigned patsBufSize = 1;
@@ -4606,8 +4665,8 @@ FindSequence(
int isNew;
unsigned count;
unsigned maxCount = 0;
- EventMask eventMask = 0;
- ModMask modMask = 0;
+ unsigned eventMask = 0;
+ unsigned modMask = 0;
PatternTableKey key;
assert(lookupTables);
@@ -4781,10 +4840,10 @@ ParseEventDescription(
const char **eventStringPtr,/* On input, holds a pointer to start of event string. On exit,
* gets pointer to rest of string after parsed event. */
TkPattern *patPtr, /* Filled with the pattern parsed from the event string. */
- EventMask *eventMaskPtr) /* Filled with event mask of matched event. */
+ unsigned *eventMaskPtr) /* Filled with event mask of matched event. */
{
const char *p;
- EventMask eventMask = 0;
+ unsigned eventMask = 0;
unsigned count = 1;
assert(eventStringPtr);
@@ -4957,7 +5016,7 @@ ParseEventDescription(
"NON_BUTTON");
}
#if SUPPORT_ADDITIONAL_MOTION_SYNTAX
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
p = SkipFieldDelims(p);
while (*p && *p != '>') {
p = SkipFieldDelims(GetField(p, field, sizeof(field)));
@@ -4967,7 +5026,7 @@ ParseEventDescription(
patPtr, 0,
Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON");
}
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
}
patPtr->info = ButtonNumberFromState(patPtr->modMask);
#endif
@@ -5097,7 +5156,7 @@ GetPatternObj(
assert(patPtr->name);
Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name);
} else {
- ModMask modMask;
+ unsigned modMask;
const ModInfo *modPtr;
/*
@@ -5145,16 +5204,16 @@ GetPatternObj(
}
case ButtonPress:
case ButtonRelease:
- assert(patPtr->info <= Button9);
- Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info);
+ assert(patPtr->info <= 13);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) ((patPtr->info > 7) ? (patPtr->info - 4) : patPtr->info));
break;
#if PRINT_SHORT_MOTION_SYNTAX
case MotionNotify: {
- ModMask mask = patPtr->modMask;
+ unsigned mask = patPtr->modMask;
while (mask & ALL_BUTTONS) {
- int button = ButtonNumberFromState(mask);
- Tcl_AppendPrintfToObj(patternObj, "-%d", button);
- mask &= ~TkGetButtonMask(button);
+ unsigned button = ButtonNumberFromState(mask);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (button > 7) ? (button - 4) : button);
+ mask &= ~Tk_GetButtonMask(button);
}
break;
}
@@ -5276,35 +5335,6 @@ TkpGetBindingXEvent(
/*
*----------------------------------------------------------------------
*
- * TkpCancelWarp --
- *
- * This function cancels an outstanding pointer warp and
- * is called during tear down of the display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpCancelWarp(
- TkDisplay *dispPtr)
-{
- assert(dispPtr);
-
- if (dispPtr->flags & TK_DISPLAY_IN_WARP) {
- Tcl_CancelIdleCall(DoWarp, dispPtr);
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpDumpPS --
*
* Dump given pattern sequence to stdout.
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 5014eeb..f6ae494 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -125,10 +125,9 @@ SetWindowInstanceData(
static void
BusyCustodyProc(
ClientData clientData, /* Information about the busy window. */
- Tk_Window tkwin) /* Not used. */
+ TCL_UNUSED(Tk_Window)) /* Not used. */
{
Busy *busyPtr = (Busy *)clientData;
- (void)tkwin;
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc,
busyPtr);
@@ -158,14 +157,11 @@ BusyCustodyProc(
static void
BusyGeometryProc(
- ClientData dummy, /* Information about window that got new
+ TCL_UNUSED(void *), /* Information about window that got new
* preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
- (void)dummy;
- (void)tkwin;
-
/* Should never get here */
}
@@ -809,7 +805,7 @@ Tk_BusyObjCmd(
};
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "options ?arg ...?");
return TCL_ERROR;
}
@@ -819,7 +815,7 @@ Tk_BusyObjCmd(
if (Tcl_GetString(objv[1])[0] == '.') {
if (objc%2 == 1) {
- Tcl_WrongNumArgs(interp, 1, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[1], objc-2, objv+2);
@@ -865,7 +861,7 @@ Tk_BusyObjCmd(
case BUSY_CONFIGURE:
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
@@ -900,7 +896,7 @@ Tk_BusyObjCmd(
if (pattern == NULL ||
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
- TkNewWindowObj(busyPtr->tkRef));
+ Tk_NewWindowObj(busyPtr->tkRef));
}
}
Tcl_SetObjResult(interp, objPtr);
@@ -922,7 +918,7 @@ Tk_BusyObjCmd(
case BUSY_HOLD:
if (objc < 3 || objc%2 != 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[2], objc-3, objv+3);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 8056f31..69d4b12 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -760,7 +760,7 @@ ButtonCreate(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(butPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(butPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index c711f1d..257dcfc 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -707,12 +707,11 @@ ComputeArcParametersFromHeight(
static void
DeleteArc(
- Tk_Canvas canvas, /* Info about overall canvas. */
+ TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
- ArcItem *arcPtr = (ArcItem *) itemPtr;
- (void)canvas;
+ ArcItem *arcPtr = (ArcItem *)itemPtr;
Tk_DeleteOutline(display, &(arcPtr->outline));
if (arcPtr->numOutlinePoints != 0) {
@@ -794,13 +793,13 @@ ComputeArcBbox(
*/
if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
- double tmp = arcPtr->bbox[3];
+ tmp = arcPtr->bbox[3];
arcPtr->bbox[3] = arcPtr->bbox[1];
arcPtr->bbox[1] = tmp;
}
if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
- double tmp = arcPtr->bbox[2];
+ tmp = arcPtr->bbox[2];
arcPtr->bbox[2] = arcPtr->bbox[0];
arcPtr->bbox[0] = tmp;
@@ -900,8 +899,10 @@ DisplayArc(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- int x, int y, /* Describes region of canvas that must be */
- int width, int height) /* redisplayed (not used). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
short x1, y1, x2, y2;
@@ -909,10 +910,6 @@ DisplayArc(
double lineWidth;
Tk_State state = itemPtr->state;
Pixmap stipple;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
@@ -1648,7 +1645,7 @@ ComputeArcOutline(
* curved arc segment, which are marked with X's in the figure below:
*
*
- * * * *
+ * * * *
* * *
* * * * *
* * * * *
@@ -2001,7 +1998,7 @@ ArcToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
- int prepass) /* 1 means this is a prepass to collect font
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2014,7 +2011,6 @@ ArcToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]);
y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]);
@@ -2197,9 +2193,9 @@ ArcToPostscript(
static int
StyleParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2207,8 +2203,6 @@ StyleParseProc(
int c;
size_t length;
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*stylePtr = PIESLICE_STYLE;
@@ -2262,18 +2256,15 @@ StyleParseProc(
static const char *
StylePrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Ignored. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Ignored. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
if (*stylePtr == ARC_STYLE) {
return "arc";
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 484f41c..378e6ed 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -97,7 +97,7 @@ static int LineCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int objc, Tcl_Obj *const objv[]);
static void LineDeleteCoords(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void LineInsert(Tk_Canvas canvas,
Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int LineToArea(Tk_Canvas canvas,
@@ -605,12 +605,11 @@ ConfigureLine(
static void
DeleteLine(
- Tk_Canvas canvas, /* Info about overall canvas widget. */
+ TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
LineItem *linePtr = (LineItem *) itemPtr;
- (void)canvas;
Tk_DeleteOutline(display, &linePtr->outline);
if (linePtr->coordPtr != NULL) {
@@ -710,7 +709,7 @@ ComputeLineBbox(
tsoffset = &linePtr->outline.tsoffset;
if (tsoffset->flags & TK_OFFSET_INDEX) {
- double *coordPtr = linePtr->coordPtr
+ coordPtr = linePtr->coordPtr
+ (tsoffset->flags & ~TK_OFFSET_INDEX);
if (tsoffset->flags <= 0) {
@@ -834,20 +833,17 @@ DisplayLine(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- int x, int y, int width, int height)
- /* Describes region of canvas that must be
- * redisplayed (not used). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- LineItem *linePtr = (LineItem *) itemPtr;
+ LineItem *linePtr = (LineItem *)itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
XPoint *pointPtr;
double linewidth;
int numPoints;
Tk_State state = itemPtr->state;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
@@ -1153,8 +1149,8 @@ static void
LineDeleteCoords(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Index of first character to delete. */
- int last) /* Index of last character to delete. */
+ TkSizeT first, /* Index of first character to delete. */
+ TkSizeT last) /* Index of last character to delete. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int count, i, first1, last1;
@@ -1169,13 +1165,13 @@ LineDeleteCoords(
first &= -2;
last &= -2;
- if (first < 0) {
+ if ((int)first < 0) {
first = 0;
}
- if (last >= length) {
+ if ((int)last >= length) {
last = length-2;
}
- if (first > last) {
+ if ((int)first > (int)last) {
return;
}
if (linePtr->firstArrowPtr != NULL) {
@@ -1701,8 +1697,6 @@ ScaleLine(
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- int i;
-
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
@@ -1931,9 +1925,9 @@ RotateLine(
static int
ParseArrowShape(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Window tkwin, /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Not used. */
const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
@@ -1944,8 +1938,6 @@ ParseArrowShape(
double a, b, c;
int argc;
const char **argv = NULL;
- (void)dummy;
- (void)tkwin;
if ((size_t)offset != offsetof(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
@@ -2001,19 +1993,16 @@ ParseArrowShape(
static const char *
PrintArrowShape(
- ClientData dummy, /* Not used. */
- Tk_Window tkwin, /* Window associated with linePtr's widget. */
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */
char *recordPtr, /* Pointer to item record containing current
* shape information. */
- TkSizeT offset, /* Offset of arrow information in record. */
+ TCL_UNUSED(TkSizeT), /* Offset of arrow information in record. */
Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free
* string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
char *buffer = (char *)ckalloc(120);
- (void)dummy;
- (void)tkwin;
- (void)offset;
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);
@@ -2041,9 +2030,9 @@ PrintArrowShape(
static int
ArrowParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2051,8 +2040,6 @@ ArrowParseProc(
int c;
size_t length;
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*arrowPtr = ARROWS_NONE;
@@ -2110,18 +2097,15 @@ ArrowParseProc(
static const char *
ArrowPrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
switch (*arrowPtr) {
case ARROWS_FIRST:
@@ -2316,7 +2300,7 @@ LineToPostscript(
Tcl_Interp *interp, /* Leave Postscript or error message here. */
Tk_Canvas canvas, /* Information about overall canvas. */
Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
- int prepass) /* 1 means this is a prepass to collect font
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2328,7 +2312,6 @@ LineToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index f4f0163..a827fdb 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -168,7 +168,7 @@ static int PolygonCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int objc, Tcl_Obj *const objv[]);
static void PolygonDeleteCoords(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void PolygonInsert(Tk_Canvas canvas,
Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int PolygonToArea(Tk_Canvas canvas,
@@ -876,12 +876,10 @@ DisplayPolygon(
Tk_Item *itemPtr, /* Item to be displayed. */
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
- TCL_UNUSED(int),
- TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
- /* Describes region of canvas that must be
- * redisplayed (not used). */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_State state = itemPtr->state;
@@ -1172,23 +1170,23 @@ static void
PolygonDeleteCoords(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Index of first character to delete. */
- int last) /* Index of last character to delete. */
+ TkSizeT first, /* Index of first character to delete. */
+ TkSizeT last) /* Index of last character to delete. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int count, i;
int length = 2*(polyPtr->numPoints - polyPtr->autoClosed);
- while (first >= length) {
+ while ((int)first >= length) {
first -= length;
}
- while (first < 0) {
+ while ((int)first < 0) {
first += length;
}
- while (last >= length) {
+ while ((int)last >= length) {
last -= length;
}
- while (last < 0) {
+ while ((int)last < 0) {
last += length;
}
@@ -1215,7 +1213,7 @@ PolygonDeleteCoords(
polyPtr->coordPtr[i-count] = polyPtr->coordPtr[i];
}
} else {
- for (i=last; i<=first; i++) {
+ for (i=last; i<=(int)first; i++) {
polyPtr->coordPtr[i-last] = polyPtr->coordPtr[i];
}
}
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 7b51122..a8ce9de 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -192,7 +192,7 @@ TkCanvPostscriptCmd(
* such.
*/
- result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", -1, 0);
+ result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", -1, TCL_EVAL_GLOBAL);
if (result != TCL_OK) {
return result;
}
@@ -1603,7 +1603,7 @@ Tk_PostscriptPhoto(
/*
* Generate data for image in monochrome mode. No attempt at
* dithering is made--instead, just set a threshold. To handle
- * transparecies we need to output two lines: one for the black
+ * transparencies we need to output two lines: one for the black
* pixels, one for the white ones.
*/
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 1c8bc04..e597434 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -161,7 +161,7 @@ static int TextCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
int argc, Tcl_Obj *const objv[]);
static void TextDeleteChars(Tk_Canvas canvas,
- Tk_Item *itemPtr, int first, int last);
+ Tk_Item *itemPtr, TkSizeT first, TkSizeT last);
static void TextInsert(Tk_Canvas canvas,
Tk_Item *itemPtr, TkSizeT beforeThis, Tcl_Obj *obj);
static int TextToArea(Tk_Canvas canvas,
@@ -960,7 +960,7 @@ DisplayCanvText(
* anti-aliasing colors would blend together.
*/
- if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) {
+ if ((selFirstChar != TCL_INDEX_NONE) && (textPtr->selTextGC != textPtr->gc)) {
if (0 < selFirstChar) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
@@ -1091,9 +1091,9 @@ static void
TextDeleteChars(
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Item in which to delete characters. */
- int first, /* Character index of first character to
+ TkSizeT first, /* Character index of first character to
* delete. */
- int last) /* Character index of last character to delete
+ TkSizeT last) /* Character index of last character to delete
* (inclusive). */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -1102,13 +1102,13 @@ TextDeleteChars(
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
text = textPtr->text;
- if (first < 0) {
+ if ((int)first < 0) {
first = 0;
}
- if (last >= (int)textPtr->numChars) {
+ if (last + 1 >= textPtr->numChars + 1) {
last = textPtr->numChars - 1;
}
- if (first > last) {
+ if (first + 1 > last + 1) {
return;
}
charsRemoved = last + 1 - first;
@@ -1132,15 +1132,15 @@ TextDeleteChars(
*/
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst + 1 > (TkSizeT)first + 1) {
+ if (textInfoPtr->selectFirst + 1 > first + 1) {
textInfoPtr->selectFirst -= charsRemoved;
if ((int)textInfoPtr->selectFirst + 1 < (int)first + 1) {
textInfoPtr->selectFirst = first;
}
}
- if (textInfoPtr->selectLast + 1 >= (TkSizeT)first + 1) {
+ if (textInfoPtr->selectLast + 1 >= first + 1) {
textInfoPtr->selectLast -= charsRemoved;
- if (textInfoPtr->selectLast + 1 < (TkSizeT)first) {
+ if (textInfoPtr->selectLast + 1 < first) {
textInfoPtr->selectLast = first - 1;
}
}
@@ -1148,14 +1148,14 @@ TextDeleteChars(
textInfoPtr->selItemPtr = NULL;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor + 1 > (TkSizeT)first + 1)) {
+ && (textInfoPtr->selectAnchor + 1 > first + 1)) {
textInfoPtr->selectAnchor -= charsRemoved;
- if (textInfoPtr->selectAnchor + 1 < (TkSizeT)first + 1) {
+ if (textInfoPtr->selectAnchor + 1 < first + 1) {
textInfoPtr->selectAnchor = first;
}
}
}
- if (textPtr->insertPos + 1 > (TkSizeT)first + 1) {
+ if (textPtr->insertPos + 1 > first + 1) {
textPtr->insertPos -= charsRemoved;
if ((int)textPtr->insertPos + 1 < (int)first + 1) {
textPtr->insertPos = first;
@@ -1375,7 +1375,7 @@ TranslateText(
static int
GetTextIndex(
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Canvas canvas, /* Canvas containing item. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */
Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
Tcl_Obj *obj, /* Specification of a particular character in
@@ -1388,7 +1388,6 @@ GetTextIndex(
int c;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
const char *string;
- (void)canvas;
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
@@ -1426,7 +1425,7 @@ GetTextIndex(
*indexPtr = textInfoPtr->selectLast;
} else if (c == '@') {
int x, y;
- double tmp, c = textPtr->cosine, s = textPtr->sine;
+ double tmp, cs = textPtr->cosine, s = textPtr->sine;
char *end;
const char *p;
@@ -1445,7 +1444,7 @@ GetTextIndex(
x -= (int) textPtr->drawOrigin[0];
y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
- (int) (x*c - y*s), (int) (y*c + x*s));
+ (int) (x*cs - y*s), (int) (y*cs + x*s));
} else {
/*
* Some of the paths here leave messages in the interp's result, so we
@@ -1478,14 +1477,13 @@ GetTextIndex(
static void
SetTextCursor(
- Tk_Canvas canvas, /* Record describing canvas widget. */
+ TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */
Tk_Item *itemPtr, /* Text item in which cursor position is to be
* set. */
TkSizeT index) /* Character index of character just before
* which cursor is to be positioned. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- (void)canvas;
if (index == TCL_INDEX_NONE) {
textPtr->insertPos = 0;
@@ -1518,7 +1516,7 @@ SetTextCursor(
static TkSizeT
GetSelText(
- Tk_Canvas canvas, /* Canvas containing selection. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */
Tk_Item *itemPtr, /* Text item containing selection. */
TkSizeT offset, /* Byte offset within selection of first
* character to be returned. */
@@ -1532,7 +1530,6 @@ GetSelText(
char *text;
const char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- (void)canvas;
if (((int)textInfoPtr->selectFirst < 0) ||
(textInfoPtr->selectFirst + 1 > textInfoPtr->selectLast + 1)) {
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index a1fe265..b092df6 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -774,7 +774,7 @@ TkSmoothParseProc(
}
/*
- * Backward compatability hack.
+ * Backward compatibility hack.
*/
if (strncmp(value, "bezier", length) == 0) {
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 8028c14..37530dd 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -87,7 +87,7 @@ static void TranslateWinItem(Tk_Canvas canvas,
static int WinItemCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
Tcl_Obj *const objv[]);
-static void WinItemLostSlaveProc(ClientData clientData,
+static void WinItemLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void WinItemRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -144,7 +144,7 @@ Tk_ItemType tkWindowType = {
static const Tk_GeomMgr canvasGeomType = {
"canvas", /* name */
WinItemRequestProc, /* requestProc */
- WinItemLostSlaveProc, /* lostSlaveProc */
+ WinItemLostContentProc, /* lostContentProc */
};
/*
@@ -1102,25 +1102,25 @@ WinItemRequestProc(
/*
*--------------------------------------------------------------
*
- * WinItemLostSlaveProc --
+ * WinItemLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all canvas-related information about the slave.
+ * Forgets all canvas-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-WinItemLostSlaveProc(
- ClientData clientData, /* WindowItem structure for slave window that
+WinItemLostContentProc(
+ ClientData clientData, /* WindowItem structure for content window window that
* was stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window. */
{
WindowItem *winItemPtr = (WindowItem *)clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 51238a0..3dd1403 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -799,7 +799,7 @@ Tk_CanvasObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(canvasPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(canvasPtr->tkwin));
return TCL_OK;
error:
@@ -839,8 +839,8 @@ CanvasWidgetCmd(
TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by
* TagSearchDestroy */
- int index;
- static const char *const optionStrings[] = {
+ int idx;
+ static const char *const canvasOptionStrings[] = {
"addtag", "bbox", "bind", "canvasx",
"canvasy", "cget", "configure", "coords",
"create", "dchars", "delete", "dtag",
@@ -852,7 +852,7 @@ CanvasWidgetCmd(
"scan", "select", "type", "xview",
"yview", NULL
};
- enum options {
+ enum canvasOptionStringsEnum {
CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX,
CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS,
CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG,
@@ -869,14 +869,14 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], canvasOptionStrings, "option", 0,
+ &idx) != TCL_OK) {
return TCL_ERROR;
}
Tcl_Preserve(canvasPtr);
result = TCL_OK;
- switch ((enum options) index) {
+ switch ((enum canvasOptionStringsEnum)idx) {
case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?");
@@ -988,7 +988,7 @@ CanvasWidgetCmd(
if (objc == 5) {
int append = 0;
- unsigned long mask;
+ unsigned int mask;
const char *argv4 = Tcl_GetString(objv[4]);
if (argv4[0] == 0) {
@@ -1036,7 +1036,7 @@ CanvasWidgetCmd(
result = TCL_ERROR;
goto done;
}
- if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask
+ if (mask & ~(ButtonMotionMask|Button1MotionMask
|Button2MotionMask|Button3MotionMask|Button4MotionMask
|Button5MotionMask|ButtonPressMask|ButtonReleaseMask
|EnterWindowMask|LeaveWindowMask|KeyPressMask
@@ -1247,7 +1247,6 @@ CanvasWidgetCmd(
case CANV_CREATE: {
Tk_ItemType *typePtr;
Tk_ItemType *matchPtr = NULL;
- Tk_Item *itemPtr;
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
@@ -1663,7 +1662,6 @@ CanvasWidgetCmd(
}
break;
case CANV_LOWER: {
- Tk_Item *itemPtr;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?");
@@ -1927,10 +1925,10 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?");
result = TCL_ERROR;
} else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
- "scan option", 0, &index) != TCL_OK) {
+ "scan option", 0, &idx) != TCL_OK) {
result = TCL_ERROR;
- } else if ((objc != 5) && (objc != 5+index)) {
- Tcl_WrongNumArgs(interp, 3, objv, index?"x y ?gain?":"x y");
+ } else if ((objc != 5) && (objc != 5+idx)) {
+ Tcl_WrongNumArgs(interp, 3, objv, idx?"x y ?gain?":"x y");
result = TCL_ERROR;
} else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
@@ -1938,7 +1936,7 @@ CanvasWidgetCmd(
} else if ((objc == 6) &&
(Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
result = TCL_ERROR;
- } else if (!index) {
+ } else if (!idx) {
canvasPtr->scanX = x;
canvasPtr->scanXOrigin = canvasPtr->xOrigin;
canvasPtr->scanY = y;
@@ -2503,7 +2501,7 @@ CanvasWorldChanged(
*/
static void
DecomposeMaskToShiftAndBits(
- unsigned long mask, /* The pixel mask to examine */
+ unsigned int mask, /* The pixel mask to examine */
int *shift, /* Where to put the shift count (position of lowest bit) */
int *bits) /* Where to put the bit count (width of the pixel mask) */
{
@@ -2849,7 +2847,7 @@ DrawCanvas(
#endif
for(x = 0; x < blockPtr.width; ++x) {
- unsigned long pixel = 0;
+ unsigned int pixel = 0;
switch (ximagePtr->bits_per_pixel) {
@@ -2881,7 +2879,7 @@ DrawCanvas(
*/
case 32 :
- pixel = *((unsigned long *)(ximagePtr->data + bytesPerPixel * x
+ pixel = *((unsigned int *)(ximagePtr->data + bytesPerPixel * x
+ ximagePtr->bytes_per_line * y));
if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst)
|| (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst))
@@ -3763,7 +3761,7 @@ TagSearchScan(
*/
searchPtr->rewritebufferAllocated = 100;
- searchPtr->rewritebuffer =(char *) ckalloc(searchPtr->rewritebufferAllocated);
+ searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&searchPtr->expr);
@@ -4596,7 +4594,7 @@ DoItem(
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
- newTagPtr = (Tk_Uid*)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
+ newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
memcpy((void *) newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
@@ -5082,7 +5080,7 @@ CanvasBindProc(
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
- unsigned long mask;
+ unsigned mask;
Tcl_Preserve(canvasPtr);
@@ -5095,7 +5093,7 @@ CanvasBindProc(
switch (eventPtr->type) {
case ButtonPress:
case ButtonRelease:
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
/*
* For button press events, repick the current item using the button
@@ -5178,7 +5176,7 @@ PickCurrentItem(
* ButtonRelease, or MotionNotify. */
{
double coords[2];
- unsigned long buttonDown;
+ unsigned int buttonDown;
Tk_Item *prevItemPtr;
SearchUids *searchUids = GetStaticUids();
@@ -5849,8 +5847,8 @@ CanvasUpdateScrollbars(
Tcl_DString buf;
/*
- * Save all the relevant values from the canvasPtr, because it might be
- * deleted as part of either of the two calls to Tcl_VarEval below.
+ * Preserve the relevant values from the canvasPtr, because it might be
+ * deleted as part of either of the two calls to Tcl_EvalEx below.
*/
interp = canvasPtr->interp;
@@ -5881,7 +5879,7 @@ CanvasUpdateScrollbars(
Tcl_DStringAppend(&buf, xScrollCmd, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
@@ -5899,7 +5897,7 @@ CanvasUpdateScrollbars(
Tcl_DStringAppend(&buf, yScrollCmd, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
Tcl_DecrRefCount(fractions);
if (result != TCL_OK) {
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 8a7ffee..67b91a2 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -173,16 +173,12 @@ ClipboardAppHandler(
static TkSizeT
ClipboardWindowHandler(
- ClientData dummy, /* Not used. */
- TkSizeT offset, /* Return selection bytes starting at this
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(TkSizeT), /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- TkSizeT maxBytes) /* Maximum # of bytes to store at buffer. */
+ TCL_UNUSED(TkSizeT)) /* Maximum # of bytes to store at buffer. */
{
- (void)dummy;
- (void)offset;
- (void)maxBytes;
-
buffer[0] = '.';
buffer[1] = 0;
return 1;
@@ -641,11 +637,10 @@ Tk_ClipboardObjCmd(
int
TkClipInit(
- Tcl_Interp *dummy, /* Interpreter to use for error reporting. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting. */
TkDisplay *dispPtr)/* Display to initialize. */
{
XSetWindowAttributes atts;
- (void)dummy;
dispPtr->clipTargetPtr = NULL;
dispPtr->clipboardActive = 0;
@@ -710,12 +705,10 @@ static int
ClipboardGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *dummy, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
- (void)dummy;
-
Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index c9026ef..a8d72fc 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -897,13 +897,12 @@ UseinputmethodsCmd(
int
WindowingsystemCmd(
- ClientData dummy, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *windowingsystem;
- (void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1114,16 +1113,12 @@ Tk_TkwaitObjCmd(
static char *
WaitVariableProc(
ClientData clientData, /* Pointer to integer to set to 1. */
- Tcl_Interp *dummy, /* Interpreter containing variable. */
- const char *name1, /* Name of variable. */
- const char *name2, /* Second part of variable name. */
- int flags) /* Information about what happened. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter containing variable. */
+ TCL_UNUSED(const char *), /* Name of variable. */
+ TCL_UNUSED(const char *), /* Second part of variable name. */
+ TCL_UNUSED(int)) /* Information about what happened. */
{
int *donePtr = (int *)clientData;
- (void)dummy;
- (void)name1;
- (void)name2;
- (void)flags;
*donePtr = 1;
return NULL;
@@ -1174,7 +1169,7 @@ WaitWindowProc(
int
Tk_UpdateObjCmd(
- ClientData dummy, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1183,7 +1178,6 @@ Tk_UpdateObjCmd(
int flags, index;
TkDisplay *dispPtr;
int code = TCL_OK;
- (void)dummy;
if (objc == 1) {
flags = TCL_DONT_WAIT;
@@ -1741,7 +1735,23 @@ Tk_WinfoObjCmd(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) {
return TCL_ERROR;
}
+#ifdef TK_HAS_DYNAMIC_COLORS
+
+ /*
+ * Make sure that the TkColor used for the winfo rgb command is
+ * destroyed when we are through with it, so we do not get stale RGB
+ * values next time.
+ */
+
+ {
+ Colormap temp = Tk_Colormap(tkwin);
+ Tk_Colormap(tkwin) = TK_DYNAMIC_COLORMAP;
+ colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+ Tk_Colormap(tkwin) = temp;
+ }
+#else
colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+#endif
if (colorPtr == NULL) {
return TCL_ERROR;
}
@@ -1890,14 +1900,11 @@ TkGetDisplayOf(
int
TkDeadAppObjCmd(
- ClientData dummy, /* Dummy. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ TCL_UNUSED(int), /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- (void)dummy;
- (void)objc;
-
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't invoke \"%s\" command: application has been destroyed",
Tcl_GetString(objv[0])));
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index d4ffa7c..925cb72 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -67,7 +67,7 @@ typedef struct TkOption {
* monochrome displays. */
struct TkOption *synonymPtr;
/* For synonym options, this points to the
- * master entry. */
+ * original entry. */
const struct Tk_ObjCustomOption *custom;
/* For TK_OPTION_CUSTOM. */
} extra;
@@ -237,8 +237,8 @@ Tk_CreateOptionTable(
if (specPtr->type == TK_OPTION_SYNONYM) {
/*
- * This is a synonym option; find the master option that it refers
- * to and create a pointer from the synonym to the master.
+ * This is a synonym option; find the original option that it refers
+ * to and create a pointer from the synonym to the origin.
*/
for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) {
@@ -1405,8 +1405,6 @@ Tk_RestoreSavedOptions(
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
case TK_OPTION_BOOLEAN:
- *((int *) internalPtr) = *((int *) ptr);
- break;
case TK_OPTION_INT:
*((int *) internalPtr) = *((int *) ptr);
break;
@@ -1499,9 +1497,8 @@ Tk_FreeSavedOptions(
Tk_FreeSavedOptions(savePtr->nextPtr);
ckfree(savePtr->nextPtr);
}
- for (count = savePtr->numItems,
- savedOptionPtr = &savePtr->items[savePtr->numItems-1];
- count > 0; count--, savedOptionPtr--) {
+ for (count = savePtr->numItems; count > 0; count--) {
+ savedOptionPtr = &savePtr->items[count-1];
if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) {
FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr,
(char *) &savedOptionPtr->internalForm, savePtr->tkwin);
@@ -1874,106 +1871,106 @@ GetObjectForOption(
void *internalPtr; /* Points to internal value of option in
* record. */
- internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
objPtr = NULL;
- switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_INT:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_DOUBLE:
- objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
- break;
- case TK_OPTION_STRING:
- objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
- break;
- case TK_OPTION_STRING_TABLE:
- objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
- *((int *) internalPtr)], -1);
- break;
- case TK_OPTION_COLOR: {
- XColor *colorPtr = *((XColor **) internalPtr);
+ if (optionPtr->specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
+ switch (optionPtr->specPtr->type) {
+ case TK_OPTION_BOOLEAN:
+ case TK_OPTION_INT:
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_DOUBLE:
+ objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ break;
+ case TK_OPTION_STRING:
+ objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
+ break;
+ case TK_OPTION_STRING_TABLE:
+ objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[
+ *((int *) internalPtr)], -1);
+ break;
+ case TK_OPTION_COLOR: {
+ XColor *colorPtr = *((XColor **)internalPtr);
- if (colorPtr != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ if (colorPtr != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_FONT: {
- Tk_Font tkfont = *((Tk_Font *) internalPtr);
+ case TK_OPTION_FONT: {
+ Tk_Font tkfont = *((Tk_Font *)internalPtr);
- if (tkfont != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ if (tkfont != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_STYLE: {
- Tk_Style style = *((Tk_Style *) internalPtr);
+ case TK_OPTION_STYLE: {
+ Tk_Style style = *((Tk_Style *)internalPtr);
- if (style != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ if (style != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BITMAP: {
- Pixmap pixmap = *((Pixmap *) internalPtr);
+ case TK_OPTION_BITMAP: {
+ Pixmap pixmap = *((Pixmap *)internalPtr);
- if (pixmap != None) {
- objPtr = Tcl_NewStringObj(
+ if (pixmap != None) {
+ objPtr = Tcl_NewStringObj(
Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *)internalPtr);
- if (border != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ if (border != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_RELIEF:
- objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
- break;
- case TK_OPTION_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
+ case TK_OPTION_RELIEF:
+ objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1);
+ break;
+ case TK_OPTION_CURSOR: {
+ Tk_Cursor cursor = *((Tk_Cursor *)internalPtr);
- if (cursor != NULL) {
- objPtr = Tcl_NewStringObj(
- Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ if (cursor != NULL) {
+ objPtr = Tcl_NewStringObj(
+ Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_JUSTIFY:
- objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
- *((Tk_Justify *) internalPtr)), -1);
- break;
- case TK_OPTION_ANCHOR:
- objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
- *((Tk_Anchor *) internalPtr)), -1);
- break;
- case TK_OPTION_PIXELS:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_WINDOW: {
- Tk_Window tkwin = *((Tk_Window *) internalPtr);
+ case TK_OPTION_JUSTIFY:
+ objPtr = Tcl_NewStringObj(Tk_NameOfJustify(
+ *((Tk_Justify *)internalPtr)), -1);
+ break;
+ case TK_OPTION_ANCHOR:
+ objPtr = Tcl_NewStringObj(Tk_NameOfAnchor(
+ *((Tk_Anchor *)internalPtr)), -1);
+ break;
+ case TK_OPTION_PIXELS:
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_WINDOW: {
+ tkwin = *((Tk_Window *) internalPtr);
- if (tkwin != NULL) {
- objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ if (tkwin != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_CUSTOM: {
- const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+ case TK_OPTION_CUSTOM: {
+ const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
- optionPtr->specPtr->internalOffset);
- break;
- }
- default:
- Tcl_Panic("bad option type in GetObjectForOption");
+ objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
+ optionPtr->specPtr->internalOffset);
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in GetObjectForOption");
+ }
}
if (objPtr == NULL) {
objPtr = Tcl_NewObj();
@@ -2065,7 +2062,7 @@ Tk_GetOptionValue(
Tcl_Obj *
TkDebugConfig(
- Tcl_Interp *dummy, /* Interpreter in which the table is
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter in which the table is
* defined. */
Tk_OptionTable table) /* Table about which information is to be
* returned. May not necessarily exist in the
@@ -2077,7 +2074,6 @@ TkDebugConfig(
Tcl_Obj *objPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
objPtr = Tcl_NewObj();
if (!tablePtr || !tsdPtr->initialized) {
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 0ab2954..345c937 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -67,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
- TCL_CHANNEL_VERSION_5, /* v4 channel */
+ TCL_CHANNEL_VERSION_5, /* v5 channel */
(Tcl_DriverCloseProc *)ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
@@ -561,17 +561,12 @@ ConsoleOutput(
static int
ConsoleInput(
- void *dummy, /* Unused. */
- char *buf, /* Where to store data read. */
- int bufSize, /* How much space is available in the
+ TCL_UNUSED(void *),
+ TCL_UNUSED(char *), /* Where to store data read. */
+ TCL_UNUSED(int), /* How much space is available in the
* buffer? */
- int *errorCode) /* Where to store error code. */
+ TCL_UNUSED(int *)) /* Where to store error code. */
{
- (void)dummy;
- (void)buf;
- (void)bufSize;
- (void)errorCode;
-
return 0; /* Always return EOF. */
}
@@ -594,11 +589,10 @@ ConsoleInput(
static int
ConsoleClose(
ClientData instanceData,
- Tcl_Interp *dummy) /* Unused. */
+ TCL_UNUSED(Tcl_Interp *))
{
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
- (void)dummy;
if (info) {
if (info->refCount-- <= 1) {
@@ -645,13 +639,11 @@ Console2Close(
static void
ConsoleWatch(
- ClientData dummy, /* Device ID for the channel. */
- int mask) /* OR-ed combination of TCL_READABLE,
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int)) /* OR-ed combination of TCL_READABLE,
* TCL_WRITABLE and TCL_EXCEPTION, for the
* events we are interested in. */
{
- (void)dummy;
- (void)mask;
}
/*
@@ -673,16 +665,12 @@ ConsoleWatch(
static int
ConsoleHandle(
- ClientData dummy, /* Device ID for the channel. */
- int direction, /* TCL_READABLE or TCL_WRITABLE to indicate
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int), /* TCL_READABLE or TCL_WRITABLE to indicate
* which direction of the channel is being
* requested. */
- ClientData *handlePtr) /* Where to store handle */
+ TCL_UNUSED(void **)) /* Where to store handle */
{
- (void)dummy;
- (void)direction;
- (void)handlePtr;
-
return TCL_ERROR;
}
@@ -824,7 +812,7 @@ InterpreterObjCmd(
if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no active master interp", -1));
+ "no active parent interp", -1));
Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL);
return TCL_ERROR;
}
@@ -947,7 +935,7 @@ ConsoleDeleteProc(
*
* ConsoleEventProc --
*
- * This event function is registered on the main window of the slave
+ * This event function is registered on the main window of the child
* interpreter. If the user or a running script causes the main window to
* be destroyed, then we need to inform the console interpreter by
* invoking "::tk::ConsoleExit".
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index 0d52f2f..2d89b30 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -355,7 +355,7 @@ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ImageChangedProc *changeProc,
ClientData clientData);
/* 98 */
-EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+EXTERN ClientData Tk_GetImageModelData(Tcl_Interp *interp,
const char *name,
const Tk_ImageType **typePtrPtr);
/* 99 */
@@ -411,7 +411,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr);
/* 116 */
EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window);
/* 117 */
-EXTERN void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+EXTERN void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth,
int imageHeight);
/* 118 */
@@ -422,8 +422,8 @@ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name);
EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x,
int y, int width, int height);
/* 121 */
-EXTERN void Tk_MaintainGeometry(Tk_Window slave,
- Tk_Window master, int x, int y, int width,
+EXTERN void Tk_MaintainGeometry(Tk_Window window,
+ Tk_Window container, int x, int y, int width,
int height);
/* 122 */
EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp);
@@ -461,7 +461,7 @@ EXTERN const char * Tk_NameOfCursor(Display *display, Tk_Cursor cursor);
/* 136 */
EXTERN const char * Tk_NameOfFont(Tk_Font font);
/* 137 */
-EXTERN const char * Tk_NameOfImage(Tk_ImageMaster imageMaster);
+EXTERN const char * Tk_NameOfImage(Tk_ImageModel model);
/* 138 */
EXTERN const char * Tk_NameOfJoinStyle(int join);
/* 139 */
@@ -594,8 +594,8 @@ EXTERN void Tk_UnderlineTextLayout(Display *display,
/* 180 */
EXTERN void Tk_Ungrab(Tk_Window tkwin);
/* 181 */
-EXTERN void Tk_UnmaintainGeometry(Tk_Window slave,
- Tk_Window master);
+EXTERN void Tk_UnmaintainGeometry(Tk_Window window,
+ Tk_Window container);
/* 182 */
EXTERN void Tk_UnmapWindow(Tk_Window tkwin);
/* 183 */
@@ -878,6 +878,21 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr);
/* 273 */
EXTERN void Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr);
+/* 274 */
+EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin);
+/* 275 */
+EXTERN unsigned Tk_GetButtonMask(unsigned button);
+/* 276 */
+EXTERN int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ double *doublePtr);
+/* 277 */
+EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin);
+/* 278 */
+EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin,
+ const char *eventName, Tcl_Obj *detail);
+/* 279 */
+EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont);
typedef struct {
const struct TkPlatStubs *tkPlatStubs;
@@ -988,7 +1003,7 @@ typedef struct TkStubs {
void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */
GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */
Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */
- ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */
+ ClientData (*tk_GetImageModelData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */
Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */
int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */
int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */
@@ -1007,11 +1022,11 @@ typedef struct TkStubs {
int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */
void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */
Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */
- void (*tk_ImageChanged) (Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
+ void (*tk_ImageChanged) (Tk_ImageModel model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */
int (*tk_Init) (Tcl_Interp *interp); /* 118 */
Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */
int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */
- void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window master, int x, int y, int width, int height); /* 121 */
+ void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */
Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */
void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */
void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */
@@ -1027,7 +1042,7 @@ typedef struct TkStubs {
const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
- const char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */
+ const char * (*tk_NameOfImage) (Tk_ImageModel model); /* 137 */
const char * (*tk_NameOfJoinStyle) (int join); /* 138 */
const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
const char * (*tk_NameOfRelief) (int relief); /* 140 */
@@ -1071,7 +1086,7 @@ typedef struct TkStubs {
void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, int firstByte, int lastByte); /* 178 */
void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */
void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */
- void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */
+ void (*tk_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 181 */
void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */
void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */
void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */
@@ -1164,6 +1179,12 @@ typedef struct TkStubs {
Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */
void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */
+ int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */
+ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */
+ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */
+ Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
+ void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
+ Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
} TkStubs;
extern const TkStubs *tkStubsPtr;
@@ -1374,8 +1395,8 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_GetGC) /* 96 */
#define Tk_GetImage \
(tkStubsPtr->tk_GetImage) /* 97 */
-#define Tk_GetImageMasterData \
- (tkStubsPtr->tk_GetImageMasterData) /* 98 */
+#define Tk_GetImageModelData \
+ (tkStubsPtr->tk_GetImageModelData) /* 98 */
#define Tk_GetItemTypes \
(tkStubsPtr->tk_GetItemTypes) /* 99 */
#define Tk_GetJoinStyle \
@@ -1724,6 +1745,18 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_CreateOldImageType) /* 272 */
#define Tk_CreateOldPhotoImageFormat \
(tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */
+#define Tk_AlwaysShowSelection \
+ (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */
+#define Tk_GetButtonMask \
+ (tkStubsPtr->tk_GetButtonMask) /* 275 */
+#define Tk_GetDoublePixelsFromObj \
+ (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */
+#define Tk_NewWindowObj \
+ (tkStubsPtr->tk_NewWindowObj) /* 277 */
+#define Tk_SendVirtualEvent \
+ (tkStubsPtr->tk_SendVirtualEvent) /* 278 */
+#define Tk_FontGetDescription \
+ (tkStubsPtr->tk_FontGetDescription) /* 279 */
#endif /* defined(USE_TK_STUBS) */
@@ -1741,7 +1774,7 @@ extern const TkStubs *tkStubsPtr;
#undef Tk_FreeStyleFromObj
#define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj)
#define Tk_FreeStyleFromObj(obj) /* no-op */
-
+#define Tk_GetImageMasterData Tk_GetImageModelData
#if defined(_WIN32) && defined(UNICODE)
# define Tk_MainEx Tk_MainExW
@@ -1757,9 +1790,12 @@ extern const TkStubs *tkStubsPtr;
#undef Tk_PhotoPutBlock_Panic
#undef Tk_PhotoPutZoomedBlock_Panic
#undef Tk_PhotoSetSize_Panic
+#undef Tk_CreateOldPhotoImageFormat
#endif /* TK_NO_DEPRECATED */
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkUnusedStubEntry
+
#endif /* _TKDECLS */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index a6e7a32..fbb7e29 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -574,7 +574,7 @@ Tk_EntryObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
}
@@ -737,7 +737,7 @@ EntryWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
@@ -1684,7 +1684,7 @@ DisplayEntry(
* Hide the selection whenever we don't have the focus, unless we
* always want to show selection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)) {
showSelection = 1;
} else {
showSelection = (entryPtr->flags & GOT_FOCUS);
@@ -1766,34 +1766,56 @@ DisplayEntry(
}
}
- /*
- * Draw the text in two pieces: first the unselected portion, then the
- * selected portion on top of it.
- */
+ if ((entryPtr->numChars == 0) && (entryPtr->placeholderChars != 0)) {
- if ((entryPtr->numChars != 0) || (entryPtr->placeholderChars == 0)) {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->leftIndex, entryPtr->numChars);
- } else {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC,
+ /*
+ * Draw the placeholder text.
+ */
+
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC,
entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY,
entryPtr->placeholderLeftIndex, entryPtr->placeholderChars);
- }
- if (showSelection && (entryPtr->state != STATE_DISABLED)
- && (entryPtr->selTextGC != entryPtr->textGC)
- && (entryPtr->selectFirst + 1 < entryPtr->selectLast + 1)) {
- int selFirst;
+ } else {
- if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
- selFirst = entryPtr->leftIndex;
- } else {
- selFirst = entryPtr->selectFirst;
- }
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- selFirst, entryPtr->selectLast);
+ if (showSelection && (entryPtr->state != STATE_DISABLED)
+ && (entryPtr->selTextGC != entryPtr->textGC)
+ && (entryPtr->selectFirst + 1 < entryPtr->selectLast + 1)) {
+
+ /*
+ * Draw the selected and unselected portions separately.
+ */
+
+ TkSizeT selFirst;
+
+ if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
+ selFirst = entryPtr->leftIndex;
+ } else {
+ selFirst = entryPtr->selectFirst;
+ }
+ if (entryPtr->leftIndex < selFirst) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, selFirst);
+ }
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ selFirst, entryPtr->selectLast);
+ if (entryPtr->selectLast < entryPtr->numChars) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->selectLast, entryPtr->numChars);
+ }
+ } else {
+
+ /*
+ * Draw the entire visible text
+ */
+
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, entryPtr->numChars);
+ }
}
if (entryPtr->type == TK_SPINBOX) {
@@ -2956,7 +2978,7 @@ EntryLostSelection(
* This is controlled by ::tk::AlwaysShowSelection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)
&& (entryPtr->selectFirst != TCL_INDEX_NONE) && entryPtr->exportSelection
&& (!Tcl_IsSafe(entryPtr->interp))) {
entryPtr->selectFirst = TCL_INDEX_NONE;
@@ -3098,7 +3120,7 @@ EntryUpdateScrollbar(
Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE);
Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
@@ -3385,17 +3407,21 @@ EntryValidateChange(
if (entryPtr->validateCmd == NULL ||
entryPtr->validate == VALIDATE_NONE) {
+ if (entryPtr->flags & VALIDATING) {
+ entryPtr->flags |= VALIDATE_ABORT;
+ }
return (varValidate ? TCL_ERROR : TCL_OK);
}
/*
- * If we're already validating, then we're hitting a loop condition Return
- * and set validate to 0 to disallow further validations and prevent
- * current validation from finishing
+ * If we're already validating, then we're hitting a loop condition. Set
+ * validate to none to disallow further validations, arrange for flags
+ * to prevent current validation from finishing, and return.
*/
if (entryPtr->flags & VALIDATING) {
entryPtr->validate = VALIDATE_NONE;
+ entryPtr->flags |= VALIDATE_ABORT;
return (varValidate ? TCL_ERROR : TCL_OK);
}
@@ -3781,7 +3807,7 @@ Tk_SpinboxObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
error:
@@ -3969,7 +3995,7 @@ SpinboxWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index bd312ad..ea7b282 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -513,9 +513,12 @@ RefreshKeyboardMappingIfNeeded(
/*
*----------------------------------------------------------------------
*
- * TkGetButtonMask --
+ * Tk_GetButtonMask --
*
- * Return the proper Button${n}Mask for the button.
+ * Return the proper Button${n}Mask for the button. Don't care about
+ * Button4 - Button7, because those are not actually buttons: Those
+ * are used for the horizontal or vertical mouse wheels. Button4Mask
+ * and higher is actually used for Button 8 and higher.
*
* Results:
* A button mask.
@@ -526,14 +529,14 @@ RefreshKeyboardMappingIfNeeded(
*----------------------------------------------------------------------
*/
-static const unsigned long buttonMasks[] = {
- 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask,
- Button6Mask, Button7Mask, Button8Mask, Button9Mask
+static const unsigned buttonMasks[] = {
+ 0, Button1Mask, Button2Mask, Button3Mask, 0, 0, 0, 0, Button4Mask, \
+ Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask
};
-unsigned long
-TkGetButtonMask(
- unsigned int button)
+unsigned
+Tk_GetButtonMask(
+ unsigned button)
{
return (button > Button9) ? 0 : buttonMasks[button];
}
@@ -691,7 +694,7 @@ Tk_CreateEventHandler(
ClientData clientData) /* Arbitrary data to pass to proc. */
{
TkEventHandler *handlerPtr;
- TkWindow *winPtr = (TkWindow *) token;
+ TkWindow *winPtr = (TkWindow *)token;
/*
* Skim through the list of existing handlers to (a) compute the overall
@@ -1040,10 +1043,9 @@ TkEventInit(void)
static int
TkXErrorHandler(
ClientData clientData, /* Pointer to flag we set. */
- XErrorEvent *errEventPtr) /* X error info. */
+ TCL_UNUSED(XErrorEvent *)) /* X error info. */
{
int *error = (int *)clientData;
- (void)errEventPtr;
*error = 1;
return 0;
@@ -1138,6 +1140,23 @@ Tk_HandleEvent(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+#if !defined(_WIN32) && !defined(MAC_OSX_TK)
+ if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) {
+ if (eventPtr->type == ButtonRelease) {
+ return;
+ } else if (eventPtr->type == ButtonPress) {
+ int but = eventPtr->xbutton.button;
+ eventPtr->type = MouseWheelEvent;
+ eventPtr->xany.send_event = -1;
+ eventPtr->xkey.keycode = (but & 1) ? -120 : 120;
+ if (but > Button5) {
+ eventPtr->xkey.state ^= ShiftMask;
+ }
+ }
+ }
+#endif
+
/*
* If the generic handler processed this event we are done and can return.
*/
@@ -2003,10 +2022,9 @@ TkDeleteThreadExitHandler(
void
TkFinalize(
- ClientData dummy) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- (void)dummy;
#if defined(_WIN32) && !defined(STATIC_BUILD)
if (!tclStubsPtr) {
@@ -2056,12 +2074,11 @@ TkFinalize(
void
TkFinalizeThread(
- ClientData dummy) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL);
diff --git a/generic/tkFileFilter.h b/generic/tkFileFilter.h
index 131e423..22db9e8 100644
--- a/generic/tkFileFilter.h
+++ b/generic/tkFileFilter.h
@@ -13,6 +13,10 @@
#ifndef _TK_FILE_FILTER
#define _TK_FILE_FILTER
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define OSType long
typedef struct GlobPattern {
@@ -75,4 +79,8 @@ MODULE_SCOPE int TkGetFileFilters(Tcl_Interp *interp,
FileFilterList *flistPtr, Tcl_Obj *valuePtr,
int isWindows);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TK_FILE_FILTER */
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 8066afd..f6afcd8 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -128,7 +128,7 @@ Tk_FocusObjCmd(
Tk_Window focusWin = (Tk_Window) TkGetFocusWin(winPtr);
if (focusWin != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(focusWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(focusWin));
}
return TCL_OK;
}
@@ -179,7 +179,7 @@ Tk_FocusObjCmd(
}
newPtr = TkGetFocusWin(newPtr);
if (newPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) newPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) newPtr));
}
break;
case 1: /* -force */
@@ -212,12 +212,12 @@ Tk_FocusObjCmd(
for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
tlFocusPtr = tlFocusPtr->nextPtr) {
if (tlFocusPtr->topLevelPtr == topLevelPtr) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
tlFocusPtr->focusWinPtr));
return TCL_OK;
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) topLevelPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) topLevelPtr));
return TCL_OK;
}
break;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 34f8921..2788b2e 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -14,8 +14,9 @@
#include "tkInt.h"
#include "tkFont.h"
#if defined(MAC_OSX_TK)
-#include "tkMacOSXInt.h"
+#include "tkMacOSXInt.h" /* Defines TK_DRAW_IN_CONTEXT */
#endif
+
/*
* The following structure is used to keep track of all the fonts that exist
* in the current application. It must be stored in the TkMainInfo for the
@@ -95,7 +96,7 @@ typedef struct TextLayout {
* layout. */
int numChunks; /* Number of chunks actually used in following
* array. */
- LayoutChunk chunks[1]; /* Array of chunks. The actual size will be
+ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be
* maxChunks. THIS FIELD MUST BE THE LAST IN
* THE STRUCTURE. */
} TextLayout;
@@ -555,7 +556,7 @@ Tk_FontObjCmd(
if (objc < 3 || n < objc) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option? ?--? ?char?");
+ "font ?-displayof window? ?-option? ?--? ?char?");
return TCL_ERROR;
}
@@ -740,7 +741,7 @@ Tk_FontObjCmd(
}
case FONT_METRICS: {
Tk_Font tkfont;
- int skip, index, i;
+ int skip, i;
const TkFontMetrics *fmPtr;
static const char *const switches[] = {
"-ascent", "-descent", "-linespace", "-fixed", NULL
@@ -752,7 +753,7 @@ Tk_FontObjCmd(
}
if ((objc < 3) || ((objc - skip) > 4)) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
+ "font ?-displayof window? ?-option?");
return TCL_ERROR;
}
tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
@@ -875,18 +876,18 @@ TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
TkFontInfo *fiPtr = (TkFontInfo *)clientData;
-#if defined(MAC_OSX_TK)
/*
* On macOS it is catastrophic to recompute all widgets while the
* [NSView drawRect] method is drawing. The best that we can do in
* that situation is to abort the recomputation and hope for the best.
+ * This is ignored on other platforms.
*/
- if (TkpAppIsDrawing()) {
+ if (TkpWillDrawWidget(NULL)) {
return;
}
-#endif
+
fiPtr->updatePending = 0;
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}
@@ -1361,11 +1362,10 @@ Tk_GetFontFromObj(
static int
SetFontFromAny(
- Tcl_Interp *dummy, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
- (void)dummy;
/*
* Free the old internalRep before setting the new one.
@@ -1968,7 +1968,7 @@ Tk_ComputeTextLayout(
int *heightPtr) /* Filled with height of string. */
{
TkFont *fontPtr = (TkFont *) tkfont;
- const char *start, *end, *special;
+ const char *start, *endp, *special;
int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight;
int baseline, height, curX, newX, maxWidth, *lineLengths;
TextLayout *layoutPtr;
@@ -2001,8 +2001,8 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = (TextLayout *)ckalloc(sizeof(TextLayout)
- + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr = (TextLayout *)ckalloc(offsetof(TextLayout, chunks)
+ + maxChunks * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
layoutPtr->numChunks = 0;
@@ -2016,12 +2016,12 @@ Tk_ComputeTextLayout(
curX = 0;
- end = Tcl_UtfAtIndex(string, numChars);
+ endp = Tcl_UtfAtIndex(string, numChars);
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
- for (start = string; start < end; ) {
+ for (start = string; start < endp; ) {
if (start >= special) {
/*
* Find the next special character in the string.
@@ -2032,7 +2032,7 @@ Tk_ComputeTextLayout(
* whitespace set.
*/
- for (special = start; special < end; special++) {
+ for (special = start; special < endp; special++) {
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*special == '\n') || (*special == '\r')) {
break;
@@ -2066,7 +2066,7 @@ Tk_ComputeTextLayout(
}
}
- if ((start == special) && (special < end)) {
+ if ((start == special) && (special < endp)) {
/*
* Handle the special character.
*
@@ -2083,7 +2083,7 @@ Tk_ComputeTextLayout(
start++;
curX = newX;
flags &= ~TK_AT_LEAST_ONE;
- if ((start < end) &&
+ if ((start < endp) &&
((wrapLength <= 0) || (newX <= wrapLength))) {
/*
* More chars can still fit on this line.
@@ -2105,7 +2105,7 @@ Tk_ComputeTextLayout(
* Consume all extra spaces at end of line.
*/
- while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */
+ while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*start == '\n') || (*start == '\r')) {
break;
@@ -2293,12 +2293,16 @@ Tk_DrawTextLayout(
int x, int y, /* Upper-left hand corner of rectangle in
* which to draw (pixels). */
int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ * from the given text item. 0 specifies the
* beginning. */
int lastChar) /* The index just after the last character to
* draw from the given text item. A number < 0
* means to draw all characters. */
{
+#if 0
+ /* Use TkDrawAngledTextLayout() implementation - testing purposes at this point */
+ TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar);
+#else
TextLayout *layoutPtr = (TextLayout *) layout;
int i, numDisplayChars, drawX;
const char *firstByte, *lastByte;
@@ -2328,8 +2332,15 @@ Tk_DrawTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
+ TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont,
+ chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+chunkPtr->x, y+chunkPtr->y);
+#else /* !TK_DRAW_IN_CONTEXT */
Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, firstByte,
lastByte - firstByte, x+chunkPtr->x+drawX, y+chunkPtr->y);
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2338,6 +2349,7 @@ Tk_DrawTextLayout(
}
chunkPtr++;
}
+#endif /* Use TkDrawAngledTextLayout() implementation */
}
void
@@ -2352,7 +2364,7 @@ TkDrawAngledTextLayout(
* which to draw (pixels). */
double angle,
int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ * from the given text item. 0 specifies the
* beginning. */
int lastChar) /* The index just after the last character to
* draw from the given text item. A number < 0
@@ -2390,6 +2402,21 @@ TkDrawAngledTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
+ dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y);
+ dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y);
+ if (angle == 0.0) {
+ TkpDrawCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ (int)(x + dx), (int)(y + dy));
+ } else {
+ TkpDrawAngledCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+dx, y+dy, angle);
+ }
+#else /* !TK_DRAW_IN_CONTEXT */
dx = cosA * (chunkPtr->x + drawX) + sinA * (chunkPtr->y);
dy = -sinA * (chunkPtr->x + drawX) + cosA * (chunkPtr->y);
if (angle == 0.0) {
@@ -2400,6 +2427,7 @@ TkDrawAngledTextLayout(
TkDrawAngledChars(display, drawable, gc, layoutPtr->tkfont,
firstByte, lastByte - firstByte, x+dx, y+dy, angle);
}
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2709,7 +2737,7 @@ Tk_CharBbox(
* index, if non-NULL. */
{
TextLayout *layoutPtr = (TextLayout *) layout;
- LayoutChunk *chunkPtr;
+ LayoutChunk *chunkPtr = layoutPtr->chunks;
int i, x = 0, w;
Tk_Font tkfont;
TkFont *fontPtr;
@@ -2719,7 +2747,6 @@ Tk_CharBbox(
return 0;
}
- chunkPtr = layoutPtr->chunks;
tkfont = layoutPtr->tkfont;
fontPtr = (TkFont *) tkfont;
@@ -3372,7 +3399,7 @@ noMapping: ;
static int
ConfigAttributesObj(
Tcl_Interp *interp, /* Interp for error return. */
- Tk_Window tkwin, /* For display on which font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[], /* Command line options. */
TkFontAttributes *faPtr) /* Font attributes structure whose fields are
@@ -3382,7 +3409,6 @@ ConfigAttributesObj(
int i, n, index;
Tcl_Obj *optionPtr, *valuePtr;
const char *value;
- (void)tkwin;
for (i = 0; i < objc; i += 2) {
optionPtr = objv[i];
@@ -3548,6 +3574,57 @@ GetAttributeInfoObj(
/*
*---------------------------------------------------------------------------
*
+ * Tk_FontGetDescription --
+ *
+ * Return information about the font description as a Tcl list. One
+ * possible result is "{{DejaVu Sans} -16 bold underline}".
+ *
+ * Results:
+ * The list of descriptions.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+Tk_FontGetDescription(
+ Tk_Font tkfont) /* Font whose description is desired. */
+{
+ const TkFontAttributes *faPtr = GetFontAttributes(tkfont);
+ Tcl_Obj *resultPtr = Tcl_NewObj();
+ const char *str;
+
+ str = faPtr->family;
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, str ? -1 : 0));
+ if (faPtr->size >= 0.0) {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5)));
+ } else {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5)));
+ }
+ if (faPtr->weight != TK_FW_NORMAL) {
+ str = TkFindStateString(weightMap, faPtr->weight);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->slant != TK_FS_ROMAN) {
+ str = TkFindStateString(slantMap, faPtr->slant);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->underline) {
+ str = TkFindStateString(underlineMap, faPtr->underline);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->overstrike) {
+ str = TkFindStateString(overstrikeMap, faPtr->overstrike);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ return resultPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* ParseFontNameObj --
*
* Converts a object into a set of font attributes that can be used to
@@ -3748,7 +3825,7 @@ NewChunk(
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
- s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
+ s = offsetof(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
diff --git a/generic/tkFont.h b/generic/tkFont.h
index 50f79d2..ceabee3 100644
--- a/generic/tkFont.h
+++ b/generic/tkFont.h
@@ -14,6 +14,10 @@
#ifndef _TKFONT
#define _TKFONT
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* The following structure keeps track of the attributes of a font. It can be
* used to keep track of either the desired attributes or the actual
@@ -221,4 +225,8 @@ MODULE_SCOPE void TkpGetFontFamilies(Tcl_Interp *interp,
Tk_Window tkwin);
MODULE_SCOPE TkFont * TkpGetNativeFont(Tk_Window tkwin, const char *name);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKFONT */
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index df370af..696d2f5 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -344,7 +344,7 @@ static void FrameBgImageProc(ClientData clientData,
static void FrameCmdDeletedProc(ClientData clientData);
static void FrameEventProc(ClientData clientData,
XEvent *eventPtr);
-static void FrameLostSlaveProc(ClientData clientData,
+static void FrameLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void FrameRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -376,7 +376,7 @@ static const Tk_ClassProcs frameClass = {
static const Tk_GeomMgr frameGeomType = {
"labelframe", /* name */
FrameRequestProc, /* requestProc */
- FrameLostSlaveProc /* lostSlaveProc */
+ FrameLostContentProc /* lostContentProc */
};
/*
@@ -732,7 +732,7 @@ CreateFrame(
if (type == TYPE_TOPLEVEL) {
Tcl_DoWhenIdle(MapFrame, framePtr);
}
- Tcl_SetObjResult(interp, TkNewWindowObj(newWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(newWin));
return TCL_OK;
error:
@@ -2016,25 +2016,25 @@ FrameRequestProc(
/*
*--------------------------------------------------------------
*
- * FrameLostSlaveProc --
+ * FrameLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all frame-related information about the slave.
+ * Forgets all frame-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-FrameLostSlaveProc(
- ClientData clientData, /* Frame structure for slave window that was
+FrameLostContentProc(
+ ClientData clientData, /* Frame structure for content window window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window window. */
{
Frame *framePtr = (Frame *)clientData;
Labelframe *labelframePtr = (Labelframe *)clientData;
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 30a57a9..cd2c2c0 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -15,29 +15,29 @@
/*
* Data structures of the following type are used by Tk_MaintainGeometry. For
- * each slave managed by Tk_MaintainGeometry, there is one of these structures
- * associated with its master.
+ * each content managed by Tk_MaintainGeometry, there is one of these structures
+ * associated with its container.
*/
-typedef struct MaintainSlave {
- Tk_Window slave; /* The slave window being positioned. */
- Tk_Window master; /* The master that determines slave's
+typedef struct MaintainContent {
+ Tk_Window content; /* The content window being positioned. */
+ Tk_Window container; /* The container that determines content's
* position; it must be a descendant of
- * slave's parent. */
- int x, y; /* Desired position of slave relative to
- * master. */
- int width, height; /* Desired dimensions of slave. */
- struct MaintainSlave *nextPtr;
+ * content's parent. */
+ int x, y; /* Desired position of content relative to
+ * container. */
+ int width, height; /* Desired dimensions of content. */
+ struct MaintainContent *nextPtr;
/* Next in list of Maintains associated with
- * master. */
-} MaintainSlave;
+ * container. */
+} MaintainContent;
/*
- * For each window that has been specified as a master to Tk_MaintainGeometry,
+ * For each window that has been specified as a content to Tk_MaintainGeometry,
* there is a structure of the following type:
*/
-typedef struct MaintainMaster {
+typedef struct MaintainContainer {
Tk_Window ancestor; /* The lowest ancestor of this window for
* which we have *not* created a
* StructureNotify handler. May be the same as
@@ -45,18 +45,18 @@ typedef struct MaintainMaster {
int checkScheduled; /* Non-zero means that there is already a call
* to MaintainCheckProc scheduled as an idle
* handler. */
- MaintainSlave *slavePtr; /* First in list of all slaves associated with
- * this master. */
-} MaintainMaster;
+ MaintainContent *contentPtr; /* First in list of all content associated with
+ * this container. */
+} MaintainContainer;
/*
* Prototypes for static procedures in this file:
*/
static void MaintainCheckProc(ClientData clientData);
-static void MaintainMasterProc(ClientData clientData,
+static void MaintainContainerProc(ClientData clientData,
XEvent *eventPtr);
-static void MaintainSlaveProc(ClientData clientData,
+static void MaintainContentProc(ClientData clientData,
XEvent *eventPtr);
/*
@@ -65,7 +65,7 @@ static void MaintainSlaveProc(ClientData clientData,
* Tk_ManageGeometry --
*
* Arrange for a particular procedure to manage the geometry of a given
- * slave window.
+ * content window.
*
* Results:
* None.
@@ -75,7 +75,7 @@ static void MaintainSlaveProc(ClientData clientData,
* previous geometry manager. The geometry manager will be notified (by
* calling procedures in *mgrPtr) when interesting things happen in the
* future. If there was an existing geometry manager for tkwin different
- * from the new one, it is notified by calling its lostSlaveProc.
+ * from the new one, it is notified by calling its lostContentProc.
*
*--------------------------------------------------------------
*/
@@ -95,8 +95,8 @@ Tk_ManageGeometry(
if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL)
&& ((winPtr->geomMgrPtr != mgrPtr)
|| (winPtr->geomData != clientData))
- && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) {
- winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin);
+ && (winPtr->geomMgrPtr->lostContentProc != NULL)) {
+ winPtr->geomMgrPtr->lostContentProc(winPtr->geomData, tkwin);
}
winPtr->geomMgrPtr = mgrPtr;
@@ -218,7 +218,7 @@ Tk_SetInternalBorderEx(
}
/*
- * All the slaves for which this is the master window must now be
+ * All the content for which this is the container window must now be
* repositioned to take account of the new internal border width. To
* signal all the geometry managers to do this, trigger a ConfigureNotify
* event. This will cause geometry managers to recompute everything.
@@ -303,78 +303,78 @@ Tk_SetMinimumRequestSize(
/*
*----------------------------------------------------------------------
*
- * TkSetGeometryMaster --
+ * TkSetGeometryContainer --
*
- * Set a geometry master for this window. Only one master may own
+ * Set a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * The geometry master is recorded for the window.
+ * The geometry container is recorded for the window.
*
*----------------------------------------------------------------------
*/
int
-TkSetGeometryMaster(
+TkSetGeometryContainer(
Tcl_Interp *interp, /* Current interpreter, for error. */
- Tk_Window tkwin, /* Window that will have geometry master
+ Tk_Window tkwin, /* Window that will have geometry container
* set. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) == 0) {
+ strcmp(winPtr->geomMgrName, name) == 0) {
return TCL_OK;
}
if (winPtr->geomMgrName != NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "cannot use geometry manager %s inside %s which already"
- " has slaves managed by %s",
- master, Tk_PathName(tkwin), winPtr->geomMgrName));
+ "cannot use geometry manager %s inside %s because"
+ " %s is already managing it's content windows",
+ name, Tk_PathName(tkwin), winPtr->geomMgrName));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL);
}
return TCL_ERROR;
}
- winPtr->geomMgrName = (char *)ckalloc(strlen(master) + 1);
- strcpy(winPtr->geomMgrName, master);
+ winPtr->geomMgrName = (char *)ckalloc(strlen(name) + 1);
+ strcpy(winPtr->geomMgrName, name);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * TkFreeGeometryMaster --
+ * TkFreeGeometryContainer --
*
- * Remove a geometry master for this window. Only one master may own
+ * Remove a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* None.
*
* Side effects:
- * The geometry master is cleared for the window.
+ * The geometry container is cleared for the window.
*
*----------------------------------------------------------------------
*/
void
-TkFreeGeometryMaster(
- Tk_Window tkwin, /* Window that will have geometry master
+TkFreeGeometryContainer(
+ Tk_Window tkwin, /* Window that will have geometry container
* cleared. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) != 0) {
+ strcmp(winPtr->geomMgrName, name) != 0) {
Tcl_Panic("Trying to free %s from geometry manager %s",
- winPtr->geomMgrName, master);
+ winPtr->geomMgrName, name);
}
if (winPtr->geomMgrName != NULL) {
ckfree(winPtr->geomMgrName);
@@ -387,12 +387,12 @@ TkFreeGeometryMaster(
*
* Tk_MaintainGeometry --
*
- * This procedure is invoked by geometry managers to handle slaves whose
- * master's are not their parents. It translates the desired geometry for
- * the slave into the coordinate system of the parent and respositions
- * the slave if it isn't already at the right place. Furthermore, it sets
- * up event handlers so that if the master (or any of its ancestors up to
- * the slave's parent) is mapped, unmapped, or moved, then the slave will
+ * This procedure is invoked by geometry managers to handle content whose
+ * container's are not their parents. It translates the desired geometry for
+ * the content into the coordinate system of the parent and respositions
+ * the content if it isn't already at the right place. Furthermore, it sets
+ * up event handlers so that if the container (or any of its ancestors up to
+ * the content's parent) is mapped, unmapped, or moved, then the content will
* be adjusted to match.
*
* Results:
@@ -400,7 +400,7 @@ TkFreeGeometryMaster(
*
* Side effects:
* Event handlers are created and state is allocated to keep track of
- * slave. Note: if slave was already managed for master by
+ * content. Note: if content was already managed for container by
* Tk_MaintainGeometry, then the previous information is replaced with
* the new information. The caller must eventually call
* Tk_UnmaintainGeometry to eliminate the correspondence (or, the state
@@ -411,40 +411,39 @@ TkFreeGeometryMaster(
void
Tk_MaintainGeometry(
- Tk_Window slave, /* Slave for geometry management. */
- Tk_Window master, /* Master for slave; must be a descendant of
- * slave's parent. */
- int x, int y, /* Desired position of slave within master. */
- int width, int height) /* Desired dimensions for slave. */
+ Tk_Window window, /* Window for geometry management. */
+ Tk_Window container, /* Container for window; must be a descendant of
+ * window's parent. */
+ int x, int y, /* Desired position of window within container. */
+ int width, int height) /* Desired dimensions for window. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr;
int isNew, map;
Tk_Window ancestor, parent;
- TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) container)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
+ ((TkWindow *)window)->maintainerPtr = (TkWindow *)container;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master, don't bother
+ * If the window is a direct descendant of the container, don't bother
* setting up the extra infrastructure for management, just make a
* call to Tk_MoveResizeWindow; the parent/child relationship will
* take care of the rest.
*/
- Tk_MoveResizeWindow(slave, x, y, width, height);
+ Tk_MoveResizeWindow(window, x, y, width, height);
/*
- * Map the slave if the master is already mapped; otherwise, wait
- * until the master is mapped later (in which case mapping the slave
+ * Map the window if the container is already mapped; otherwise, wait
+ * until the container is mapped later (in which case mapping the window
* is taken care of elsewhere).
*/
- if (Tk_IsMapped(master)) {
- Tk_MapWindow(slave);
+ if (Tk_IsMapped(container)) {
+ Tk_MapWindow(window);
}
return;
}
@@ -455,55 +454,55 @@ Tk_MaintainGeometry(
}
/*
- * See if there is already a MaintainMaster structure for the master; if
+ * See if there is already a MaintainContainer structure for the container; if
* not, then create one.
*/
- parent = Tk_Parent(slave);
+ parent = Tk_Parent(window);
hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
- (char *) master, &isNew);
+ (char *) container, &isNew);
if (!isNew) {
- masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr);
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
} else {
- masterPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster));
- masterPtr->ancestor = master;
- masterPtr->checkScheduled = 0;
- masterPtr->slavePtr = NULL;
- Tcl_SetHashValue(hPtr, masterPtr);
+ containerPtr = (MaintainContainer *)ckalloc(sizeof(MaintainContainer));
+ containerPtr->ancestor = container;
+ containerPtr->checkScheduled = 0;
+ containerPtr->contentPtr = NULL;
+ Tcl_SetHashValue(hPtr, containerPtr);
}
/*
- * Create a MaintainSlave structure for the slave if there isn't already
+ * Create a MaintainContent structure for the window if there isn't already
* one.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if (slavePtr->slave == slave) {
- goto gotSlave;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if (contentPtr->content == window) {
+ goto gotContent;
}
}
- slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave));
- slavePtr->slave = slave;
- slavePtr->master = master;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc,
- slavePtr);
+ contentPtr = (MaintainContent *)ckalloc(sizeof(MaintainContent));
+ contentPtr->content = window;
+ contentPtr->container = container;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_CreateEventHandler(window, StructureNotifyMask, MaintainContentProc,
+ contentPtr);
/*
* Make sure that there are event handlers registered for all the windows
- * between master and slave's parent (including master but not slave's
- * parent). There may already be handlers for master and some of its
- * ancestors (masterPtr->ancestor tells how many).
+ * between container and windows's parent (including container but not window's
+ * parent). There may already be handlers for container and some of its
+ * ancestors (containerPtr->ancestor tells how many).
*/
- for (ancestor = master; ancestor != parent;
+ for (ancestor = container; ancestor != parent;
ancestor = Tk_Parent(ancestor)) {
- if (ancestor == masterPtr->ancestor) {
+ if (ancestor == containerPtr->ancestor) {
Tk_CreateEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- masterPtr->ancestor = Tk_Parent(ancestor);
+ MaintainContainerProc, containerPtr);
+ containerPtr->ancestor = Tk_Parent(ancestor);
}
}
@@ -512,27 +511,27 @@ Tk_MaintainGeometry(
* if it's not currently in the right place or state.
*/
- gotSlave:
- slavePtr->x = x;
- slavePtr->y = y;
- slavePtr->width = width;
- slavePtr->height = height;
+ gotContent:
+ contentPtr->x = x;
+ contentPtr->y = y;
+ contentPtr->width = width;
+ contentPtr->height = height;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))
- || (width != Tk_Width(slavePtr->slave))
- || (height != Tk_Height(slavePtr->slave))) {
- Tk_MoveResizeWindow(slavePtr->slave, x, y, width, height);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))
+ || (width != Tk_Width(contentPtr->content))
+ || (height != Tk_Height(contentPtr->content))) {
+ Tk_MoveResizeWindow(contentPtr->content, x, y, width, height);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
@@ -547,37 +546,36 @@ Tk_MaintainGeometry(
* Tk_UnmaintainGeometry --
*
* This procedure cancels a previous Tk_MaintainGeometry call, so that
- * the relationship between slave and master is no longer maintained.
+ * the relationship between window and container is no longer maintained.
*
* Results:
* None.
*
* Side effects:
- * The slave is unmapped and state is released, so that slave won't track
- * master any more. If we weren't previously managing slave relative to
- * master, then this procedure has no effect.
+ * The window is unmapped and state is released, so that window won't track
+ * container any more. If we weren't previously managing window relative to
+ * container, then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
void
Tk_UnmaintainGeometry(
- Tk_Window slave, /* Slave for geometry management. */
- Tk_Window master) /* Master for slave; must be a descendant of
- * slave's parent. */
+ Tk_Window window, /* WIndow for geometry management. */
+ Tk_Window container) /* Container for window; must be a descendant of
+ * window's parent. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- MaintainSlave *slavePtr, *prevPtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr, *prevPtr;
Tk_Window ancestor;
- TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) window)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = NULL;
+ ((TkWindow *)window)->maintainerPtr = NULL;
- ((TkWindow *)slave)->maintainerPtr = NULL;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master,
+ * If the window is a direct descendant of the container,
* Tk_MaintainGeometry will not have set up any of the extra
* infrastructure. Don't even bother to look for it, just return.
*/
@@ -589,57 +587,57 @@ Tk_UnmaintainGeometry(
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);
}
- if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) {
- Tk_UnmapWindow(slave);
+ if (!(((TkWindow *) window)->flags & TK_ALREADY_DEAD)) {
+ Tk_UnmapWindow(window);
}
- hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, master);
+ hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, container);
if (hPtr == NULL) {
return;
}
- masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->slave == slave) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->content == window) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ;
- prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) {
- if (slavePtr == NULL) {
+ for (prevPtr = contentPtr, contentPtr = contentPtr->nextPtr; ;
+ prevPtr = contentPtr, contentPtr = contentPtr->nextPtr) {
+ if (contentPtr == NULL) {
return;
}
- if (slavePtr->slave == slave) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (contentPtr->content == window) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask,
- MaintainSlaveProc, slavePtr);
- ckfree(slavePtr);
- if (masterPtr->slavePtr == NULL) {
- if (masterPtr->ancestor != NULL) {
- for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) {
+ Tk_DeleteEventHandler(contentPtr->content, StructureNotifyMask,
+ MaintainContentProc, contentPtr);
+ ckfree(contentPtr);
+ if (containerPtr->contentPtr == NULL) {
+ if (containerPtr->ancestor != NULL) {
+ for (ancestor = container; ; ancestor = Tk_Parent(ancestor)) {
Tk_DeleteEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- if (ancestor == masterPtr->ancestor) {
+ MaintainContainerProc, containerPtr);
+ if (ancestor == containerPtr->ancestor) {
break;
}
}
}
- if (masterPtr->checkScheduled) {
- Tcl_CancelIdleCall(MaintainCheckProc, masterPtr);
+ if (containerPtr->checkScheduled) {
+ Tcl_CancelIdleCall(MaintainCheckProc, containerPtr);
}
Tcl_DeleteHashEntry(hPtr);
- ckfree(masterPtr);
+ ckfree(containerPtr);
}
}
/*
*----------------------------------------------------------------------
*
- * MaintainMasterProc --
+ * MaintainContainerProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on the master or one of its ancestors, on
+ * StructureNotify events on the container or one of its ancestors, on
* behalf of Tk_MaintainGeometry.
*
* Results:
@@ -648,43 +646,43 @@ Tk_UnmaintainGeometry(
* Side effects:
* It schedules a call to MaintainCheckProc, which will eventually caused
* the postions and mapped states to be recalculated for all the
- * maintained slaves of the master. Or, if the master window is being
+ * maintained windows of the container. Or, if the container window is being
* deleted then state is cleaned up.
*
*----------------------------------------------------------------------
*/
static void
-MaintainMasterProc(
- ClientData clientData, /* Pointer to MaintainMaster structure for the
- * master window. */
+MaintainContainerProc(
+ ClientData clientData, /* Pointer to MaintainContainer structure for the
+ * container window. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainMaster *masterPtr = (MaintainMaster *)clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
int done;
if ((eventPtr->type == ConfigureNotify)
|| (eventPtr->type == MapNotify)
|| (eventPtr->type == UnmapNotify)) {
- if (!masterPtr->checkScheduled) {
- masterPtr->checkScheduled = 1;
- Tcl_DoWhenIdle(MaintainCheckProc, masterPtr);
+ if (!containerPtr->checkScheduled) {
+ containerPtr->checkScheduled = 1;
+ Tcl_DoWhenIdle(MaintainCheckProc, containerPtr);
}
} else if (eventPtr->type == DestroyNotify) {
/*
- * Delete all of the state associated with this master, but be careful
- * not to use masterPtr after the last slave is deleted, since its
+ * Delete all of the state associated with this container, but be careful
+ * not to use containerPtr after the last window is deleted, since its
* memory will have been freed.
*/
done = 0;
do {
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->nextPtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->nextPtr == NULL) {
done = 1;
}
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
} while (!done);
}
}
@@ -692,10 +690,10 @@ MaintainMasterProc(
/*
*----------------------------------------------------------------------
*
- * MaintainSlaveProc --
+ * MaintainContentProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on a slave being managed by
+ * StructureNotify events on a window being managed by
* Tk_MaintainGeometry.
*
* Results:
@@ -703,21 +701,21 @@ MaintainMasterProc(
*
* Side effects:
* If the event is a DestroyNotify event then the Maintain state and
- * event handlers for this slave are deleted.
+ * event handlers for this window are deleted.
*
*----------------------------------------------------------------------
*/
static void
-MaintainSlaveProc(
- ClientData clientData, /* Pointer to MaintainSlave structure for
- * master-slave pair. */
+MaintainContentProc(
+ ClientData clientData, /* Pointer to MaintainContent structure for
+ * container-window pair. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainSlave *slavePtr = (MaintainSlave *)clientData;
+ MaintainContent *contentPtr = (MaintainContent *)clientData;
if (eventPtr->type == DestroyNotify) {
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
}
}
@@ -727,50 +725,50 @@ MaintainSlaveProc(
* MaintainCheckProc --
*
* This procedure is invoked by the Tk event dispatcher as an idle
- * handler, when a master or one of its ancestors has been reconfigured,
- * mapped, or unmapped. Its job is to scan all of the slaves for the
- * master and reposition them, map them, or unmap them as needed to
- * maintain their geometry relative to the master.
+ * handler, when a container or one of its ancestors has been reconfigured,
+ * mapped, or unmapped. Its job is to scan all of the windows for the
+ * container and reposition them, map them, or unmap them as needed to
+ * maintain their geometry relative to the container.
*
* Results:
* None.
*
* Side effects:
- * Slaves can get repositioned, mapped, or unmapped.
+ * Windows can get repositioned, mapped, or unmapped.
*
*----------------------------------------------------------------------
*/
static void
MaintainCheckProc(
- ClientData clientData) /* Pointer to MaintainMaster structure for the
- * master window. */
+ ClientData clientData) /* Pointer to MaintainContainer structure for the
+ * container window. */
{
- MaintainMaster *masterPtr = (MaintainMaster *)clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
Tk_Window ancestor, parent;
int x, y, map;
- masterPtr->checkScheduled = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- parent = Tk_Parent(slavePtr->slave);
- x = slavePtr->x;
- y = slavePtr->y;
+ containerPtr->checkScheduled = 0;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ parent = Tk_Parent(contentPtr->content);
+ x = contentPtr->x;
+ y = contentPtr->y;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))) {
- Tk_MoveWindow(slavePtr->slave, x, y);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))) {
+ Tk_MoveWindow(contentPtr->content, x, y);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 7ca4d17..f2aed2c 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -493,11 +493,10 @@ Tk_NameOfJustify(
static void
FreeUidThreadExitProc(
- ClientData dummy) /* Not used. */
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 012d434..db51c96 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -270,7 +270,7 @@ Tk_GrabObjCmd(
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
dispPtr->eventualGrabWinPtr));
}
} else {
@@ -279,7 +279,7 @@ Tk_GrabObjCmd(
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj(
+ Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(
(Tk_Window) dispPtr->eventualGrabWinPtr));
}
}
@@ -666,6 +666,9 @@ ReleaseButtonGrab(
* This function is called for each pointer-related event, before the
* event has been processed. It does various things to make grabs work
* correctly.
+ * Also, this function takes care of warping the mouse pointer with
+ * respect to a given window, both when there is a grab in effect and
+ * when there is none.
*
* Results:
* If the return value is 1 it means the event should be processed (event
@@ -677,6 +680,7 @@ ReleaseButtonGrab(
* Grab state information may be updated. New events may also be pushed
* back onto the event queue to replace or augment the one passed in
* here.
+ * The mouse pointer may be moved.
*
*----------------------------------------------------------------------
*/
@@ -773,10 +777,24 @@ TkPointerEvent(
return 1;
}
+ if ((eventPtr->type == MotionNotify) && !appGrabbed) {
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
+ }
+
if (!appGrabbed) {
return 1;
}
+ /*
+ * From this point on, there is a grab in effect.
+ */
+
if (eventPtr->type == MotionNotify) {
/*
* When grabs are active, X reports motion events relative to the
@@ -799,6 +817,13 @@ TkPointerEvent(
Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
return 0;
}
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
return 1;
}
@@ -871,7 +896,7 @@ TkPointerEvent(
} else {
if (eventPtr->xbutton.button != AnyButton &&
((eventPtr->xbutton.state & ALL_BUTTONS)
- == TkGetButtonMask(eventPtr->xbutton.button))) {
+ == Tk_GetButtonMask(eventPtr->xbutton.button))) {
ReleaseButtonGrab(dispPtr); /* Note 4. */
}
}
@@ -1370,12 +1395,11 @@ QueueGrabWindowChange(
static int
GrabWinEventProc(
Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */
- int flags) /* Flags argument to Tcl_DoOneEvent: indicates
+ TCL_UNUSED(int)) /* Flags argument to Tcl_DoOneEvent: indicates
* what kinds of events are being processed
* right now. */
{
NewGrabWinEvent *grabEvPtr = (NewGrabWinEvent *) evPtr;
- (void)flags;
grabEvPtr->dispPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(
grabEvPtr->dispPtr->display, grabEvPtr->grabWindow);
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 32246ae..dc4db82 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -66,7 +66,7 @@
#define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW
/*
- * Structure to hold information for grid masters. A slot is either a row or
+ * Structure to hold information for grid containers. A slot is either a row or
* column.
*/
@@ -80,7 +80,7 @@ typedef struct SlotInfo {
* inproportion to their weights. */
int pad; /* Extra padding, in pixels, required for this
* slot. This amount is "added" to the largest
- * slave in the slot. */
+ * content in the slot. */
Tk_Uid uniform; /* Value of -uniform option. It is used to
* group slots that should have the same
* size. */
@@ -99,13 +99,13 @@ typedef struct SlotInfo {
*/
typedef struct GridLayout {
- struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin
- * contains a list of all slaves whose spans
+ struct Gridder *binNextPtr; /* The next content window in this bin. Each bin
+ * contains a list of all content whose spans
* are >1 and whose right edges fall in this
* slot. */
int minSize; /* Minimum size needed for this slot, in
* pixels. This is the space required to hold
- * any slaves contained entirely in this slot,
+ * any content contained entirely in this slot,
* adjusted for any slot constrants, such as
* size or padding. */
int pad; /* Padding needed for this slot */
@@ -124,31 +124,31 @@ typedef struct GridLayout {
} GridLayout;
/*
- * Keep one of these for each geometry master.
+ * Keep one of these for each geometry container.
*/
typedef struct {
SlotInfo *columnPtr; /* Pointer to array of column constraints. */
SlotInfo *rowPtr; /* Pointer to array of row constraints. */
- int columnEnd; /* The last column occupied by any slave. */
+ int columnEnd; /* The last column occupied by any content. */
int columnMax; /* The number of columns with constraints. */
int columnSpace; /* The number of slots currently allocated for
* column constraints. */
- int rowEnd; /* The last row occupied by any slave. */
+ int rowEnd; /* The last row occupied by any content. */
int rowMax; /* The number of rows with constraints. */
int rowSpace; /* The number of slots currently allocated for
* row constraints. */
int startX; /* Pixel offset of this layout within its
- * master. */
+ * container. */
int startY; /* Pixel offset of this layout within its
- * master. */
+ * container. */
Tk_Anchor anchor; /* Value of anchor option: specifies where a
* grid without weight should be placed. */
-} GridMaster;
+} GridContainer;
/*
* For each window that the grid cares about (either because the window is
- * managed by the grid or because the window has slaves that are managed by
+ * managed by the grid or because the window has content that are managed by
* the grid), there is a structure of the following type:
*/
@@ -157,18 +157,18 @@ typedef struct Gridder {
* window has been deleted, but the gridder
* hasn't had a chance to clean up yet because
* the structure is still in use. */
- struct Gridder *masterPtr; /* Master window within which this window is
+ struct Gridder *containerPtr; /* Container window within which this window is
* managed (NULL means this window isn't
* managed by the gridder). */
- struct Gridder *nextPtr; /* Next window managed within same master.
+ struct Gridder *nextPtr; /* Next window managed within same container.
* List order doesn't matter. */
- struct Gridder *slavePtr; /* First in list of slaves managed inside this
- * window (NULL means no grid slaves). */
- GridMaster *masterDataPtr; /* Additional data for geometry master. */
- Tcl_Obj *in; /* Store master name when removed. */
+ struct Gridder *contentPtr; /* First in list of content managed inside this
+ * window (NULL means no grid content). */
+ GridContainer *containerDataPtr; /* Additional data for geometry container. */
+ Tcl_Obj *in; /* Store container name when removed. */
int column, row; /* Location in the grid (starting from
* zero). */
- int numCols, numRows; /* Number of columns or rows this slave spans.
+ int numCols, numRows; /* Number of columns or rows this content spans.
* Should be at least 1. */
int padX, padY; /* Total additional pixels to leave around the
* window. Some is of this space is on each
@@ -185,12 +185,12 @@ typedef struct Gridder {
* sticks to. See below for definitions */
int doubleBw; /* Twice the window's last known border width.
* If this changes, the window must be
- * re-arranged within its master. */
+ * re-arranged within its container. */
int *abortPtr; /* If non-NULL, it means that there is a
* nested call to ArrangeGrid already working
* on this window. *abortPtr may be set to 1
* to abort that nested call. This happens,
- * for example, if tkwin or any of its slaves
+ * for example, if tkwin or any of its content
* is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
@@ -199,9 +199,9 @@ typedef struct Gridder {
* These fields are used temporarily for layout calculations only.
*/
- struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */
+ struct Gridder *binNextPtr; /* Link to next span>1 content in this bin. */
int size; /* Nominal size (width or height) in pixels of
- * the slave. This includes the padding. */
+ * the content. This includes the padding. */
} Gridder;
/*
@@ -235,32 +235,32 @@ typedef struct UniformGroup {
* Flag values for Grid structures:
*
* REQUESTED_RELAYOUT 1 means a Tcl_DoWhenIdle request has already
- * been made to re-arrange all the slaves of this
+ * been made to re-arrange all the content of this
* window.
* DONT_PROPAGATE 1 means don't set this window's requested
- * size. 0 means if this window is a master then
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Grid has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Grid has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_RELAYOUT 1
#define DONT_PROPAGATE 2
-#define ALLOCED_MASTER 4
+#define ALLOCED_CONTAINER 4
/*
* Prototypes for procedures used only in this file:
*/
-static void AdjustForSticky(Gridder *slavePtr, int *xPtr,
+static void AdjustForSticky(Gridder *contentPtr, int *xPtr,
int *yPtr, int *widthPtr, int *heightPtr);
static int AdjustOffsets(int width, int elements,
SlotInfo *slotPtr);
static void ArrangeGrid(ClientData clientData);
-static int CheckSlotData(Gridder *masterPtr, int slot,
+static int CheckSlotData(Gridder *containerPtr, int slot,
int slotType, int checkOnly);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyGrid(void *memPtr);
static Gridder * GetGrid(Tk_Window tkwin);
@@ -284,22 +284,22 @@ static int GridRowColumnConfigureCommand(Tk_Window tkwin,
Tcl_Obj *const objv[]);
static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp,
+static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static void GridStructureProc(ClientData clientData,
XEvent *eventPtr);
-static void GridLostSlaveProc(ClientData clientData,
+static void GridLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void GridReqProc(ClientData clientData, Tk_Window tkwin);
-static void InitMasterData(Gridder *masterPtr);
+static void InitContainerData(Gridder *containerPtr);
static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt);
static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt);
static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn,
int maxOffset);
static void SetGridSize(Gridder *gridPtr);
-static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr,
int column, int numCols);
-static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentRow(Tcl_Interp *interp, Gridder *contentPtr,
int row, int numRows);
static Tcl_Obj * StickyToObj(int flags);
static int StringToSticky(const char *string);
@@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr);
static const Tk_GeomMgr gridMgrType = {
"grid", /* name */
GridReqProc, /* requestProc */
- GridLostSlaveProc, /* lostSlaveProc */
+ GridLostContentProc, /* lostContentProc */
};
/*
@@ -338,13 +338,18 @@ Tk_GridObjCmd(
Tk_Window tkwin = (Tk_Window)clientData;
static const char *const optionStrings[] = {
"anchor", "bbox", "columnconfigure", "configure",
- "forget", "info", "location", "propagate", "remove",
- "rowconfigure", "size", "slaves", NULL
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", "slaves", NULL
+ };
+ static const char *const optionStringsNoDep[] = {
+ "anchor", "bbox", "columnconfigure", "configure",
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", NULL
};
enum options {
GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
- GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE,
- GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
+ GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE,
+ GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
};
int index;
@@ -353,7 +358,7 @@ Tk_GridObjCmd(
if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) ||
(argv1[0] == REL_VERT)) {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -361,8 +366,16 @@ Tk_GridObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -372,7 +385,7 @@ Tk_GridObjCmd(
case GRID_BBOX:
return GridBboxCommand(tkwin, interp, objc, objv);
case GRID_CONFIGURE:
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case GRID_FORGET:
case GRID_REMOVE:
return GridForgetRemoveCommand(tkwin, interp, objc, objv);
@@ -385,15 +398,16 @@ Tk_GridObjCmd(
case GRID_SIZE:
return GridSizeCommand(tkwin, interp, objc, objv);
case GRID_SLAVES:
- return GridSlavesCommand(tkwin, interp, objc, objv);
+ case GRID_CONTENT:
+ return GridContentCommand(tkwin, interp, objc, objv);
/*
* Sample argument combinations:
- * grid columnconfigure <master> <index> -option
- * grid columnconfigure <master> <index> -option value -option value
- * grid rowconfigure <master> <index>
- * grid rowconfigure <master> <index> -option
- * grid rowconfigure <master> <index> -option value -option value.
+ * grid columnconfigure <container> <index> -option
+ * grid columnconfigure <container> <index> -option value -option value
+ * grid rowconfigure <container> <index>
+ * grid rowconfigure <container> <index> -option
+ * grid rowconfigure <container> <index> -option value -option value.
*/
case GRID_COLUMNCONFIGURE:
@@ -431,9 +445,9 @@ GridAnchorCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr;
Tk_Anchor old;
if (objc > 4) {
@@ -441,21 +455,21 @@ GridAnchorCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR),
-1));
return TCL_OK;
}
- InitMasterData(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ InitContainerData(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
old = gridPtr->anchor;
if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) {
return TCL_ERROR;
@@ -466,12 +480,12 @@ GridAnchorCommand(
*/
if (old != gridPtr->anchor) {
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -500,9 +514,9 @@ GridBboxCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* master grid record */
- GridMaster *gridPtr; /* pointer to grid data */
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ GridContainer *gridPtr; /* pointer to grid data */
int row, column; /* origin for bounding box */
int row2, column2; /* end of bounding box */
int endX, endY; /* last column/row in the layout */
@@ -510,14 +524,14 @@ GridBboxCommand(
int width, height; /* size of the bounding box */
if (objc!=3 && objc != 5 && objc != 7) {
- Tcl_WrongNumArgs(interp, 2, objv, "master ?column row ?column row??");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?column row ?column row??");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc >= 5) {
if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) {
@@ -539,13 +553,13 @@ GridBboxCommand(
}
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
if (gridPtr == NULL) {
Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0));
return TCL_OK;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
@@ -630,67 +644,67 @@ GridForgetRemoveCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window slave;
- Gridder *slavePtr;
+ Tk_Window content;
+ Gridder *contentPtr;
int i;
const char *string = Tcl_GetString(objv[1]);
char c = string[0];
for (i = 2; i < objc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != NULL) {
/*
* For "forget", reset all the settings to their defaults
*/
if (c == 'f') {
- slavePtr->column = -1;
- slavePtr->row = -1;
- slavePtr->numCols = 1;
- slavePtr->numRows = 1;
- slavePtr->padX = 0;
- slavePtr->padY = 0;
- slavePtr->padLeft = 0;
- slavePtr->padTop = 0;
- slavePtr->iPadX = 0;
- slavePtr->iPadY = 0;
- if (slavePtr->in != NULL) {
- Tcl_DecrRefCount(slavePtr->in);
- slavePtr->in = NULL;
+ contentPtr->column = -1;
+ contentPtr->row = -1;
+ contentPtr->numCols = 1;
+ contentPtr->numRows = 1;
+ contentPtr->padX = 0;
+ contentPtr->padY = 0;
+ contentPtr->padLeft = 0;
+ contentPtr->padTop = 0;
+ contentPtr->iPadX = 0;
+ contentPtr->iPadY = 0;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
- if (slavePtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, slavePtr);
+ contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
+ if (contentPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, contentPtr);
}
- slavePtr->flags = 0;
- slavePtr->sticky = 0;
+ contentPtr->flags = 0;
+ contentPtr->sticky = 0;
} else {
/*
- * When removing, store name of master to be able to
- * restore it later, even if the master is recreated.
+ * When removing, store name of container to be able to
+ * restore it later, even if the container is recreated.
*/
- if (slavePtr->in != NULL) {
- Tcl_DecrRefCount(slavePtr->in);
- slavePtr->in = NULL;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- if (slavePtr->masterPtr != NULL) {
- slavePtr->in = Tcl_NewStringObj(
- Tk_PathName(slavePtr->masterPtr->tkwin), -1);
- Tcl_IncrRefCount(slavePtr->in);
+ if (contentPtr->containerPtr != NULL) {
+ contentPtr->in = Tcl_NewStringObj(
+ Tk_PathName(contentPtr->containerPtr->tkwin), -1);
+ Tcl_IncrRefCount(contentPtr->in);
}
}
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
return TCL_OK;
@@ -720,40 +734,40 @@ GridInfoCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Gridder *slavePtr;
- Tk_Window slave;
+ Gridder *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_ResetResult(interp);
return TCL_OK;
}
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1),
- Tcl_NewWideIntObj(slavePtr->column));
+ Tcl_NewWideIntObj(contentPtr->column));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1),
- Tcl_NewWideIntObj(slavePtr->row));
+ Tcl_NewWideIntObj(contentPtr->row));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1),
- Tcl_NewWideIntObj(slavePtr->numCols));
+ Tcl_NewWideIntObj(contentPtr->numCols));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1),
- Tcl_NewWideIntObj(slavePtr->numRows));
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ Tcl_NewWideIntObj(contentPtr->numRows));
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1),
- StickyToObj(slavePtr->sticky));
+ StickyToObj(contentPtr->sticky));
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -782,36 +796,36 @@ GridLocationCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* Master grid record. */
- GridMaster *gridPtr; /* Pointer to grid data. */
+ Tk_Window container;
+ Gridder *containerPtr; /* Container grid record. */
+ GridContainer *gridPtr; /* Pointer to grid data. */
SlotInfo *slotPtr;
- int x, y; /* Offset in pixels, from edge of master. */
+ int x, y; /* Offset in pixels, from edge of container. */
int i, j; /* Corresponding column and row indeces. */
int endX, endY; /* End of grid. */
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv, "master x y");
+ Tcl_WrongNumArgs(interp, 2, objv, "window x y");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
- if (masterPtr->masterDataPtr == NULL) {
+ containerPtr = GetGrid(container);
+ if (containerPtr->containerDataPtr == NULL) {
Tcl_SetObjResult(interp, NewPairObj(-1, -1));
return TCL_OK;
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
/*
* Update any pending requests. This is not always the steady state value,
@@ -819,29 +833,29 @@ GridLocationCommand(
* its easy to get.
*/
- while (masterPtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, masterPtr);
- ArrangeGrid(masterPtr);
+ while (containerPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, containerPtr);
+ ArrangeGrid(containerPtr);
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
- slotPtr = masterPtr->masterDataPtr->columnPtr;
- if (x < masterPtr->masterDataPtr->startX) {
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
+ if (x < containerPtr->containerDataPtr->startX) {
i = -1;
} else {
- x -= masterPtr->masterDataPtr->startX;
+ x -= containerPtr->containerDataPtr->startX;
for (i = 0; slotPtr[i].offset < x && i < endX; i++) {
/* null body */
}
}
- slotPtr = masterPtr->masterDataPtr->rowPtr;
- if (y < masterPtr->masterDataPtr->startY) {
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
+ if (y < containerPtr->containerDataPtr->startY) {
j = -1;
} else {
- y -= masterPtr->masterDataPtr->startY;
+ y -= containerPtr->containerDataPtr->startY;
for (j = 0; slotPtr[j].offset < y && j < endY; j++) {
/* null body */
}
@@ -875,8 +889,8 @@ GridPropagateCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
int propagate, old;
if (objc > 4) {
@@ -884,13 +898,13 @@ GridPropagateCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -901,39 +915,39 @@ GridPropagateCommand(
* Only request a relayout if the propagation bit changes.
*/
- old = !(masterPtr->flags & DONT_PROPAGATE);
+ old = !(containerPtr->flags & DONT_PROPAGATE);
if (propagate != old) {
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
/*
- * Re-arrange the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Re-arrange the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -963,8 +977,8 @@ GridRowColumnConfigureCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master, slave;
- Gridder *masterPtr, *slavePtr;
+ Tk_Window container, content;
+ Gridder *containerPtr, *contentPtr;
SlotInfo *slotPtr = NULL;
int slot; /* the column or row number */
int slotType; /* COLUMN or ROW */
@@ -984,11 +998,11 @@ GridRowColumnConfigureCommand(
Tcl_Obj *listCopy;
if (((objc % 2 != 0) && (objc > 6)) || (objc < 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "master index ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window index ?-option value ...?");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
@@ -1009,7 +1023,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
first = 0;
last = 0;
@@ -1029,11 +1043,11 @@ GridRowColumnConfigureCommand(
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1);
+ ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1);
if (ok == TCL_OK) {
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1101,36 +1115,36 @@ GridRowColumnConfigureCommand(
}
for (j = 0; j < lObjc; j++) {
- int allSlaves = 0;
+ int allContent = 0;
if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) {
first = slot;
last = slot;
- slavePtr = NULL;
+ contentPtr = NULL;
} else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) {
/*
- * Make sure master is initialised.
+ * Make sure container is initialised.
*/
- InitMasterData(masterPtr);
+ InitContainerData(containerPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr == NULL) {
continue;
}
- allSlaves = 1;
- } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave)
+ allContent = 1;
+ } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &content)
== TCL_OK) {
/*
- * Is it gridded in this master?
+ * Is it gridded in this container?
*/
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != masterPtr) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != containerPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"the window \"%s\" is not managed by \"%s\"",
Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MASTER", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
@@ -1147,15 +1161,15 @@ GridRowColumnConfigureCommand(
*/
do {
- if (slavePtr != NULL) {
+ if (contentPtr != NULL) {
first = (slotType == COLUMN) ?
- slavePtr->column : slavePtr->row;
+ contentPtr->column : contentPtr->row;
last = first - 1 + ((slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows);
+ contentPtr->numCols : contentPtr->numRows);
}
for (slot = first; slot <= last; slot++) {
- ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0);
+ ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0);
if (ok != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" is out of range",
@@ -1166,8 +1180,8 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
/*
* Loop through each option value pair, setting the values as
@@ -1181,7 +1195,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
if (index == ROWCOL_MINSIZE) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1208,7 +1222,7 @@ GridRowColumnConfigureCommand(
slotPtr[slot].uniform = NULL;
}
} else if (index == ROWCOL_PAD) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1221,10 +1235,10 @@ GridRowColumnConfigureCommand(
}
}
}
- if (slavePtr != NULL) {
- slavePtr = slavePtr->nextPtr;
+ if (contentPtr != NULL) {
+ contentPtr = contentPtr->nextPtr;
}
- } while ((allSlaves == 1) && (slavePtr != NULL));
+ } while ((allContent == 1) && (contentPtr != NULL));
}
Tcl_DecrRefCount(listCopy);
@@ -1235,32 +1249,32 @@ GridRowColumnConfigureCommand(
if (slotPtr != NULL) {
if (slotType == ROW) {
- int last = masterPtr->masterDataPtr->rowMax - 1;
+ last = containerPtr->containerDataPtr->rowMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->rowMax = last+1;
+ containerPtr->containerDataPtr->rowMax = last+1;
} else {
- int last = masterPtr->masterDataPtr->columnMax - 1;
+ last = containerPtr->containerDataPtr->columnMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->columnMax = last + 1;
+ containerPtr->containerDataPtr->columnMax = last + 1;
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
return TCL_OK;
@@ -1296,23 +1310,23 @@ GridSizeCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr; /* pointer to grid data */
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr; /* pointer to grid data */
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
- if (masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ if (containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, NewPairObj(
MAX(gridPtr->columnEnd, gridPtr->columnMax),
MAX(gridPtr->rowEnd, gridPtr->rowMax)));
@@ -1325,37 +1339,37 @@ GridSizeCommand(
/*
*----------------------------------------------------------------------
*
- * GridSlavesCommand --
+ * GridContentCommand --
*
- * Implementation of the [grid slaves] subcommand. See the user
+ * Implementation of the [grid content] subcommand. See the user
* documentation for details on what it does.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Places a list of slaves of the specified window in the interpreter's
- * result field.
+ * Places a list of content windows of the specified window in the
+ * interpreter's result field.
*
*----------------------------------------------------------------------
*/
static int
-GridSlavesCommand(
+GridContentCommand(
Tk_Window tkwin, /* Main window of the application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr; /* master grid record */
- Gridder *slavePtr;
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ Gridder *contentPtr;
int i, value, index;
int row = -1, column = -1;
static const char *const optionStrings[] = {
"-column", "-row", NULL
};
- enum options { SLAVES_COLUMN, SLAVES_ROW };
+ enum options { CONTENT_COLUMN, CONTENT_ROW };
Tcl_Obj *res;
if ((objc < 3) || ((objc % 2) == 0)) {
@@ -1377,30 +1391,30 @@ GridSlavesCommand(
Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL);
return TCL_ERROR;
}
- if (index == SLAVES_COLUMN) {
+ if (index == CONTENT_COLUMN) {
column = value;
} else {
row = value;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
res = Tcl_NewListObj(0, NULL);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((column >= 0) && (slavePtr->column > column
- || slavePtr->column+slavePtr->numCols-1 < column)) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((column >= 0) && (contentPtr->column > column
+ || contentPtr->column+contentPtr->numCols-1 < column)) {
continue;
}
- if ((row >= 0) && (slavePtr->row > row ||
- slavePtr->row+slavePtr->numRows-1 < row)) {
+ if ((row >= 0) && (contentPtr->row > row ||
+ contentPtr->row+contentPtr->numRows-1 < row)) {
continue;
}
- Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin));
+ Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, res);
return TCL_OK;
@@ -1428,13 +1442,12 @@ static void
GridReqProc(
ClientData clientData, /* Grid's information about window that got
* new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
Gridder *gridPtr = (Gridder *)clientData;
- (void)tkwin;
- gridPtr = gridPtr->masterPtr;
+ gridPtr = gridPtr->containerPtr;
if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
@@ -1444,34 +1457,33 @@ GridReqProc(
/*
*----------------------------------------------------------------------
*
- * GridLostSlaveProc --
+ * GridLostContentProc --
*
* This procedure is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all grid-related information about the slave.
+ * Forgets all grid-related information about the content.
*
*----------------------------------------------------------------------
*/
static void
-GridLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+GridLostContentProc(
+ ClientData clientData, /* Grid structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- Gridder *slavePtr = (Gridder *)clientData;
- (void)tkwin;
+ Gridder *contentPtr = (Gridder *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -1645,12 +1657,12 @@ AdjustOffsets(
*
* AdjustForSticky --
*
- * This procedure adjusts the size of a slave in its cavity based on its
+ * This procedure adjusts the size of a content in its cavity based on its
* "sticky" flags.
*
* Results:
* The input x, y, width, and height are changed to represent the desired
- * coordinates of the slave.
+ * coordinates of the content.
*
* Side effects:
* None.
@@ -1660,29 +1672,29 @@ AdjustOffsets(
static void
AdjustForSticky(
- Gridder *slavePtr, /* Slave window to arrange in its cavity. */
+ Gridder *contentPtr, /* Content window to arrange in its cavity. */
int *xPtr, /* Pixel location of the left edge of the cavity. */
int *yPtr, /* Pixel location of the top edge of the cavity. */
int *widthPtr, /* Width of the cavity (in pixels). */
int *heightPtr) /* Height of the cavity (in pixels). */
{
- int diffx = 0; /* Cavity width - slave width. */
- int diffy = 0; /* Cavity hight - slave height. */
- int sticky = slavePtr->sticky;
+ int diffx = 0; /* Cavity width - content width. */
+ int diffy = 0; /* Cavity hight - content height. */
+ int sticky = contentPtr->sticky;
- *xPtr += slavePtr->padLeft;
- *widthPtr -= slavePtr->padX;
- *yPtr += slavePtr->padTop;
- *heightPtr -= slavePtr->padY;
+ *xPtr += contentPtr->padLeft;
+ *widthPtr -= contentPtr->padX;
+ *yPtr += contentPtr->padTop;
+ *heightPtr -= contentPtr->padY;
- if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) {
- diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX);
- *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX;
+ if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) {
+ diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX);
+ *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX;
}
- if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) {
- diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY);
- *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY;
+ if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) {
+ diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY);
+ *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY;
}
if (sticky&STICK_EAST && sticky&STICK_WEST) {
@@ -1713,37 +1725,37 @@ AdjustForSticky(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The content of containerPtr may get resized or moved.
*
*----------------------------------------------------------------------
*/
static void
ArrangeGrid(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- Gridder *masterPtr = (Gridder *)clientData;
- Gridder *slavePtr;
- GridMaster *slotPtr = masterPtr->masterDataPtr;
+ Gridder *containerPtr = (Gridder *)clientData;
+ Gridder *contentPtr;
+ GridContainer *slotPtr = containerPtr->containerDataPtr;
int abort;
int width, height; /* Requested size of layout, in pixels. */
int realWidth, realHeight; /* Actual size layout should take-up. */
int usedX, usedY;
- masterPtr->flags &= ~REQUESTED_RELAYOUT;
+ containerPtr->flags &= ~REQUESTED_RELAYOUT;
/*
- * If the master has no slaves anymore, then don't change the master size.
- * Otherwise there is no way to "relinquish" control over the master
+ * If the container has no content anymore, then don't change the container size.
+ * Otherwise there is no way to "relinquish" control over the container
* so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
- if (masterPtr->masterDataPtr == NULL) {
+ if (containerPtr->containerDataPtr == NULL) {
return;
}
@@ -1753,128 +1765,127 @@ ArrangeGrid(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
* Call the constraint engine to fill in the row and column offsets.
*/
- SetGridSize(masterPtr);
- width = ResolveConstraints(masterPtr, COLUMN, 0);
- height = ResolveConstraints(masterPtr, ROW, 0);
- width += Tk_InternalBorderLeft(masterPtr->tkwin) +
- Tk_InternalBorderRight(masterPtr->tkwin);
- height += Tk_InternalBorderTop(masterPtr->tkwin) +
- Tk_InternalBorderBottom(masterPtr->tkwin);
+ SetGridSize(containerPtr);
+ width = ResolveConstraints(containerPtr, COLUMN, 0);
+ height = ResolveConstraints(containerPtr, ROW, 0);
+ width += Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height += Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
- if (width < Tk_MinReqWidth(masterPtr->tkwin)) {
- width = Tk_MinReqWidth(masterPtr->tkwin);
+ if (width < Tk_MinReqWidth(containerPtr->tkwin)) {
+ width = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (height < Tk_MinReqHeight(masterPtr->tkwin)) {
- height = Tk_MinReqHeight(masterPtr->tkwin);
+ if (height < Tk_MinReqHeight(containerPtr->tkwin)) {
+ height = Tk_MinReqHeight(containerPtr->tkwin);
}
- if (((width != Tk_ReqWidth(masterPtr->tkwin))
- || (height != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, width, height);
+ if (((width != Tk_ReqWidth(containerPtr->tkwin))
+ || (height != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, width, height);
if (width>1 && height>1) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
return;
}
/*
- * If the currently requested layout size doesn't match the master's
+ * If the currently requested layout size doesn't match the container's
* window size, then adjust the slot offsets according to the weights. If
* all of the weights are zero, place the layout according to the anchor
* value.
*/
- realWidth = Tk_Width(masterPtr->tkwin) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- realHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
+ realWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ realHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->tkwin);
usedX = AdjustOffsets(realWidth,
MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr);
usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax),
slotPtr->rowPtr);
- TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin,
+ TkComputeAnchor(containerPtr->containerDataPtr->anchor, containerPtr->tkwin,
0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY);
/*
- * Now adjust the actual size of the slave to its cavity by computing the
+ * Now adjust the actual size of the content to its cavity by computing the
* cavity size, and adjusting the widget according to its stickyness.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
int x, y; /* Top left coordinate */
- int width, height; /* Slot or slave size */
- int col = slavePtr->column;
- int row = slavePtr->row;
+ int col = contentPtr->column;
+ int row = contentPtr->row;
x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0;
y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0;
- width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x;
- height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y;
+ width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x;
+ height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y;
x += slotPtr->startX;
y += slotPtr->startY;
- AdjustForSticky(slavePtr, &x, &y, &width, &height);
+ AdjustForSticky(contentPtr, &x, &y, &width, &height);
/*
* Now put the window in the proper spot. (This was taken directly
- * from tkPack.c.) If the slave is a child of the master, then do this
+ * from tkPack.c.) If the content is a child of the container, then do this
* here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
break;
}
/*
- * Don't map the slave if the master isn't mapped: wait until
- * the master gets mapped later.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y,
width, height);
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -1892,20 +1903,20 @@ ArrangeGrid(
*
* Side effects:
* The slot offsets are copied into the SlotInfo structure for the
- * geometry master.
+ * geometry container.
*
*----------------------------------------------------------------------
*/
static int
ResolveConstraints(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container for this grid. */
int slotType, /* Either ROW or COLUMN. */
int maxOffset) /* The actual maximum size of this layout in
* pixels, or 0 (not currently used). */
{
SlotInfo *slotPtr; /* Pointer to row/col constraints. */
- Gridder *slavePtr; /* List of slave windows in this grid. */
+ Gridder *contentPtr; /* List of content windows in this grid. */
int constraintCount; /* Count of rows or columns that have
* constraints. */
int slotCount; /* Last occupied row or column. */
@@ -1914,7 +1925,7 @@ ResolveConstraints(
GridLayout *layoutPtr; /* Temporary layout structure. */
int requiredSize; /* The natural size of the grid (pixels).
* This is the minimum size needed to
- * accommodate all of the slaves at their
+ * accommodate all of the content at their
* requested sizes. */
int offset; /* The pixel offset of the right edge of the
* current slot from the beginning of the
@@ -1931,7 +1942,7 @@ ResolveConstraints(
int uniformGroups; /* Number of currently used uniform groups. */
int uniformGroupsAlloced; /* Size of allocated space for uniform
* groups. */
- int weight, minSize;
+ int minSize;
int prevGrow, accWeight, grow;
/*
@@ -1942,13 +1953,13 @@ ResolveConstraints(
GridLayout layoutData[TYPICAL_SIZE + 1];
if (slotType == COLUMN) {
- constraintCount = masterPtr->masterDataPtr->columnMax;
- slotCount = masterPtr->masterDataPtr->columnEnd;
- slotPtr = masterPtr->masterDataPtr->columnPtr;
+ constraintCount = containerPtr->containerDataPtr->columnMax;
+ slotCount = containerPtr->containerDataPtr->columnEnd;
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
} else {
- constraintCount = masterPtr->masterDataPtr->rowMax;
- slotCount = masterPtr->masterDataPtr->rowEnd;
- slotPtr = masterPtr->masterDataPtr->rowPtr;
+ constraintCount = containerPtr->containerDataPtr->rowMax;
+ slotCount = containerPtr->containerDataPtr->rowEnd;
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1998,29 +2009,29 @@ ResolveConstraints(
/*
* Step 2.
- * Slaves with a span of 1 are used to determine the minimum size of each
- * slot. Slaves whose span is two or more slots don't contribute to the
+ * Content with a span of 1 are used to determine the minimum size of each
+ * slot. Content whose span is two or more slots don't contribute to the
* minimum size of each slot directly, but can cause slots to grow if
* their size exceeds the the sizes of the slots they span.
*
- * Bin all slaves whose spans are > 1 by their right edges. This allows
+ * Bin all content whose spans are > 1 by their right edges. This allows
* the computation on minimum and maximum possible layout sizes at each
- * slot boundary, without the need to re-sort the slaves.
+ * slot boundary, without the need to re-sort the content.
*/
switch (slotType) {
case COLUMN:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->column + slavePtr->numCols - 1;
-
- slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX
- + slavePtr->iPadX + slavePtr->doubleBw;
- if (slavePtr->numCols > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->column + contentPtr->numCols - 1;
+
+ contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX
+ + contentPtr->iPadX + contentPtr->doubleBw;
+ if (contentPtr->numCols > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2029,17 +2040,17 @@ ResolveConstraints(
}
break;
case ROW:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- int rightEdge = slavePtr->row + slavePtr->numRows - 1;
-
- slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY
- + slavePtr->iPadY + slavePtr->doubleBw;
- if (slavePtr->numRows > 1) {
- slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
- layoutPtr[rightEdge].binNextPtr = slavePtr;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->row + contentPtr->numRows - 1;
+
+ contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY
+ + contentPtr->iPadY + contentPtr->doubleBw;
+ if (contentPtr->numRows > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2060,6 +2071,7 @@ ResolveConstraints(
for (slot = 0; slot < gridCount; slot++) {
if (layoutPtr[slot].uniform != NULL) {
+ int weight;
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) {
break;
@@ -2112,7 +2124,7 @@ ResolveConstraints(
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group ==
layoutPtr[slot].uniform) {
- weight = layoutPtr[slot].weight;
+ int weight = layoutPtr[slot].weight;
weight = weight > 0 ? weight : 1;
layoutPtr[slot].minSize =
uniformGroupPtr[start].minSize * weight;
@@ -2130,16 +2142,16 @@ ResolveConstraints(
/*
* Step 3.
* Determine the minimum slot offsets going from left to right that would
- * fit all of the slaves. This determines the minimum
+ * fit all of the content. This determines the minimum
*/
for (offset=0,slot=0; slot < gridCount; slot++) {
layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset;
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int required = slavePtr->size + layoutPtr[slot - span].minOffset;
+ contentPtr->numCols : contentPtr->numRows;
+ int required = contentPtr->size + layoutPtr[slot - span].minOffset;
if (required > layoutPtr[slot].minOffset) {
layoutPtr[slot].minOffset = required;
@@ -2150,7 +2162,7 @@ ResolveConstraints(
/*
* At this point, we know the minimum required size of the entire layout.
- * It might be prudent to stop here if our "master" will resize itself to
+ * It might be prudent to stop here if our "container" will resize itself to
* this size.
*/
@@ -2171,11 +2183,11 @@ ResolveConstraints(
layoutPtr[slot].maxOffset = offset;
}
for (slot=gridCount-1; slot > 0;) {
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int require = offset - slavePtr->size;
+ contentPtr->numCols : contentPtr->numRows;
+ int require = offset - contentPtr->size;
int startSlot = slot - span;
if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) {
@@ -2385,7 +2397,7 @@ ResolveConstraints(
/*
* Step 6.
* All of the space has been apportioned; copy the layout information back
- * into the master.
+ * into the container.
*/
for (slot=0; slot < gridCount; slot++) {
@@ -2444,10 +2456,10 @@ GetGrid(
}
gridPtr = (Gridder *)ckalloc(sizeof(Gridder));
gridPtr->tkwin = tkwin;
- gridPtr->masterPtr = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
gridPtr->nextPtr = NULL;
- gridPtr->slavePtr = NULL;
+ gridPtr->contentPtr = NULL;
gridPtr->binNextPtr = NULL;
gridPtr->column = -1;
@@ -2467,7 +2479,7 @@ GetGrid(
gridPtr->sticky = 0;
gridPtr->size = 0;
gridPtr->in = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
GridStructureProc, gridPtr);
@@ -2479,13 +2491,13 @@ GetGrid(
*
* SetGridSize --
*
- * This internal procedure sets the size of the grid occupied by slaves.
+ * This internal procedure sets the size of the grid occupied by content.
*
* Results:
* None
*
* Side effects:
- * The width and height arguments are filled in the master data
+ * The width and height arguments are filled in the container data
* structure. Additional space is allocated for the constraints to
* accommodate the offsets.
*
@@ -2494,50 +2506,50 @@ GetGrid(
static void
SetGridSize(
- Gridder *masterPtr) /* The geometry master for this grid. */
+ Gridder *containerPtr) /* The geometry container for this grid. */
{
- Gridder *slavePtr; /* Current slave window. */
+ Gridder *contentPtr; /* Current content window. */
int maxX = 0, maxY = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- maxX = MAX(maxX, slavePtr->numCols + slavePtr->column);
- maxY = MAX(maxY, slavePtr->numRows + slavePtr->row);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ maxX = MAX(maxX, contentPtr->numCols + contentPtr->column);
+ maxY = MAX(maxY, contentPtr->numRows + contentPtr->row);
}
- masterPtr->masterDataPtr->columnEnd = maxX;
- masterPtr->masterDataPtr->rowEnd = maxY;
- CheckSlotData(masterPtr, maxX, COLUMN, CHECK_SPACE);
- CheckSlotData(masterPtr, maxY, ROW, CHECK_SPACE);
+ containerPtr->containerDataPtr->columnEnd = maxX;
+ containerPtr->containerDataPtr->rowEnd = maxY;
+ CheckSlotData(containerPtr, maxX, COLUMN, CHECK_SPACE);
+ CheckSlotData(containerPtr, maxY, ROW, CHECK_SPACE);
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveColumn --
+ * SetContentColumn --
*
- * Update column data for a slave, checking that MAX_ELEMENT bound
+ * Update column data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveColumn(
+SetContentColumn(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content to be updated. */
int column, /* New column or -1 to be unchanged. */
int numCols) /* New columnspan or -1 to be unchanged. */
{
int newColumn, newNumCols, lastCol;
- newColumn = (column >= 0) ? column : slavePtr->column;
- newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols;
+ newColumn = (column >= 0) ? column : contentPtr->column;
+ newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols;
lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols;
if (lastCol >= MAX_ELEMENT) {
@@ -2546,39 +2558,39 @@ SetSlaveColumn(
return TCL_ERROR;
}
- slavePtr->column = newColumn;
- slavePtr->numCols = newNumCols;
+ contentPtr->column = newColumn;
+ contentPtr->numCols = newNumCols;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveRow --
+ * SetContentRow --
*
- * Update row data for a slave, checking that MAX_ELEMENT bound
+ * Update row data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveRow(
+SetContentRow(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content to be updated. */
int row, /* New row or -1 to be unchanged. */
int numRows) /* New rowspan or -1 to be unchanged. */
{
int newRow, newNumRows, lastRow;
- newRow = (row >= 0) ? row : slavePtr->row;
- newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows;
+ newRow = (row >= 0) ? row : contentPtr->row;
+ newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows;
lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows;
if (lastRow >= MAX_ELEMENT) {
@@ -2587,8 +2599,8 @@ SetSlaveRow(
return TCL_ERROR;
}
- slavePtr->row = newRow;
- slavePtr->numRows = newNumRows;
+ contentPtr->row = newRow;
+ contentPtr->numRows = newNumRows;
return TCL_OK;
}
@@ -2604,7 +2616,7 @@ SetSlaveRow(
* TRUE if the index is OK, False otherwise.
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container grid structure may be created. If so, then it is
* initialized. In addition, additional storage for a row or column
* constraints may be allocated, and the constraint maximums are
* adjusted.
@@ -2614,7 +2626,7 @@ SetSlaveRow(
static int
CheckSlotData(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container for this grid. */
int slot, /* Which slot to look at. */
int slotType, /* ROW or COLUMN. */
int checkOnly) /* Don't allocate new space if true. */
@@ -2630,7 +2642,7 @@ CheckSlotData(
return TCL_ERROR;
}
- if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) {
+ if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) {
return TCL_ERROR;
}
@@ -2640,39 +2652,39 @@ CheckSlotData(
* of the offsets as well.
*/
- InitMasterData(masterPtr);
- end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax :
- masterPtr->masterDataPtr->columnMax;
+ InitContainerData(containerPtr);
+ end = (slotType == ROW) ? containerPtr->containerDataPtr->rowMax :
+ containerPtr->containerDataPtr->columnMax;
if (checkOnly == CHECK_ONLY) {
return ((end < slot) ? TCL_ERROR : TCL_OK);
} else {
- numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace
- : masterPtr->masterDataPtr->columnSpace;
+ numSlot = (slotType == ROW) ? containerPtr->containerDataPtr->rowSpace
+ : containerPtr->containerDataPtr->columnSpace;
if (slot >= numSlot) {
int newNumSlot = slot + PREALLOC;
size_t oldSize = numSlot * sizeof(SlotInfo);
size_t newSize = newNumSlot * sizeof(SlotInfo);
SlotInfo *newSI = (SlotInfo *)ckalloc(newSize);
SlotInfo *oldSI = (slotType == ROW)
- ? masterPtr->masterDataPtr->rowPtr
- : masterPtr->masterDataPtr->columnPtr;
+ ? containerPtr->containerDataPtr->rowPtr
+ : containerPtr->containerDataPtr->columnPtr;
memcpy(newSI, oldSI, oldSize);
memset(newSI+numSlot, 0, newSize - oldSize);
ckfree(oldSI);
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowPtr = newSI;
- masterPtr->masterDataPtr->rowSpace = newNumSlot;
+ containerPtr->containerDataPtr->rowPtr = newSI;
+ containerPtr->containerDataPtr->rowSpace = newNumSlot;
} else {
- masterPtr->masterDataPtr->columnPtr = newSI;
- masterPtr->masterDataPtr->columnSpace = newNumSlot;
+ containerPtr->containerDataPtr->columnPtr = newSI;
+ containerPtr->containerDataPtr->columnSpace = newNumSlot;
}
}
if (slot >= end && checkOnly != CHECK_SPACE) {
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowMax = slot+1;
+ containerPtr->containerDataPtr->rowMax = slot+1;
} else {
- masterPtr->masterDataPtr->columnMax = slot+1;
+ containerPtr->containerDataPtr->columnMax = slot+1;
}
}
return TCL_OK;
@@ -2682,28 +2694,28 @@ CheckSlotData(
/*
*----------------------------------------------------------------------
*
- * InitMasterData --
+ * InitContainerData --
*
* This internal procedure is used to allocate and initialize the data
- * for a geometry master, if the data doesn't exist already.
+ * for a geometry container, if the data doesn't exist already.
*
* Results:
* none
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container grid structure may be created. If so, then it is
* initialized.
*
*----------------------------------------------------------------------
*/
static void
-InitMasterData(
- Gridder *masterPtr)
+InitContainerData(
+ Gridder *containerPtr)
{
- if (masterPtr->masterDataPtr == NULL) {
- GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *)
- ckalloc(sizeof(GridMaster));
+ if (containerPtr->containerDataPtr == NULL) {
+ GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *)
+ ckalloc(sizeof(GridContainer));
size_t size = sizeof(SlotInfo) * TYPICAL_SIZE;
gridPtr->columnEnd = 0;
@@ -2728,13 +2740,13 @@ InitMasterData(
*
* Unlink --
*
- * Remove a grid from its master's list of slaves.
+ * Remove a grid from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for re-arranging, and the size of the
+ * The container will be scheduled for re-arranging, and the size of the
* grid will be adjusted accordingly
*
*----------------------------------------------------------------------
@@ -2742,51 +2754,51 @@ InitMasterData(
static void
Unlink(
- Gridder *slavePtr) /* Window to unlink. */
+ Gridder *contentPtr) /* Window to unlink. */
{
- Gridder *masterPtr, *slavePtr2;
+ Gridder *containerPtr, *contentPtr2;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) {
- if (slavePtr2 == NULL) {
+ for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) {
+ if (contentPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
- if (slavePtr2->nextPtr == slavePtr) {
- slavePtr2->nextPtr = slavePtr->nextPtr;
+ if (contentPtr2->nextPtr == contentPtr) {
+ contentPtr2->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- SetGridSize(slavePtr->masterPtr);
- slavePtr->masterPtr = NULL;
+ SetGridSize(contentPtr->containerPtr);
+ contentPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -2798,7 +2810,7 @@ Unlink(
* This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
* clean up the internal structure of a grid at a safe time (when no-one
* is using it anymore). Cleaning up the grid involves freeing the main
- * structure for all windows and the master structure for geometry
+ * structure for all windows and the container structure for geometry
* managers.
*
* Results:
@@ -2816,14 +2828,14 @@ DestroyGrid(
{
Gridder *gridPtr = (Gridder *)memPtr;
- if (gridPtr->masterDataPtr != NULL) {
- if (gridPtr->masterDataPtr->rowPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> rowPtr);
+ if (gridPtr->containerDataPtr != NULL) {
+ if (gridPtr->containerDataPtr->rowPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> rowPtr);
}
- if (gridPtr->masterDataPtr->columnPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> columnPtr);
+ if (gridPtr->containerDataPtr->columnPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> columnPtr);
}
- ckfree(gridPtr->masterDataPtr);
+ ckfree(gridPtr->containerDataPtr);
}
if (gridPtr->in != NULL) {
Tcl_DecrRefCount(gridPtr->in);
@@ -2844,7 +2856,7 @@ DestroyGrid(
*
* Side effects:
* If a window was just deleted, clean up all its grid-related
- * information. If it was just resized, re-configure its slaves, if any.
+ * information. If it was just resized, re-configure its content, if any.
*
*----------------------------------------------------------------------
*/
@@ -2859,32 +2871,32 @@ GridStructureProc(
TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr;
if (eventPtr->type == ConfigureNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
- if ((gridPtr->masterPtr != NULL) &&
+ if ((gridPtr->containerPtr != NULL) &&
(gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) {
- if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
+ if (!(gridPtr->containerPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width;
- gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr);
+ gridPtr->containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- Gridder *slavePtr, *nextPtr;
+ Gridder *contentPtr, *nextPtr;
- if (gridPtr->masterPtr != NULL) {
+ if (gridPtr->containerPtr != NULL) {
Unlink(gridPtr);
}
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable,
gridPtr->tkwin));
@@ -2894,17 +2906,17 @@ GridStructureProc(
gridPtr->tkwin = NULL;
Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid);
} else if (eventPtr->type == MapNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
} else if (eventPtr->type == UnmapNotify) {
- Gridder *slavePtr;
+ Gridder *contentPtr;
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
}
@@ -2912,11 +2924,11 @@ GridStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* This implements the guts of the "grid configure" command. Given a list
- * of slaves and configuration options, it arranges for the grid to
- * manage the slaves and sets the specified options. Arguments consist
+ * of content and configuration options, it arranges for the grid to
+ * manage the content and sets the specified options. Arguments consist
* of windows or window shortcuts followed by "-option value" pairs.
*
* Results:
@@ -2924,26 +2936,26 @@ GridStructureProc(
* and the interp's result is set to contain an error message.
*
* Side effects:
- * Slave windows get taken over by the grid.
+ * Content windows get taken over by the grid.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content names. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
{
- Gridder *masterPtr = NULL;
- Gridder *slavePtr;
- Tk_Window other, slave, parent, ancestor;
- TkWindow *master;
+ Gridder *containerPtr = NULL;
+ Gridder *contentPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, tmp;
int numWindows;
int width;
@@ -2979,34 +2991,34 @@ ConfigureSlaves(
if (firstChar == '.') {
/*
- * Check that windows are valid, and locate the first slave's
+ * Check that windows are valid, and locate the first content's
* parent window (default for -in).
*/
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
/*
- * Is there any saved -in from a removed slave?
+ * Is there any saved -in from a removed content?
* If there is, it becomes default for -in.
- * If the stored master does not exist, just ignore it.
+ * If the stored container does not exist, just ignore it.
*/
- struct Gridder *slavePtr = GetGrid(slave);
- if (slavePtr->in != NULL) {
- if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent)
+ contentPtr = GetGrid(content);
+ if (contentPtr->in != NULL) {
+ if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent)
== TCL_OK) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
}
- if (masterPtr == NULL) {
- parent = Tk_Parent(slave);
+ if (containerPtr == NULL) {
+ parent = Tk_Parent(content);
if (parent != NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
numWindows++;
@@ -3074,8 +3086,8 @@ ConfigureSlaves(
TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
} else if (index == CONF_ROW) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
|| tmp < 0) {
@@ -3091,23 +3103,23 @@ ConfigureSlaves(
/*
* If no -row is given, use the next row after the highest occupied row
- * of the master.
+ * of the container.
*/
if (defaultRow < 0) {
- if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- defaultRow = masterPtr->masterDataPtr->rowEnd;
+ if (containerPtr != NULL && containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ defaultRow = containerPtr->containerDataPtr->rowEnd;
} else {
defaultRow = 0;
}
}
/*
- * Iterate over all of the slave windows and short-cuts, parsing options
- * for each slave. It's a bit wasteful to re-parse the options for each
- * slave, but things get too messy if we try to parse the arguments just
- * once at the beginning. For example, if a slave already is managed we
+ * Iterate over all of the content windows and short-cuts, parsing options
+ * for each content. It's a bit wasteful to re-parse the options for each
+ * content, but things get too messy if we try to parse the arguments just
+ * once at the beginning. For example, if a content already is managed we
* want to just change a few existing values without resetting everything.
* If there are multiple windows, the -in option only gets processed for
* the first window.
@@ -3120,7 +3132,7 @@ ConfigureSlaves(
/*
* '^' and 'x' cause us to skip a column. '-' is processed as part of
- * its preceeding slave.
+ * its preceeding content.
*/
if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) {
@@ -3133,34 +3145,34 @@ ConfigureSlaves(
for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows;
defaultColumnSpan++) {
- const char *string = Tcl_GetString(objv[j + defaultColumnSpan]);
+ string = Tcl_GetString(objv[j + defaultColumnSpan]);
if (*string != REL_HORIZ) {
break;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't manage \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
+ contentPtr = GetGrid(content);
/*
* The following statement is taken from tkPack.c:
*
- * "If the slave isn't currently managed, reset all of its
+ * "If the content isn't currently managed, reset all of its
* configuration information to default values (there could be old
* values left from a previous packer)."
*
- * I [D.S.] disagree with this statement. If a slave is disabled
+ * I [D.S.] disagree with this statement. If a content is disabled
* (using "forget") and then re-enabled, I submit that 90% of the time
* the programmer will want it to retain its old configuration
* information. If the programmer doesn't want this behavior, then the
@@ -3181,7 +3193,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3194,7 +3206,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3203,15 +3215,15 @@ ConfigureSlaves(
&other) != TCL_OK) {
return TCL_ERROR;
}
- if (other == slave) {
+ if (other == content) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"window can't be managed in itself", -1));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
positionGiven = 1;
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
break;
case CONF_STICKY: {
int sticky = StringToSticky(Tcl_GetString(objv[i+1]));
@@ -3224,11 +3236,11 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL);
return TCL_ERROR;
}
- slavePtr->sticky = sticky;
+ contentPtr->sticky = sticky;
break;
}
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen distance",
@@ -3236,10 +3248,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen distance",
@@ -3247,17 +3259,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3270,7 +3282,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3283,7 +3295,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3291,12 +3303,12 @@ ConfigureSlaves(
}
/*
- * If no position was specified via -in and the slave is already
+ * If no position was specified via -in and the content is already
* packed, then leave it in its current location.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
@@ -3305,54 +3317,54 @@ ConfigureSlaves(
* its current location.
*/
- if (positionGiven && (masterPtr == slavePtr->masterPtr)) {
+ if (positionGiven && (containerPtr == contentPtr->containerPtr)) {
goto scheduleLayout;
}
/*
- * Make sure we have a geometry master. We look at:
+ * Make sure we have a geometry container. We look at:
* 1) the -in flag
- * 2) the parent of the first slave.
+ * 2) the parent of the first content.
*/
- parent = Tk_Parent(slave);
- if (masterPtr == NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ parent = Tk_Parent(content);
+ if (containerPtr == NULL) {
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
- if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) {
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) {
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- slavePtr->masterPtr = NULL;
+ Unlink(contentPtr);
+ contentPtr->containerPtr = NULL;
}
- if (slavePtr->masterPtr == NULL) {
- Gridder *tempPtr = masterPtr->slavePtr;
+ if (contentPtr->containerPtr == NULL) {
+ Gridder *tempPtr = containerPtr->contentPtr;
- slavePtr->masterPtr = masterPtr;
- masterPtr->slavePtr = slavePtr;
- slavePtr->nextPtr = tempPtr;
+ contentPtr->containerPtr = containerPtr;
+ containerPtr->contentPtr = contentPtr;
+ contentPtr->nextPtr = tempPtr;
}
/*
- * Make sure that the slave's parent is either the master or an
- * ancestor of the master, and that the master and slave aren't the
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
@@ -3361,65 +3373,65 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
- Tk_ManageGeometry(slave, &gridMgrType, slavePtr);
+ Tk_ManageGeometry(content, &gridMgrType, contentPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
* Assign default position information.
*/
- if (slavePtr->column == -1) {
- if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){
+ if (contentPtr->column == -1) {
+ if (SetContentColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){
return TCL_ERROR;
}
}
- if (SetSlaveColumn(interp, slavePtr, -1,
- slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1,
+ contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
return TCL_ERROR;
}
- if (slavePtr->row == -1) {
- if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) {
+ if (contentPtr->row == -1) {
+ if (SetContentRow(interp, contentPtr, defaultRow, -1) != TCL_OK) {
return TCL_ERROR;
}
}
- defaultColumn += slavePtr->numCols;
+ defaultColumn += contentPtr->numCols;
defaultColumnSpan = 1;
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
@@ -3435,9 +3447,9 @@ ConfigureSlaves(
int lastRow, lastColumn; /* Implied end of table. */
string = Tcl_GetString(objv[j]);
- firstChar = string[0];
+ firstChar = string[0];
- if (firstChar == '.') {
+ if (firstChar == '.') {
lastWindow = string;
numSkip = 0;
}
@@ -3448,9 +3460,9 @@ ConfigureSlaves(
continue;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't use '^', cant find master", -1));
+ "can't use '^', can't find container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
@@ -3460,7 +3472,7 @@ ConfigureSlaves(
*/
for (width = 1; width + j < numWindows; width++) {
- const char *string = Tcl_GetString(objv[j+width]);
+ string = Tcl_GetString(objv[j+width]);
if (*string != REL_VERT) {
break;
@@ -3484,19 +3496,19 @@ ConfigureSlaves(
lastColumn += numSkip;
match = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
-
- if (slavePtr->column == lastColumn
- && slavePtr->row + slavePtr->numRows - 1 == lastRow) {
- if (slavePtr->numCols <= width) {
- if (SetSlaveRow(interp, slavePtr, -1,
- slavePtr->numRows + 1) != TCL_OK) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+
+ if (contentPtr->column == lastColumn
+ && contentPtr->row + contentPtr->numRows - 1 == lastRow) {
+ if (contentPtr->numCols <= width) {
+ if (SetContentRow(interp, contentPtr, -1,
+ contentPtr->numRows + 1) != TCL_OK) {
return TCL_ERROR;
}
match++;
- j += slavePtr->numCols - 1;
- lastWindow = Tk_PathName(slavePtr->tkwin);
+ j += contentPtr->numCols - 1;
+ lastWindow = Tk_PathName(contentPtr->tkwin);
numSkip = 0;
break;
}
@@ -3504,32 +3516,32 @@ ConfigureSlaves(
}
if (!match) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't find slave to extend with \"^\"", -1));
+ "can't find content to extend with \"^\"", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't determine master window", -1));
+ "can't determine container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
return TCL_OK;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 1874d38..97d0702 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -26,8 +26,8 @@ typedef struct Image {
Display *display; /* Display for tkwin. Needed because when the
* image is eventually freed tkwin may not
* exist anymore. */
- struct ImageMaster *masterPtr;
- /* Master for this image (identifiers image
+ struct ImageModel *modelPtr;
+ /* Model for this image (identifiers image
* manager, for example). */
ClientData instanceData; /* One word argument to pass to image manager
* when dealing with this image instance. */
@@ -40,17 +40,17 @@ typedef struct Image {
} Image;
/*
- * For each image master there is one of the following structures, which
+ * For each image model there is one of the following structures, which
* represents a name in the image table and all of the images instantiated
* from it. Entries in mainPtr->imageTable point to these structures.
*/
-typedef struct ImageMaster {
+typedef struct ImageModel {
Tk_ImageType *typePtr; /* Information about image type. NULL means
* that no image manager owns this image: the
* image was deleted. */
- ClientData masterData; /* One-word argument to pass to image mgr when
- * dealing with the master, as opposed to
+ ClientData modelData; /* One-word argument to pass to image mgr when
+ * dealing with the model, as opposed to
* instances. */
int width, height; /* Last known dimensions for image. */
Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the
@@ -64,7 +64,7 @@ typedef struct ImageMaster {
int deleted; /* Flag set when image is being deleted. */
TkWindow *winPtr; /* Main window of interpreter (used to detect
* when the world is falling apart.) */
-} ImageMaster;
+} ImageModel;
typedef struct {
Tk_ImageType *imageTypeList;/* First in a list of all known image
@@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey;
*/
static void ImageTypeThreadExitProc(ClientData clientData);
-static void DeleteImage(ImageMaster *masterPtr);
-static void EventuallyDeleteImage(ImageMaster *masterPtr,
+static void DeleteImage(ImageModel *modelPtr);
+static void EventuallyDeleteImage(ImageModel *modelPtr,
int forgetImageHashNow);
/*
@@ -104,12 +104,11 @@ static void EventuallyDeleteImage(ImageMaster *masterPtr,
static void
ImageTypeThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *))
{
Tk_ImageType *freePtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
while (tsdPtr->oldImageTypeList != NULL) {
freePtr = tsdPtr->oldImageTypeList;
@@ -219,7 +218,7 @@ Tk_ImageObjCmd(
TkWindow *winPtr = (TkWindow *)clientData;
int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -298,7 +297,7 @@ Tk_ImageObjCmd(
/*
* Need to check if the _command_ that we are about to create is
- * the name of the current master widget command (normally "." but
+ * the name of the current model widget command (normally "." but
* could have been renamed) and fail in that case before a really
* nasty and hard to stop crash happens.
*/
@@ -319,37 +318,37 @@ Tk_ImageObjCmd(
hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew);
if (isNew) {
- masterPtr = (ImageMaster *)ckalloc(sizeof(ImageMaster));
- masterPtr->typePtr = NULL;
- masterPtr->masterData = NULL;
- masterPtr->width = masterPtr->height = 1;
- masterPtr->tablePtr = &winPtr->mainPtr->imageTable;
- masterPtr->hPtr = hPtr;
- masterPtr->instancePtr = NULL;
- masterPtr->deleted = 0;
- masterPtr->winPtr = winPtr->mainPtr->winPtr;
- Tcl_Preserve(masterPtr->winPtr);
- Tcl_SetHashValue(hPtr, masterPtr);
+ modelPtr = (ImageModel *)ckalloc(sizeof(ImageModel));
+ modelPtr->typePtr = NULL;
+ modelPtr->modelData = NULL;
+ modelPtr->width = modelPtr->height = 1;
+ modelPtr->tablePtr = &winPtr->mainPtr->imageTable;
+ modelPtr->hPtr = hPtr;
+ modelPtr->instancePtr = NULL;
+ modelPtr->deleted = 0;
+ modelPtr->winPtr = winPtr->mainPtr->winPtr;
+ Tcl_Preserve(modelPtr->winPtr);
+ Tcl_SetHashValue(hPtr, modelPtr);
} else {
/*
* An image already exists by this name. Disconnect the instances
- * from the master.
+ * from the model.
*/
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr != NULL) {
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height,
- masterPtr->width, masterPtr->height);
+ modelPtr->width, modelPtr->height,
+ modelPtr->width, modelPtr->height);
}
- masterPtr->typePtr->deleteProc(masterPtr->masterData);
- masterPtr->typePtr = NULL;
+ modelPtr->typePtr->deleteProc(modelPtr->modelData);
+ modelPtr->typePtr = NULL;
}
- masterPtr->deleted = 0;
+ modelPtr->deleted = 0;
}
/*
@@ -362,33 +361,31 @@ Tk_ImageObjCmd(
objc -= firstOption;
args = (Tcl_Obj **) objv;
if (oldimage) {
- int i;
-
args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *));
for (i = 0; i < objc; i++) {
args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
}
args[objc] = NULL;
}
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(modelPtr);
if (typePtr->createProc(interp, name, objc, args, typePtr,
- (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){
- EventuallyDeleteImage(masterPtr, 0);
- Tcl_Release(masterPtr);
+ (Tk_ImageModel)modelPtr, &modelPtr->modelData) != TCL_OK){
+ EventuallyDeleteImage(modelPtr, 0);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
return TCL_ERROR;
}
- Tcl_Release(masterPtr);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
- masterPtr->typePtr = typePtr;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->typePtr = typePtr;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin,
- masterPtr->masterData);
+ modelPtr->modelData);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
(const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
@@ -401,11 +398,11 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
- DeleteImage(masterPtr);
+ DeleteImage(modelPtr);
}
break;
case IMAGE_NAMES:
@@ -416,8 +413,8 @@ Tk_ImageObjCmd(
hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
resultObj = Tcl_NewObj();
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
continue;
}
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
@@ -450,7 +447,7 @@ Tk_ImageObjCmd(
case IMAGE_WIDTH:
/*
* These operations all parse virtually identically. First check to
- * see if three args are given. Then get a non-deleted master from the
+ * see if three args are given. Then get a non-deleted model from the
* third arg.
*/
@@ -464,8 +461,8 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
@@ -475,20 +472,20 @@ Tk_ImageObjCmd(
switch ((enum options) index) {
case IMAGE_HEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->height));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->height));
break;
case IMAGE_INUSE:
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- masterPtr->typePtr && masterPtr->instancePtr));
+ modelPtr->typePtr && modelPtr->instancePtr));
break;
case IMAGE_TYPE:
- if (masterPtr->typePtr != NULL) {
+ if (modelPtr->typePtr != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(masterPtr->typePtr->name, -1));
+ Tcl_NewStringObj(modelPtr->typePtr->name, -1));
}
break;
case IMAGE_WIDTH:
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->width));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->width));
break;
default:
Tcl_Panic("can't happen");
@@ -524,7 +521,7 @@ Tk_ImageObjCmd(
void
Tk_ImageChanged(
- Tk_ImageMaster imageMaster, /* Image that needs redisplay. */
+ Tk_ImageModel imageModel, /* Image that needs redisplay. */
int x, int y, /* Coordinates of upper-left pixel of region
* of image that needs to be redrawn. */
int width, int height, /* Dimensions (in pixels) of region of image
@@ -535,12 +532,12 @@ Tk_ImageChanged(
int imageWidth, int imageHeight)
/* New dimensions of image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
Image *imagePtr;
- masterPtr->width = imageWidth;
- masterPtr->height = imageHeight;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->width = imageWidth;
+ modelPtr->height = imageHeight;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height,
imageWidth, imageHeight);
@@ -552,11 +549,11 @@ Tk_ImageChanged(
*
* Tk_NameOfImage --
*
- * Given a token for an image master, this function returns the name of
+ * Given a token for an image model, this function returns the name of
* the image.
*
* Results:
- * The return value is the string name for imageMaster.
+ * The return value is the string name for imageModel.
*
* Side effects:
* None.
@@ -566,14 +563,14 @@ Tk_ImageChanged(
const char *
Tk_NameOfImage(
- Tk_ImageMaster imageMaster) /* Token for image. */
+ Tk_ImageModel imageModel) /* Token for image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
- if (masterPtr->hPtr == NULL) {
+ if (modelPtr->hPtr == NULL) {
return NULL;
}
- return (const char *)Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr);
+ return (const char *)Tcl_GetHashKey(modelPtr->tablePtr, modelPtr->hPtr);
}
/*
@@ -611,30 +608,30 @@ Tk_GetImage(
ClientData clientData) /* One-word argument to pass to damageProc. */
{
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name);
if (hPtr == NULL) {
goto noSuchImage;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr == NULL) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr == NULL) {
goto noSuchImage;
}
- if (masterPtr->deleted) {
+ if (modelPtr->deleted) {
goto noSuchImage;
}
imagePtr = (Image *)ckalloc(sizeof(Image));
imagePtr->tkwin = tkwin;
imagePtr->display = Tk_Display(tkwin);
- imagePtr->masterPtr = masterPtr;
+ imagePtr->modelPtr = modelPtr;
imagePtr->instanceData =
- masterPtr->typePtr->getProc(tkwin, masterPtr->masterData);
+ modelPtr->typePtr->getProc(tkwin, modelPtr->modelData);
imagePtr->changeProc = changeProc;
imagePtr->widgetClientData = clientData;
- imagePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = imagePtr;
+ imagePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = imagePtr;
return (Tk_Image) imagePtr;
noSuchImage:
@@ -670,20 +667,20 @@ Tk_FreeImage(
* a widget. */
{
Image *imagePtr = (Image *) image;
- ImageMaster *masterPtr = imagePtr->masterPtr;
+ ImageModel *modelPtr = imagePtr->modelPtr;
Image *prevPtr;
/*
* Clean up the particular instance.
*/
- if (masterPtr->typePtr != NULL) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ if (modelPtr->typePtr != NULL) {
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
}
- prevPtr = masterPtr->instancePtr;
+ prevPtr = modelPtr->instancePtr;
if (prevPtr == imagePtr) {
- masterPtr->instancePtr = imagePtr->nextPtr;
+ modelPtr->instancePtr = imagePtr->nextPtr;
} else {
while (prevPtr->nextPtr != imagePtr) {
prevPtr = prevPtr->nextPtr;
@@ -693,16 +690,16 @@ Tk_FreeImage(
ckfree(imagePtr);
/*
- * If there are no more instances left for the master, and if the master
- * image has been deleted, then delete the master too.
+ * If there are no more instances left for the model, and if the model
+ * image has been deleted, then delete the model too.
*/
- if ((masterPtr->typePtr == NULL) && (masterPtr->instancePtr == NULL)) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if ((modelPtr->typePtr == NULL) && (modelPtr->instancePtr == NULL)) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
}
}
@@ -742,9 +739,9 @@ Tk_PostscriptImage(
GC newGC;
XGCValues gcValues;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display on postscript.
+ * No model for image, so nothing to display on postscript.
*/
return TCL_OK;
@@ -755,9 +752,9 @@ Tk_PostscriptImage(
* otherwise go on with generic code.
*/
- if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
- return imagePtr->masterPtr->typePtr->postscriptProc(
- imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
+ if (imagePtr->modelPtr->typePtr->postscriptProc != NULL) {
+ return imagePtr->modelPtr->typePtr->postscriptProc(
+ imagePtr->modelPtr->modelData, interp, tkwin, psinfo,
x, y, width, height, prepass);
}
@@ -838,9 +835,9 @@ Tk_RedrawImage(
{
Image *imagePtr = (Image *) image;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display.
+ * No model for image, so nothing to display.
*/
return;
@@ -860,13 +857,13 @@ Tk_RedrawImage(
drawableY -= imageY;
imageY = 0;
}
- if ((imageX + width) > imagePtr->masterPtr->width) {
- width = imagePtr->masterPtr->width - imageX;
+ if ((imageX + width) > imagePtr->modelPtr->width) {
+ width = imagePtr->modelPtr->width - imageX;
}
- if ((imageY + height) > imagePtr->masterPtr->height) {
- height = imagePtr->masterPtr->height - imageY;
+ if ((imageY + height) > imagePtr->modelPtr->height) {
+ height = imagePtr->modelPtr->height - imageY;
}
- imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData,
+ imagePtr->modelPtr->typePtr->displayProc(imagePtr->instanceData,
imagePtr->display, drawable, imageX, imageY, width, height,
drawableX, drawableY);
}
@@ -896,8 +893,8 @@ Tk_SizeOfImage(
{
Image *imagePtr = (Image *) image;
- *widthPtr = imagePtr->masterPtr->width;
- *heightPtr = imagePtr->masterPtr->height;
+ *widthPtr = imagePtr->modelPtr->width;
+ *heightPtr = imagePtr->modelPtr->height;
}
/*
@@ -934,7 +931,7 @@ Tk_DeleteImage(
if (hPtr == NULL) {
return;
}
- DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr));
+ DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr));
}
/*
@@ -949,7 +946,7 @@ Tk_DeleteImage(
*
* Side effects:
* The connection is dropped between instances of this image and an image
- * master. Image instances will redisplay themselves as empty areas, but
+ * model. Image instances will redisplay themselves as empty areas, but
* existing instances will not be deleted.
*
*----------------------------------------------------------------------
@@ -957,31 +954,31 @@ Tk_DeleteImage(
static void
DeleteImage(
- ImageMaster *masterPtr) /* Pointer to main data structure for image. */
+ ImageModel *modelPtr) /* Pointer to main data structure for image. */
{
Image *imagePtr;
Tk_ImageType *typePtr;
- typePtr = masterPtr->typePtr;
- masterPtr->typePtr = NULL;
+ typePtr = modelPtr->typePtr;
+ modelPtr->typePtr = NULL;
if (typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height, masterPtr->width,
- masterPtr->height);
+ modelPtr->width, modelPtr->height, modelPtr->width,
+ modelPtr->height);
}
- typePtr->deleteProc(masterPtr->masterData);
+ typePtr->deleteProc(modelPtr->modelData);
}
- if (masterPtr->instancePtr == NULL) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if (modelPtr->instancePtr == NULL) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
} else {
- masterPtr->deleted = 1;
+ modelPtr->deleted = 1;
}
}
@@ -1005,16 +1002,16 @@ DeleteImage(
static void
EventuallyDeleteImage(
- ImageMaster *masterPtr, /* Pointer to main data structure for image. */
+ ImageModel *modelPtr, /* Pointer to main data structure for image. */
int forgetImageHashNow) /* Flag to say whether the hash table is about
* to vanish. */
{
if (forgetImageHashNow) {
- masterPtr->hPtr = NULL;
+ modelPtr->hPtr = NULL;
}
- if (!masterPtr->deleted) {
- masterPtr->deleted = 1;
- Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage);
+ if (!modelPtr->deleted) {
+ modelPtr->deleted = 1;
+ Tcl_EventuallyFree(modelPtr, (Tcl_FreeProc *) DeleteImage);
}
}
@@ -1046,7 +1043,7 @@ TkDeleteAllImages(
for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- EventuallyDeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr), 1);
+ EventuallyDeleteImage((ImageModel *)Tcl_GetHashValue(hPtr), 1);
}
Tcl_DeleteHashTable(&mainPtr->imageTable);
}
@@ -1054,10 +1051,10 @@ TkDeleteAllImages(
/*
*----------------------------------------------------------------------
*
- * Tk_GetImageMasterData --
+ * Tk_GetImageModelData --
*
* Given the name of an image, this function returns the type of the
- * image and the clientData associated with its master.
+ * image and the clientData associated with its model.
*
* Results:
* If there is no image by the given name, then NULL is returned and a
@@ -1072,7 +1069,7 @@ TkDeleteAllImages(
*/
ClientData
-Tk_GetImageMasterData(
+Tk_GetImageModelData(
Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
const char *name, /* Name of image. */
@@ -1082,20 +1079,20 @@ Tk_GetImageMasterData(
{
TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name);
if (hPtr == NULL) {
*typePtrPtr = NULL;
return NULL;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
*typePtrPtr = NULL;
return NULL;
}
- *typePtrPtr = masterPtr->typePtr;
- return masterPtr->masterData;
+ *typePtrPtr = modelPtr->typePtr;
+ return modelPtr->modelData;
}
/*
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index a43d2b7..4cc98b5 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -14,12 +14,12 @@
#include "tkInt.h"
/*
- * The following data structure represents the master for a bitmap
+ * The following data structure represents the model for a bitmap
* image:
*/
-typedef struct BitmapMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+typedef struct {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter for application that is using
* image. */
@@ -40,8 +40,8 @@ typedef struct BitmapMaster {
char *maskDataString; /* Value of -maskdata option (malloc'ed). */
struct BitmapInstance *instancePtr;
/* First in list of all instances associated
- * with this master. */
-} BitmapMaster;
+ * with this model. */
+} BitmapModel;
/*
* The following data structure represents all of the instances of an image
@@ -51,7 +51,7 @@ typedef struct BitmapMaster {
typedef struct BitmapInstance {
size_t refCount; /* Number of instances that share this data
* structure. */
- BitmapMaster *masterPtr; /* Pointer to master for image. */
+ BitmapModel *modelPtr; /* Pointer to model for image. */
Tk_Window tkwin; /* Window in which the instances will be
* displayed. */
XColor *fg; /* Foreground color for displaying image. */
@@ -65,7 +65,7 @@ typedef struct BitmapInstance {
* displayed. */
struct BitmapInstance *nextPtr;
/* Next in list of all instance structures
- * associated with masterPtr (NULL means end
+ * associated with modelPtr (NULL means end
* of list). */
} BitmapInstance;
@@ -76,7 +76,7 @@ typedef struct BitmapInstance {
static int GetByte(Tcl_Channel chan);
static int ImgBmapCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
static void ImgBmapDisplay(ClientData clientData,
@@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_UID, "-background", NULL, NULL,
- "", offsetof(BitmapMaster, bgUid), 0, NULL},
+ "", offsetof(BitmapModel, bgUid), 0, NULL},
{TK_CONFIG_STRING, "-data", NULL, NULL,
- NULL, offsetof(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, offsetof(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_UID, "-foreground", NULL, NULL,
- "#000000", offsetof(BitmapMaster, fgUid), 0, NULL},
+ "#000000", offsetof(BitmapModel, fgUid), 0, NULL},
{TK_CONFIG_STRING, "-maskdata", NULL, NULL,
- NULL, offsetof(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-maskfile", NULL, NULL,
- NULL, offsetof(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -149,7 +149,7 @@ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp,
int argc, Tcl_Obj *const objv[]);
static void ImgBmapCmdDeletedProc(ClientData clientData);
static void ImgBmapConfigureInstance(BitmapInstance *instancePtr);
-static int ImgBmapConfigureMaster(BitmapMaster *masterPtr,
+static int ImgBmapConfigureModel(BitmapModel *modelPtr,
int argc, Tcl_Obj *const objv[], int flags);
static int NextBitmapWord(ParseInfo *parseInfoPtr);
@@ -178,40 +178,40 @@ ImgBmapCreate(
Tcl_Obj *const argv[], /* Argument objects for options (doesn't
* include image name or type). */
const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)ckalloc(sizeof(BitmapMaster));
+ BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel));
(void)typePtr;
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
- masterPtr, ImgBmapCmdDeletedProc);
- masterPtr->width = masterPtr->height = 0;
- masterPtr->data = NULL;
- masterPtr->maskData = NULL;
- masterPtr->fgUid = NULL;
- masterPtr->bgUid = NULL;
- masterPtr->fileString = NULL;
- masterPtr->dataString = NULL;
- masterPtr->maskFileString = NULL;
- masterPtr->maskDataString = NULL;
- masterPtr->instancePtr = NULL;
- if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) {
- ImgBmapDelete(masterPtr);
+ modelPtr->tkModel = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
+ modelPtr, ImgBmapCmdDeletedProc);
+ modelPtr->width = modelPtr->height = 0;
+ modelPtr->data = NULL;
+ modelPtr->maskData = NULL;
+ modelPtr->fgUid = NULL;
+ modelPtr->bgUid = NULL;
+ modelPtr->fileString = NULL;
+ modelPtr->dataString = NULL;
+ modelPtr->maskFileString = NULL;
+ modelPtr->maskDataString = NULL;
+ modelPtr->instancePtr = NULL;
+ if (ImgBmapConfigureModel(modelPtr, argc, argv, 0) != TCL_OK) {
+ ImgBmapDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * ImgBmapConfigureMaster --
+ * ImgBmapConfigureModel --
*
* This procedure is called when a bitmap image is created or
* reconfigured. It process configuration options and resets any
@@ -219,7 +219,7 @@ ImgBmapCreate(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -229,8 +229,8 @@ ImgBmapCreate(
*/
static int
-ImgBmapConfigureMaster(
- BitmapMaster *masterPtr, /* Pointer to data structure describing
+ImgBmapConfigureModel(
+ BitmapModel *modelPtr, /* Pointer to data structure describing
* overall bitmap image to (reconfigure). */
int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
@@ -246,8 +246,8 @@ ImgBmapConfigureMaster(
}
argv[objc] = NULL;
- if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp),
- configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) {
+ if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp),
+ configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) {
ckfree(argv);
return TCL_ERROR;
}
@@ -258,44 +258,44 @@ ImgBmapConfigureMaster(
* bitmap and mask have the same dimensions.
*/
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
- masterPtr->data = NULL;
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
+ modelPtr->data = NULL;
}
- if ((masterPtr->fileString != NULL) || (masterPtr->dataString != NULL)) {
- masterPtr->data = TkGetBitmapData(masterPtr->interp,
- masterPtr->dataString, masterPtr->fileString,
- &masterPtr->width, &masterPtr->height, &dummy1, &dummy2);
- if (masterPtr->data == NULL) {
+ if ((modelPtr->fileString != NULL) || (modelPtr->dataString != NULL)) {
+ modelPtr->data = TkGetBitmapData(modelPtr->interp,
+ modelPtr->dataString, modelPtr->fileString,
+ &modelPtr->width, &modelPtr->height, &dummy1, &dummy2);
+ if (modelPtr->data == NULL) {
return TCL_ERROR;
}
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
}
- if ((masterPtr->maskFileString != NULL)
- || (masterPtr->maskDataString != NULL)) {
- if (masterPtr->data == NULL) {
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((modelPtr->maskFileString != NULL)
+ || (modelPtr->maskDataString != NULL)) {
+ if (modelPtr->data == NULL) {
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"can't have mask without bitmap", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"NO_BITMAP", NULL);
return TCL_ERROR;
}
- masterPtr->maskData = TkGetBitmapData(masterPtr->interp,
- masterPtr->maskDataString, masterPtr->maskFileString,
+ modelPtr->maskData = TkGetBitmapData(modelPtr->interp,
+ modelPtr->maskDataString, modelPtr->maskFileString,
&maskWidth, &maskHeight, &dummy1, &dummy2);
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
return TCL_ERROR;
}
- if ((maskWidth != masterPtr->width)
- || (maskHeight != masterPtr->height)) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((maskWidth != modelPtr->width)
+ || (maskHeight != modelPtr->height)) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"bitmap and mask have different sizes", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"MASK_SIZE", NULL);
return TCL_ERROR;
}
@@ -307,12 +307,12 @@ ImgBmapConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
ImgBmapConfigureInstance(instancePtr);
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -322,8 +322,8 @@ ImgBmapConfigureMaster(
* ImgBmapConfigureInstance --
*
* This procedure is called to create displaying information for a bitmap
- * image instance based on the configuration information in the master.
- * It is invoked both when new instances are created and when the master
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -340,7 +340,7 @@ static void
ImgBmapConfigureInstance(
BitmapInstance *instancePtr)/* Instance to reconfigure. */
{
- BitmapMaster *masterPtr = instancePtr->masterPtr;
+ BitmapModel *modelPtr = instancePtr->modelPtr;
XColor *colorPtr;
XGCValues gcValues;
GC gc;
@@ -348,13 +348,13 @@ ImgBmapConfigureInstance(
Pixmap oldBitmap, oldMask;
/*
- * For each of the options in masterPtr, translate the string form into an
+ * For each of the options in modelPtr, translate the string form into an
* internal form appropriate for instancePtr.
*/
- if (*masterPtr->bgUid != 0) {
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->bgUid);
+ if (*modelPtr->bgUid != 0) {
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->bgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -366,8 +366,8 @@ ImgBmapConfigureInstance(
}
instancePtr->bg = colorPtr;
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->fgUid);
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->fgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -388,19 +388,19 @@ ImgBmapConfigureInstance(
oldMask = instancePtr->mask;
instancePtr->mask = None;
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
instancePtr->bitmap = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->data, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->data, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
- if (masterPtr->maskData != NULL) {
+ if (modelPtr->maskData != NULL) {
instancePtr->mask = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->maskData, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->maskData, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
if (oldMask != None) {
@@ -410,7 +410,7 @@ ImgBmapConfigureInstance(
Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap);
}
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
gcValues.foreground = instancePtr->fg->pixel;
gcValues.graphics_exposures = False;
mask = GCForeground|GCGraphicsExposures;
@@ -445,10 +445,10 @@ ImgBmapConfigureInstance(
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = NULL;
- Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf(
+ Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf(
"\n (while configuring image \"%s\")", Tk_NameOfImage(
- masterPtr->tkMaster)));
- Tcl_BackgroundException(masterPtr->interp, TCL_ERROR);
+ modelPtr->tkModel)));
+ Tcl_BackgroundException(modelPtr->interp, TCL_ERROR);
}
/*
@@ -751,13 +751,13 @@ NextBitmapWord(
static int
ImgBmapCmd(
- ClientData clientData, /* Information about the image master. */
+ ClientData clientData, /* Information about the image model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const bmapOptions[] = {"cget", "configure", NULL};
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
int index;
if (objc < 2) {
@@ -775,17 +775,17 @@ ImgBmapCmd(
return TCL_ERROR;
}
return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
case 1: /* configure */
if (objc == 2) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
} else if (objc == 3) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr,
+ configSpecs, (char *) modelPtr,
Tcl_GetString(objv[2]), 0);
} else {
- return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2,
+ return ImgBmapConfigureModel(modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
default:
@@ -816,10 +816,10 @@ static ClientData
ImgBmapGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)masterData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
BitmapInstance *instancePtr;
/*
@@ -827,7 +827,7 @@ ImgBmapGet(
* re-use it.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if (instancePtr->tkwin == tkwin) {
instancePtr->refCount++;
@@ -842,15 +842,15 @@ ImgBmapGet(
instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
- instancePtr->masterPtr = masterPtr;
+ instancePtr->modelPtr = modelPtr;
instancePtr->tkwin = tkwin;
instancePtr->fg = NULL;
instancePtr->bg = NULL;
instancePtr->bitmap = None;
instancePtr->mask = None;
instancePtr->gc = NULL;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
ImgBmapConfigureInstance(instancePtr);
/*
@@ -858,8 +858,8 @@ ImgBmapGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return instancePtr;
@@ -975,10 +975,10 @@ ImgBmapFree(
if (instancePtr->gc != NULL) {
Tk_FreeGC(display, instancePtr->gc);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body */
}
@@ -992,7 +992,7 @@ ImgBmapFree(
*
* ImgBmapDelete --
*
- * This procedure is called by the image code to delete the master
+ * This procedure is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -1006,26 +1006,26 @@ ImgBmapFree(
static void
ImgBmapDelete(
- ClientData masterData) /* Pointer to BitmapMaster structure for
+ ClientData modelData) /* Pointer to BitmapModel structure for
* image. Must not have any more instances. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)masterData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
- if (masterPtr->instancePtr != NULL) {
+ if (modelPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkModel = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -1047,14 +1047,14 @@ ImgBmapDelete(
static void
ImgBmapCmdDeletedProc(
- ClientData clientData) /* Pointer to BitmapMaster structure for
+ ClientData clientData) /* Pointer to BitmapModel structure for
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -1082,7 +1082,7 @@ GetByte(
size_t size;
size = Tcl_Read(chan, &buffer, 1);
- if ((size + 1) < 2) {
+ if (size != 1) {
return EOF;
} else {
return buffer;
@@ -1197,7 +1197,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
Tcl_InterpState interpState;
Tcl_Obj *psObj;
@@ -1209,7 +1209,7 @@ ImgBmapPostscript(
* There is nothing to do for bitmaps with zero width or height.
*/
- if (width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<=0){
+ if (width<=0 || height<=0 || modelPtr->width<=0 || modelPtr->height<=0){
return TCL_OK;
}
@@ -1219,7 +1219,7 @@ ImgBmapPostscript(
* we bail out.
*/
- if (masterPtr->width*masterPtr->height > 60000) {
+ if (modelPtr->width*modelPtr->height > 60000) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unable to generate postscript for bitmaps larger than 60000"
" pixels", -1));
@@ -1258,10 +1258,10 @@ ImgBmapPostscript(
* color to the bits specified by the mask.
*/
- if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) {
+ if ((modelPtr->bgUid != NULL) && (modelPtr->bgUid[0] != '\000')) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->bgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1269,13 +1269,13 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
Tcl_AppendToObj(psObj,
"0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto "
"closepath fill\n", -1);
} else {
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->maskData);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->maskData);
}
}
@@ -1283,10 +1283,10 @@ ImgBmapPostscript(
* Draw the bitmap foreground, assuming there is one.
*/
- if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) {
+ if ((modelPtr->fgUid != NULL) && (modelPtr->data != NULL)) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->fgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1294,8 +1294,8 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->data);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->data);
}
/*
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 0c62b58..c8b2125 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -623,10 +623,10 @@ ReadData(
}
while (destSz) {
- size_t blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
+ TkSizeT blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
- blockSz = (size_t)Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
- if (blockSz == (size_t)-1) {
+ blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
+ if (blockSz == TCL_IO_FAILURE) {
/* TODO: failure info... */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel read failed: %s", Tcl_PosixError(interp)));
@@ -2295,7 +2295,7 @@ ParseFormat(
static const char *const fmtOptions[] = {
"-alpha", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_ALPHA
};
@@ -2332,7 +2332,7 @@ ParseFormat(
objc--;
objv++;
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_ALPHA:
if (Tcl_GetDoubleFromObj(interp, objv[0],
&pngPtr->alpha) == TCL_ERROR) {
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 91d809b..4a771ed 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -94,18 +94,15 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
static int
FileMatchPPM(
Tcl_Channel chan, /* The image file, open for reading. */
- const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)fileName;
- (void)format;
- (void)interp;
return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy);
}
@@ -134,7 +131,7 @@ FileReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Channel chan, /* The image file, open for reading. */
const char *fileName, /* The name of the image file. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -148,7 +145,6 @@ FileReadPPM(
size_t nBytes, count;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity);
if (type == 0) {
@@ -286,7 +282,7 @@ static int
FileWritePPM(
Tcl_Interp *interp,
const char *fileName,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
@@ -294,7 +290,6 @@ FileWritePPM(
size_t nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
- (void)format;
chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666);
if (chan == NULL) {
@@ -375,14 +370,13 @@ FileWritePPM(
static int
StringWritePPM(
Tcl_Interp *interp,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
int w, h, size, greenOffset, blueOffset;
unsigned char *pixLinePtr, *byteArray;
char header[16 + TCL_INTEGER_SPACE * 2];
Tcl_Obj *byteArrayObj;
- (void)format;
sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
@@ -452,16 +446,14 @@ StringWritePPM(
static int
StringMatchPPM(
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
int *widthPtr, int *heightPtr,
/* The dimensions of the image are returned
* here if the file is a valid raw PPM
* file. */
- Tcl_Interp *interp) /* unused */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)format;
- (void)interp;
return ReadPPMStringHeader(dataObj, widthPtr, heightPtr,
&dummy, NULL, NULL);
@@ -489,7 +481,7 @@ static int
StringReadPPM(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */
Tk_PhotoHandle imageHandle, /* The photo image to write into. */
int destX, int destY, /* Coordinates of top-left pixel in photo
* image to be written to. */
@@ -502,7 +494,6 @@ StringReadPPM(
int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1;
unsigned char *pixelPtr, *dataBuffer;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight,
&maxIntensity, &dataBuffer, &dataSize);
@@ -611,7 +602,6 @@ StringReadPPM(
*p = (((int) *dataBuffer) * 255)/maxIntensity;
}
} else {
- unsigned char *p;
unsigned int value;
for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) {
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 81b196c..55cc226 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -19,9 +19,7 @@
*/
#include "tkImgPhoto.h"
-#ifdef MAC_OSX_TK
-#define TKPUTIMAGE_CAN_BLEND
-#endif
+#include "tkPort.h"
/*
* Declaration for internal Xlib function used here:
@@ -46,7 +44,7 @@ static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
#endif
static int IsValidPalette(PhotoInstance *instancePtr,
const char *palette);
-static int CountBits(pixel mask);
+static int CountBits(unsigned mask);
static void GetColorTable(PhotoInstance *instancePtr);
static void FreeColorTable(ColorTable *colorPtr, int force);
static void AllocateColors(ColorTable *colorPtr);
@@ -68,8 +66,8 @@ static int imgPhotoColorHashInitialized;
* TkImgPhotoConfigureInstance --
*
* This function is called to create displaying information for a photo
- * image instance based on the configuration information in the master.
- * It is invoked both when new instances are created and when the master
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -86,25 +84,25 @@ void
TkImgPhotoConfigureInstance(
PhotoInstance *instancePtr) /* Instance to reconfigure. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
XImage *imagePtr;
int bitsPerPixel;
ColorTable *colorTablePtr;
XRectangle validBox;
/*
- * If the -palette configuration option has been set for the master, use
+ * If the -palette configuration option has been set for the model, use
* the value specified for our palette, but only if it is a valid palette
- * for our windows. Use the gamma value specified the master.
+ * for our windows. Use the gamma value specified the model.
*/
- if ((masterPtr->palette && masterPtr->palette[0])
- && IsValidPalette(instancePtr, masterPtr->palette)) {
- instancePtr->palette = masterPtr->palette;
+ if ((modelPtr->palette && modelPtr->palette[0])
+ && IsValidPalette(instancePtr, modelPtr->palette)) {
+ instancePtr->palette = modelPtr->palette;
} else {
instancePtr->palette = instancePtr->defaultPalette;
}
- instancePtr->gamma = masterPtr->gamma;
+ instancePtr->gamma = modelPtr->gamma;
/*
* If we don't currently have a color table, or if the one we have no
@@ -168,15 +166,15 @@ TkImgPhotoConfigureInstance(
}
/*
- * If the user has specified a width and/or height for the master which is
+ * If the user has specified a width and/or height for the model which is
* different from our current width/height, set the size to the values
* specified by the user. If we have no pixmap, we do this also, since it
* has the side effect of allocating a pixmap for us.
*/
if ((instancePtr->pixels == None) || (instancePtr->error == NULL)
- || (instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)) {
+ || (instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -184,9 +182,9 @@ TkImgPhotoConfigureInstance(
* Redither this instance if necessary.
*/
- if ((masterPtr->flags & IMAGE_CHANGED)
+ if ((modelPtr->flags & IMAGE_CHANGED)
|| (instancePtr->colorTablePtr != colorTablePtr)) {
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.width > 0) && (validBox.height > 0)) {
TkImgDitherInstance(instancePtr, validBox.x, validBox.y,
validBox.width, validBox.height);
@@ -216,10 +214,10 @@ ClientData
TkImgPhotoGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)masterData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
Colormap colormap;
int mono, nRed, nGreen, nBlue, numVisuals;
@@ -256,7 +254,7 @@ TkImgPhotoGet(
*/
colormap = Tk_Colormap(tkwin);
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if ((colormap == instancePtr->colormap)
&& (Tk_Display(tkwin) == instancePtr->display)) {
@@ -286,7 +284,7 @@ TkImgPhotoGet(
*/
instancePtr = (PhotoInstance *)ckalloc(sizeof(PhotoInstance));
- instancePtr->masterPtr = masterPtr;
+ instancePtr->modelPtr = modelPtr;
instancePtr->display = Tk_Display(tkwin);
instancePtr->colormap = Tk_Colormap(tkwin);
Tk_PreserveColormap(instancePtr->display, instancePtr->colormap);
@@ -297,8 +295,8 @@ TkImgPhotoGet(
instancePtr->width = 0;
instancePtr->height = 0;
instancePtr->imagePtr = 0;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
/*
* Obtain information about the visual and decide on the default palette.
@@ -358,8 +356,8 @@ TkImgPhotoGet(
* Make a GC with background = black and foreground = white.
*/
- white = Tk_GetColor(masterPtr->interp, tkwin, "white");
- black = Tk_GetColor(masterPtr->interp, tkwin, "black");
+ white = Tk_GetColor(modelPtr->interp, tkwin, "white");
+ black = Tk_GetColor(modelPtr->interp, tkwin, "black");
gcValues.foreground = (white != NULL)? white->pixel:
WhitePixelOfScreen(Tk_Screen(tkwin));
gcValues.background = (black != NULL)? black->pixel:
@@ -382,8 +380,8 @@ TkImgPhotoGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
}
return instancePtr;
@@ -416,9 +414,6 @@ TkImgPhotoGet(
*
* Note that Win32 pre-defines those operations that we really need.
*
- * Note that on MacOS, if the background comes from a Retina display
- * then it will be twice as wide and twice as high as the photoimage.
- *
*----------------------------------------------------------------------
*/
#ifndef TKPUTIMAGE_CAN_BLEND
@@ -446,8 +441,8 @@ BlendComplexAlpha(
{
int x, y, line;
unsigned long pixel;
- unsigned char r, g, b, alpha, unalpha, *masterPtr;
- unsigned char *alphaAr = iPtr->masterPtr->pix32;
+ unsigned char r, g, b, alpha, unalpha, *modelPtr;
+ unsigned char *alphaAr = iPtr->modelPtr->pix32;
/*
* This blending is an integer version of the Source-Over compositing rule
@@ -504,10 +499,10 @@ BlendComplexAlpha(
green_mlen = 8 - CountBits(green_mask >> green_shift);
blue_mlen = 8 - CountBits(blue_mask >> blue_shift);
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -519,9 +514,9 @@ BlendComplexAlpha(
* 24 and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -547,10 +542,10 @@ BlendComplexAlpha(
#endif /* !_WIN32 */
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -562,9 +557,9 @@ BlendComplexAlpha(
* and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -638,7 +633,7 @@ TkImgPhotoDisplay(
* no need to call XGetImage or to do the Porter-Duff compositing by hand.
*/
- unsigned char *rgbaPixels = instancePtr->masterPtr->pix32;
+ unsigned char *rgbaPixels = instancePtr->modelPtr->pix32;
XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels,
(unsigned int)instancePtr->width,
(unsigned int)instancePtr->height,
@@ -650,7 +645,7 @@ TkImgPhotoDisplay(
XDestroyImage(photo);
#else
- if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
+ if ((instancePtr->modelPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) {
Tk_ErrorHandler handler;
@@ -691,14 +686,14 @@ TkImgPhotoDisplay(
Tk_DeleteErrorHandler(handler);
} else {
/*
- * masterPtr->region describes which parts of the image contain valid
+ * modelPtr->region describes which parts of the image contain valid
* data. We set this region as the clip mask for the gc, setting its
* origin appropriately, and use it when drawing the image.
*/
fallBack:
TkSetRegion(display, instancePtr->gc,
- instancePtr->masterPtr->validRegion);
+ instancePtr->modelPtr->validRegion);
XSetClipOrigin(display, instancePtr->gc, drawableX - imageX,
drawableY - imageY);
XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc,
@@ -781,23 +776,23 @@ void
TkImgPhotoInstanceSetSize(
PhotoInstance *instancePtr) /* Instance whose size is to be changed. */
{
- PhotoMaster *masterPtr;
+ PhotoModel *modelPtr;
schar *newError, *errSrcPtr, *errDestPtr;
int h, offset;
XRectangle validBox;
Pixmap newPixmap;
- masterPtr = instancePtr->masterPtr;
- TkClipBox(masterPtr->validRegion, &validBox);
+ modelPtr = instancePtr->modelPtr;
+ TkClipBox(modelPtr->validRegion, &validBox);
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->pixels == None)) {
newPixmap = Tk_GetPixmap(instancePtr->display,
RootWindow(instancePtr->display,
instancePtr->visualInfo.screen),
- (masterPtr->width > 0) ? masterPtr->width: 1,
- (masterPtr->height > 0) ? masterPtr->height: 1,
+ (modelPtr->width > 0) ? modelPtr->width: 1,
+ (modelPtr->height > 0) ? modelPtr->height: 1,
instancePtr->visualInfo.depth);
if (!newPixmap) {
Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize");
@@ -827,17 +822,17 @@ TkImgPhotoInstanceSetSize(
instancePtr->pixels = newPixmap;
}
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->error == NULL)) {
- if (masterPtr->height > 0 && masterPtr->width > 0) {
+ if (modelPtr->height > 0 && modelPtr->width > 0) {
/*
* TODO: use attemptckalloc() here once there is a strategy that
* will allow us to recover from failure. Right now, there's no
* such possibility.
*/
- newError = (schar *)ckalloc(masterPtr->height * masterPtr->width
+ newError = (schar *)ckalloc(modelPtr->height * modelPtr->width
* 3 * sizeof(schar));
/*
@@ -846,21 +841,21 @@ TkImgPhotoInstanceSetSize(
*/
if ((instancePtr->error != NULL)
- && ((instancePtr->width == masterPtr->width)
- || (validBox.width == masterPtr->width))) {
+ && ((instancePtr->width == modelPtr->width)
+ || (validBox.width == modelPtr->width))) {
if (validBox.y > 0) {
memset(newError, 0, (size_t)
- validBox.y * masterPtr->width * 3 * sizeof(schar));
+ validBox.y * modelPtr->width * 3 * sizeof(schar));
}
h = validBox.y + validBox.height;
- if (h < masterPtr->height) {
- memset(newError + h*masterPtr->width*3, 0,
- (size_t) (masterPtr->height - h)
- * masterPtr->width * 3 * sizeof(schar));
+ if (h < modelPtr->height) {
+ memset(newError + h*modelPtr->width*3, 0,
+ (size_t) (modelPtr->height - h)
+ * modelPtr->width * 3 * sizeof(schar));
}
} else {
memset(newError, 0, (size_t)
- masterPtr->height * masterPtr->width *3*sizeof(schar));
+ modelPtr->height * modelPtr->width *3*sizeof(schar));
}
} else {
newError = NULL;
@@ -872,22 +867,22 @@ TkImgPhotoInstanceSetSize(
* array.
*/
- if (masterPtr->width == instancePtr->width) {
- offset = validBox.y * masterPtr->width * 3;
+ if (modelPtr->width == instancePtr->width) {
+ offset = validBox.y * modelPtr->width * 3;
memcpy(newError + offset, instancePtr->error + offset,
(size_t) validBox.height
- * masterPtr->width * 3 * sizeof(schar));
+ * modelPtr->width * 3 * sizeof(schar));
} else if (validBox.width > 0 && validBox.height > 0) {
errDestPtr = newError +
- (validBox.y * masterPtr->width + validBox.x) * 3;
+ (validBox.y * modelPtr->width + validBox.x) * 3;
errSrcPtr = instancePtr->error +
(validBox.y * instancePtr->width + validBox.x) * 3;
for (h = validBox.height; h > 0; --h) {
memcpy(errDestPtr, errSrcPtr,
validBox.width * 3 * sizeof(schar));
- errDestPtr += masterPtr->width * 3;
+ errDestPtr += modelPtr->width * 3;
errSrcPtr += instancePtr->width * 3;
}
}
@@ -897,8 +892,8 @@ TkImgPhotoInstanceSetSize(
instancePtr->error = newError;
}
- instancePtr->width = masterPtr->width;
- instancePtr->height = masterPtr->height;
+ instancePtr->width = modelPtr->width;
+ instancePtr->height = modelPtr->height;
}
/*
@@ -1004,7 +999,7 @@ IsValidPalette(
static int
CountBits(
- pixel mask) /* Value to count the 1 bits in. */
+ unsigned mask) /* Value to count the 1 bits in. */
{
int n;
@@ -1610,10 +1605,10 @@ TkImgDisposeInstance(
FreeColorTable(instancePtr->colorTablePtr, 1);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body. */
}
@@ -1629,7 +1624,7 @@ TkImgDisposeInstance(
* TkImgDitherInstance --
*
* This function is called to update an area of an instance's pixmap by
- * dithering the corresponding area of the master.
+ * dithering the corresponding area of the model.
*
* Results:
* None.
@@ -1647,14 +1642,14 @@ TkImgDitherInstance(
* block to be dithered. */
int width, int height) /* Dimensions of the block to be dithered. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
ColorTable *colorPtr = instancePtr->colorTablePtr;
XImage *imagePtr;
int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1;
int bitsPerPixel, bytesPerLine, lineLength;
unsigned char *srcLinePtr;
schar *errLinePtr;
- pixel firstBit, word, mask;
+ unsigned firstBit, word, mask;
/*
* Turn dithering off in certain cases where it is not needed (TrueColor,
@@ -1705,8 +1700,8 @@ TkImgDitherInstance(
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
- lineLength = masterPtr->width * 3;
- srcLinePtr = masterPtr->pix32 + (yStart * masterPtr->width + xStart) * 4;
+ lineLength = modelPtr->width * 3;
+ srcLinePtr = modelPtr->pix32 + (yStart * modelPtr->width + xStart) * 4;
errLinePtr = instancePtr->error + yStart * lineLength + xStart * 3;
xEnd = xStart + width;
@@ -1727,7 +1722,7 @@ TkImgDitherInstance(
unsigned char *srcPtr = srcLinePtr;
schar *errPtr = errLinePtr;
unsigned char *destBytePtr = dstLinePtr;
- pixel *destLongPtr = (pixel *) dstLinePtr;
+ unsigned *destLongPtr = (unsigned *) dstLinePtr;
if (colorPtr->flags & COLOR_WINDOW) {
/*
@@ -1761,7 +1756,7 @@ TkImgDitherInstance(
c += errPtr[-lineLength-3];
}
c += errPtr[-lineLength] * 5;
- if ((x + 1) < masterPtr->width) {
+ if ((x + 1) < modelPtr->width) {
c += errPtr[-lineLength+3] * 3;
}
}
@@ -1818,7 +1813,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1832,7 +1827,7 @@ TkImgDitherInstance(
/*
* Multibit monochrome window. The operation here is similar
* to the color window case above, except that there is only
- * one component. If the master image is in color, use the
+ * one component. If the model image is in color, use the
* luminance computed as
* 0.344 * red + 0.5 * green + 0.156 * blue.
*/
@@ -1844,13 +1839,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1880,7 +1875,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1917,13 +1912,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1946,7 +1941,7 @@ TkImgDitherInstance(
}
*destLongPtr = word;
}
- srcLinePtr += masterPtr->width * 4;
+ srcLinePtr += modelPtr->width * 4;
errLinePtr += lineLength;
dstLinePtr += bytesPerLine;
}
@@ -1990,8 +1985,8 @@ TkImgResetDither(
{
if (instancePtr->error) {
memset(instancePtr->error, 0,
- (size_t) instancePtr->masterPtr->width
- * instancePtr->masterPtr->height * 3 * sizeof(schar));
+ (size_t) instancePtr->modelPtr->width
+ * instancePtr->modelPtr->height * 3 * sizeof(schar));
}
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index c821b81..89dbb4c 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -107,7 +107,7 @@ static const char *const optionNames[] = {
static int ImgPhotoCreate(Tcl_Interp *interp, const char *name,
int objc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static void ImgPhotoDelete(ClientData clientData);
static int ImgPhotoPostscript(ClientData clientData,
@@ -135,9 +135,11 @@ typedef struct {
Tk_PhotoImageFormat *formatList;
/* Pointer to the first in the list of known
* photo image formats.*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
Tk_PhotoImageFormat *oldFormatList;
/* Pointer to the first in the list of known
* photo image formats.*/
+#endif
int initialized; /* Set to 1 if we've initialized the
* structure. */
} ThreadSpecificData;
@@ -158,15 +160,15 @@ static Tcl_ThreadDataKey dataKey;
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, offsetof(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_DOUBLE, "-gamma", NULL, NULL,
- DEF_PHOTO_GAMMA, offsetof(PhotoMaster, gamma), 0, NULL},
+ DEF_PHOTO_GAMMA, offsetof(PhotoModel, gamma), 0, NULL},
{TK_CONFIG_INT, "-height", NULL, NULL,
- DEF_PHOTO_HEIGHT, offsetof(PhotoMaster, userHeight), 0, NULL},
+ DEF_PHOTO_HEIGHT, offsetof(PhotoModel, userHeight), 0, NULL},
{TK_CONFIG_UID, "-palette", NULL, NULL,
- DEF_PHOTO_PALETTE, offsetof(PhotoMaster, palette), 0, NULL},
+ DEF_PHOTO_PALETTE, offsetof(PhotoModel, palette), 0, NULL},
{TK_CONFIG_INT, "-width", NULL, NULL,
- DEF_PHOTO_WIDTH, offsetof(PhotoMaster, userWidth), 0, NULL},
+ DEF_PHOTO_WIDTH, offsetof(PhotoModel, userWidth), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -182,13 +184,13 @@ static int ParseSubcommandOptions(
Tcl_Interp *interp, int allowedOptions,
int *indexPtr, int objc, Tcl_Obj *const objv[]);
static void ImgPhotoCmdDeletedProc(ClientData clientData);
-static int ImgPhotoConfigureMaster(Tcl_Interp *interp,
- PhotoMaster *masterPtr, int objc,
+static int ImgPhotoConfigureModel(Tcl_Interp *interp,
+ PhotoModel *modelPtr, int objc,
Tcl_Obj *const objv[], int flags);
-static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr);
-static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width,
+static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr);
+static int ImgPhotoSetSize(PhotoModel *modelPtr, int width,
int height);
-static char * ImgGetPhoto(PhotoMaster *masterPtr,
+static char * ImgGetPhoto(PhotoModel *modelPtr,
Tk_PhotoImageBlock *blockPtr,
struct SubcommandOptions *optPtr);
static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
@@ -219,18 +221,19 @@ static const char * GetExtension(const char *path);
static void
PhotoFormatThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *)) /* not used */
{
Tk_PhotoImageFormat *freePtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
ckfree(freePtr);
}
+#endif
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
@@ -258,6 +261,7 @@ PhotoFormatThreadExitProc(
*----------------------------------------------------------------------
*/
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
void
Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr)
@@ -278,6 +282,7 @@ Tk_CreateOldPhotoImageFormat(
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
}
+#endif
void
Tk_CreatePhotoImageFormat(
@@ -296,10 +301,13 @@ Tk_CreatePhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
- } else {
+ } else
+#endif
+ {
/* for compatibility with aMSN: make a copy of formatPtr->name */
char *name = (char *)ckalloc(strlen(formatPtr->name) + 1);
strcpy(name, formatPtr->name);
@@ -334,40 +342,39 @@ ImgPhotoCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- PhotoMaster *masterPtr;
- (void)typePtr;
+ PhotoModel *modelPtr;
/*
- * Allocate and initialize the photo image master record.
+ * Allocate and initialize the photo image model record.
*/
- masterPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster));
- memset(masterPtr, 0, sizeof(PhotoMaster));
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
- masterPtr, ImgPhotoCmdDeletedProc);
- masterPtr->palette = NULL;
- masterPtr->pix32 = NULL;
- masterPtr->instancePtr = NULL;
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel));
+ memset(modelPtr, 0, sizeof(PhotoModel));
+ modelPtr->tkModel = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
+ modelPtr, ImgPhotoCmdDeletedProc);
+ modelPtr->palette = NULL;
+ modelPtr->pix32 = NULL;
+ modelPtr->instancePtr = NULL;
+ modelPtr->validRegion = TkCreateRegion();
/*
* Process configuration options given in the image create command.
*/
- if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) {
- ImgPhotoDelete(masterPtr);
+ if (ImgPhotoConfigureModel(interp, modelPtr, objc, objv, 0) != TCL_OK) {
+ ImgPhotoDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
@@ -391,7 +398,7 @@ ImgPhotoCreate(
static int
ImgPhotoCmd(
- ClientData clientData, /* Information about photo master. */
+ ClientData clientData, /* Information about photo model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -406,7 +413,7 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
int result, index, x, y, width, height;
struct SubcommandOptions options;
unsigned char *pixelPtr;
@@ -436,7 +443,7 @@ ImgPhotoCmd(
*/
if (objc == 2) {
- Tk_PhotoBlank(masterPtr);
+ Tk_PhotoBlank(modelPtr);
return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -452,16 +459,16 @@ ImgPhotoCmd(
}
arg = TkGetStringFromObj(objv[2], &length);
if (strncmp(arg,"-data", length) == 0) {
- if (masterPtr->dataString) {
- Tcl_SetObjResult(interp, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_SetObjResult(interp, modelPtr->dataString);
}
} else if (strncmp(arg,"-format", length) == 0) {
- if (masterPtr->format) {
- Tcl_SetObjResult(interp, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_SetObjResult(interp, modelPtr->format);
}
} else {
Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
}
return TCL_OK;
}
@@ -475,21 +482,21 @@ ImgPhotoCmd(
Tcl_Obj *obj, *subobj;
result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
if (result != TCL_OK) {
return result;
}
obj = Tcl_NewObj();
subobj = Tcl_NewStringObj("-data {} {} {}", 14);
- if (masterPtr->dataString) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-format {} {} {}", 16);
- if (masterPtr->format) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
@@ -503,13 +510,13 @@ ImgPhotoCmd(
if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
- if (masterPtr->dataString) {
+ if (modelPtr->dataString) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->dataString);
+ modelPtr->dataString);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
@@ -517,23 +524,23 @@ ImgPhotoCmd(
} else if (length > 1 &&
!strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
- if (masterPtr->format) {
+ if (modelPtr->format) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->format);
+ modelPtr->format);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
} else {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, arg, 0);
+ configSpecs, (char *) modelPtr, arg, 0);
}
} else {
- return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
+ return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
@@ -592,7 +599,7 @@ ImgPhotoCmd(
* has a simple alpha channel.
*/
- if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) {
+ if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) {
options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO;
}
@@ -636,7 +643,7 @@ ImgPhotoCmd(
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr,
&block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
@@ -650,7 +657,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX2,
+ if (ImgPhotoSetSize(modelPtr, options.toX2,
options.toY2) != TCL_OK) {
if (options.background) {
Tk_FreeColor(options.background);
@@ -661,8 +668,8 @@ ImgPhotoCmd(
return TCL_ERROR;
}
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
if (options.background) {
Tk_FreeColor(options.background);
}
@@ -693,10 +700,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -708,8 +715,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (!(options.options & OPT_FORMAT)) {
options.format = Tcl_NewStringObj("default", -1);
@@ -732,6 +739,7 @@ ImgPhotoCmd(
}
}
}
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (stringWriteProc == NULL) {
oldformat = 1;
for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
@@ -747,6 +755,7 @@ ImgPhotoCmd(
}
}
}
+#endif
if (stringWriteProc == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"image string format \"%s\" is %s",
@@ -761,7 +770,7 @@ ImgPhotoCmd(
* Call the handler's string write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
if (oldformat) {
Tcl_DString buffer;
@@ -836,8 +845,8 @@ ImgPhotoCmd(
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -850,7 +859,7 @@ ImgPhotoCmd(
* Extract the value of the desired pixel and format it as a list.
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
channels[0] = Tcl_NewWideIntObj(pixelPtr[0]);
channels[1] = Tcl_NewWideIntObj(pixelPtr[1]);
channels[2] = Tcl_NewWideIntObj(pixelPtr[2]);
@@ -908,7 +917,7 @@ ImgPhotoCmd(
}
if (imageFormat->stringReadProc(interp, data, format,
- (Tk_PhotoHandle) masterPtr, options.toX, options.toY,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
options.toX2 - options.toX,
options.toY2 - options.toY, 0, 0) != TCL_OK) {
return TCL_ERROR;
@@ -919,7 +928,7 @@ ImgPhotoCmd(
* takes care to notify the changed image and to set/unset the
* IMAGE_CHANGED bit.
*/
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
return TCL_OK;
}
@@ -1009,12 +1018,13 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX + width,
+ if (ImgPhotoSetSize(modelPtr, options.toX + width,
options.toY + height) != TCL_OK) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
+ Tcl_Close(NULL, chan);
return TCL_ERROR;
}
}
@@ -1030,7 +1040,7 @@ ImgPhotoCmd(
}
result = imageFormat->fileReadProc(interp, chan,
Tcl_GetString(options.name),
- format, (Tk_PhotoHandle) masterPtr, options.toX,
+ format, (Tk_PhotoHandle) modelPtr, options.toX,
options.toY, width, height, options.fromX, options.fromY);
if (chan != NULL) {
Tcl_Close(NULL, chan);
@@ -1049,27 +1059,27 @@ ImgPhotoCmd(
* present.
*/
- x = masterPtr->ditherX;
- y = masterPtr->ditherY;
- if (masterPtr->ditherX != 0) {
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y,
- masterPtr->width - x, 1);
+ x = modelPtr->ditherX;
+ y = modelPtr->ditherY;
+ if (modelPtr->ditherX != 0) {
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y,
+ modelPtr->width - x, 1);
}
- if (masterPtr->ditherY < masterPtr->height) {
+ if (modelPtr->ditherY < modelPtr->height) {
x = 0;
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0,
- masterPtr->ditherY, masterPtr->width,
- masterPtr->height - masterPtr->ditherY);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0,
+ modelPtr->ditherY, modelPtr->width,
+ modelPtr->height - modelPtr->ditherY);
}
- if (y < masterPtr->height) {
+ if (y < modelPtr->height) {
/*
* Tell the core image code that part of the image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y,
- (masterPtr->width - x), (masterPtr->height - y),
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y,
+ (modelPtr->width - x), (modelPtr->height - y),
+ modelPtr->width, modelPtr->height);
}
return TCL_OK;
@@ -1126,8 +1136,8 @@ ImgPhotoCmd(
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1139,7 +1149,7 @@ ImgPhotoCmd(
/*
* Extract and return the desired value
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3]));
} else {
@@ -1185,8 +1195,8 @@ ImgPhotoCmd(
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency set: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1217,7 +1227,7 @@ ImgPhotoCmd(
* Set new alpha value for the pixel
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
pixelPtr[3] = newVal ? 0 : 255;
} else {
@@ -1235,11 +1245,11 @@ ImgPhotoCmd(
modRegion = TkCreateRegion();
TkUnionRectWithRegion(&setBox, modRegion, modRegion);
if (pixelPtr[3]) {
- TkUnionRectWithRegion(&setBox, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
+ modelPtr->validRegion);
} else {
- TkSubtractRegion(masterPtr->validRegion, modRegion,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, modRegion,
+ modelPtr->validRegion);
}
TkDestroyRegion(modRegion);
@@ -1248,9 +1258,9 @@ ImgPhotoCmd(
* has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1,
- masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkModel, x, y, 1, 1,
+ modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
}
@@ -1292,10 +1302,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -1309,8 +1319,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (options.format == NULL) {
fmtString = GetExtension(Tcl_GetString(options.name));
@@ -1338,6 +1348,7 @@ ImgPhotoCmd(
}
}
}
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (imageFormat == NULL) {
oldformat = 1;
for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL;
@@ -1352,6 +1363,7 @@ ImgPhotoCmd(
}
}
}
+#endif
if (usedExt && !matched) {
/*
* If we didn't find one and we're using file extensions as the
@@ -1385,7 +1397,7 @@ ImgPhotoCmd(
* Call the handler's file write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
format = options.format;
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(options.format);
@@ -1729,7 +1741,7 @@ ParseSubcommandOptions(
/*
*----------------------------------------------------------------------
*
- * ImgPhotoConfigureMaster --
+ * ImgPhotoConfigureModel --
*
* This function is called when a photo image is created or reconfigured.
* It processes configuration options and resets any instances of the
@@ -1737,7 +1749,7 @@ ParseSubcommandOptions(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -1747,9 +1759,9 @@ ParseSubcommandOptions(
*/
static int
-ImgPhotoConfigureMaster(
+ImgPhotoConfigureModel(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
- PhotoMaster *masterPtr, /* Pointer to data structure describing
+ PhotoModel *modelPtr, /* Pointer to data structure describing
* overall photo image to (re)configure. */
int objc, /* Number of entries in objv. */
Tcl_Obj *const objv[], /* Pairs of configuration options for image. */
@@ -1808,28 +1820,28 @@ ImgPhotoConfigureMaster(
* the format string influences how "-data" or "-file" is interpreted.
*/
- oldFileString = masterPtr->fileString;
+ oldFileString = modelPtr->fileString;
if (oldFileString == NULL) {
- oldData = masterPtr->dataString;
+ oldData = modelPtr->dataString;
if (oldData != NULL) {
Tcl_IncrRefCount(oldData);
}
} else {
oldData = NULL;
}
- oldFormat = masterPtr->format;
+ oldFormat = modelPtr->format;
if (oldFormat != NULL) {
Tcl_IncrRefCount(oldFormat);
}
- oldPaletteString = masterPtr->palette;
- oldGamma = masterPtr->gamma;
+ oldPaletteString = modelPtr->palette;
+ oldGamma = modelPtr->gamma;
/*
* Process the configuration options specified.
*/
if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
- j, args, (char *) masterPtr, flags) != TCL_OK) {
+ j, args, (char *) modelPtr, flags) != TCL_OK) {
ckfree(args);
goto errorExit;
}
@@ -1839,9 +1851,9 @@ ImgPhotoConfigureMaster(
* Regard the empty string for -file, -data or -format as the null value.
*/
- if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
- ckfree(masterPtr->fileString);
- masterPtr->fileString = NULL;
+ if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) {
+ ckfree(modelPtr->fileString);
+ modelPtr->fileString = NULL;
}
if (data) {
/*
@@ -1856,10 +1868,10 @@ ImgPhotoConfigureMaster(
} else {
data = NULL;
}
- if (masterPtr->dataString) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- masterPtr->dataString = data;
+ modelPtr->dataString = data;
}
if (format) {
/*
@@ -1873,18 +1885,18 @@ ImgPhotoConfigureMaster(
} else {
format = NULL;
}
- if (masterPtr->format) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- masterPtr->format = format;
+ modelPtr->format = format;
}
/*
* Set the image to the user-requested size, if any, and make sure storage
* is correctly allocated for this image.
*/
- if (ImgPhotoSetSize(masterPtr, masterPtr->width,
- masterPtr->height) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, modelPtr->width,
+ modelPtr->height) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
@@ -1896,9 +1908,9 @@ ImgPhotoConfigureMaster(
* -file or -data option.
*/
- if ((masterPtr->fileString != NULL)
- && ((masterPtr->fileString != oldFileString)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString != NULL)
+ && ((modelPtr->fileString != oldFileString)
+ || (modelPtr->format != oldFormat))) {
/*
* Prevent file system access in a safe interpreter.
*/
@@ -1912,7 +1924,7 @@ ImgPhotoConfigureMaster(
goto errorExit;
}
- chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0);
+ chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0);
if (chan == NULL) {
goto errorExit;
}
@@ -1923,13 +1935,13 @@ ImgPhotoConfigureMaster(
if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
- (MatchFileFormat(interp, chan, masterPtr->fileString,
- masterPtr->format, &imageFormat, &imageWidth,
+ (MatchFileFormat(interp, chan, modelPtr->fileString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK)) {
Tcl_Close(NULL, chan);
goto errorExit;
}
- result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
+ result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight);
if (result != TCL_OK) {
Tcl_Close(NULL, chan);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1937,12 +1949,12 @@ ImgPhotoConfigureMaster(
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
+ tempformat = modelPtr->format;
if (oldformat && tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
result = imageFormat->fileReadProc(interp, chan,
- masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr,
+ modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr,
0, 0, imageWidth, imageHeight, 0, 0);
Tcl_Close(NULL, chan);
if (result != TCL_OK) {
@@ -1950,26 +1962,26 @@ ImgPhotoConfigureMaster(
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
- if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL)
- && ((masterPtr->dataString != oldData)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL)
+ && ((modelPtr->dataString != oldData)
+ || (modelPtr->format != oldFormat))) {
- if (MatchStringFormat(interp, masterPtr->dataString,
- masterPtr->format, &imageFormat, &imageWidth,
+ if (MatchStringFormat(interp, modelPtr->dataString,
+ modelPtr->format, &imageFormat, &imageWidth,
&imageHeight, &oldformat) != TCL_OK) {
goto errorExit;
}
- if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
- tempdata = masterPtr->dataString;
+ tempformat = modelPtr->format;
+ tempdata = modelPtr->dataString;
if (oldformat) {
if (tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
@@ -1977,26 +1989,26 @@ ImgPhotoConfigureMaster(
tempdata = (Tcl_Obj *) Tcl_GetString(tempdata);
}
if (imageFormat->stringReadProc(interp, tempdata, tempformat,
- (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight,
+ (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
0, 0) != TCL_OK) {
goto errorExit;
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
* Enforce a reasonable value for gamma.
*/
- if (masterPtr->gamma <= 0) {
- masterPtr->gamma = 1.0;
+ if (modelPtr->gamma <= 0) {
+ modelPtr->gamma = 1.0;
}
- if ((masterPtr->gamma != oldGamma)
- || (masterPtr->palette != oldPaletteString)) {
- masterPtr->flags |= IMAGE_CHANGED;
+ if ((modelPtr->gamma != oldGamma)
+ || (modelPtr->palette != oldPaletteString)) {
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
@@ -2005,7 +2017,7 @@ ImgPhotoConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoConfigureInstance(instancePtr);
}
@@ -2014,9 +2026,9 @@ ImgPhotoConfigureMaster(
* Inform the generic image code that the image has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
if (oldData != NULL) {
Tcl_DecrRefCount(oldData);
@@ -2025,7 +2037,7 @@ ImgPhotoConfigureMaster(
Tcl_DecrRefCount(oldFormat);
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
return TCL_OK;
@@ -2052,14 +2064,14 @@ ImgPhotoConfigureMaster(
* None.
*
* Side effects:
- * (Re)sets COMPLEX_ALPHA flag of master.
+ * (Re)sets COMPLEX_ALPHA flag of model.
*
*----------------------------------------------------------------------
*/
static int
ToggleComplexAlphaIfNeeded(
- PhotoMaster *mPtr)
+ PhotoModel *mPtr)
{
size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) *
(size_t)MAX(mPtr->userHeight, mPtr->height) * 4;
@@ -2090,7 +2102,7 @@ ToggleComplexAlphaIfNeeded(
*
* ImgPhotoDelete --
*
- * This function is called by the image code to delete the master
+ * This function is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -2104,37 +2116,37 @@ ToggleComplexAlphaIfNeeded(
static void
ImgPhotoDelete(
- ClientData masterData) /* Pointer to PhotoMaster structure for image.
+ ClientData modelData) /* Pointer to PhotoModel structure for image.
* Must not have any more instances. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)masterData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
- while ((instancePtr = masterPtr->instancePtr) != NULL) {
+ while ((instancePtr = modelPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
Tcl_Panic("tried to delete photo image when instances still exist");
}
Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr);
TkImgDisposeInstance(instancePtr);
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkModel = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->pix32 != NULL) {
- ckfree(masterPtr->pix32);
+ if (modelPtr->pix32 != NULL) {
+ ckfree(modelPtr->pix32);
}
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- if (masterPtr->dataString != NULL) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString != NULL) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- if (masterPtr->format != NULL) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format != NULL) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -2156,14 +2168,14 @@ ImgPhotoDelete(
static void
ImgPhotoCmdDeletedProc(
- ClientData clientData) /* Pointer to PhotoMaster structure for
+ ClientData clientData) /* Pointer to PhotoModel structure for
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -2181,14 +2193,14 @@ ImgPhotoCmdDeletedProc(
* with memory allocation.)
*
* Side effects:
- * Storage gets reallocated, for the master and all its instances.
+ * Storage gets reallocated, for the model and all its instances.
*
*----------------------------------------------------------------------
*/
static int
ImgPhotoSetSize(
- PhotoMaster *masterPtr,
+ PhotoModel *modelPtr,
int width, int height)
{
unsigned char *newPix32 = NULL;
@@ -2198,11 +2210,11 @@ ImgPhotoSetSize(
TkRegion clipRegion;
PhotoInstance *instancePtr;
- if (masterPtr->userWidth > 0) {
- width = masterPtr->userWidth;
+ if (modelPtr->userWidth > 0) {
+ width = modelPtr->userWidth;
}
- if (masterPtr->userHeight > 0) {
- height = masterPtr->userHeight;
+ if (modelPtr->userHeight > 0) {
+ height = modelPtr->userHeight;
}
if (width > INT_MAX / 4) {
@@ -2216,8 +2228,8 @@ ImgPhotoSetSize(
* failures will leave the photo unchanged.
*/
- if ((width != masterPtr->width) || (height != masterPtr->height)
- || (masterPtr->pix32 == NULL)) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)
+ || (modelPtr->pix32 == NULL)) {
unsigned newPixSize;
if (pitch && height > (int)(UINT_MAX / pitch)) {
@@ -2244,7 +2256,7 @@ ImgPhotoSetSize(
* image size.
*/
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.x + validBox.width > width)
|| (validBox.y + validBox.height > height)) {
clipBox.x = 0;
@@ -2253,10 +2265,10 @@ ImgPhotoSetSize(
clipBox.height = height;
clipRegion = TkCreateRegion();
TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion);
- TkIntersectRegion(masterPtr->validRegion, clipRegion,
- masterPtr->validRegion);
+ TkIntersectRegion(modelPtr->validRegion, clipRegion,
+ modelPtr->validRegion);
TkDestroyRegion(clipRegion);
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
}
/*
@@ -2272,8 +2284,8 @@ ImgPhotoSetSize(
* or written to a file.
*/
- if ((masterPtr->pix32 != NULL)
- && ((width == masterPtr->width) || (width == validBox.width))) {
+ if ((modelPtr->pix32 != NULL)
+ && ((width == modelPtr->width) || (width == validBox.width))) {
if (validBox.y > 0) {
memset(newPix32, 0, ((size_t) validBox.y * pitch));
}
@@ -2285,20 +2297,20 @@ ImgPhotoSetSize(
memset(newPix32, 0, ((size_t)height * pitch));
}
- if (masterPtr->pix32 != NULL) {
+ if (modelPtr->pix32 != NULL) {
/*
* Copy the common area over to the new array array and free the
* old array.
*/
- if (width == masterPtr->width) {
+ if (width == modelPtr->width) {
/*
* The region to be copied is contiguous.
*/
offset = validBox.y * pitch;
- memcpy(newPix32 + offset, masterPtr->pix32 + offset,
+ memcpy(newPix32 + offset, modelPtr->pix32 + offset,
((size_t)validBox.height * pitch));
} else if ((validBox.width > 0) && (validBox.height > 0)) {
@@ -2307,21 +2319,21 @@ ImgPhotoSetSize(
*/
destPtr = newPix32 + (validBox.y * width + validBox.x) * 4;
- srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width
+ srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width
+ validBox.x) * 4;
for (h = validBox.height; h > 0; h--) {
memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4));
destPtr += width * 4;
- srcPtr += masterPtr->width * 4;
+ srcPtr += modelPtr->width * 4;
}
}
- ckfree(masterPtr->pix32);
+ ckfree(modelPtr->pix32);
}
- masterPtr->pix32 = newPix32;
- masterPtr->width = width;
- masterPtr->height = height;
+ modelPtr->pix32 = newPix32;
+ modelPtr->width = width;
+ modelPtr->height = height;
/*
* Dithering will be correct up to the end of the last pre-existing
@@ -2329,27 +2341,27 @@ ImgPhotoSetSize(
*/
if ((validBox.x > 0) || (validBox.y > 0)) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = 0;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = 0;
} else if (validBox.width == width) {
- if ((int) validBox.height < masterPtr->ditherY) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = validBox.height;
+ if ((int) validBox.height < modelPtr->ditherY) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = validBox.height;
}
- } else if ((masterPtr->ditherY > 0)
- || ((int) validBox.width < masterPtr->ditherX)) {
- masterPtr->ditherX = validBox.width;
- masterPtr->ditherY = 0;
+ } else if ((modelPtr->ditherY > 0)
+ || ((int) validBox.width < modelPtr->ditherX)) {
+ modelPtr->ditherX = validBox.width;
+ modelPtr->ditherY = 0;
}
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
/*
* Now adjust the sizes of the pixmaps for all of the instances.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -2393,7 +2405,8 @@ MatchFileFormat(
* here. */
int *oldformat) /* Returns 1 if the old image API is used. */
{
- int matched = 0, useoldformat = 0;
+ int matched = 0;
+ int useoldformat = 0;
Tk_PhotoImageFormat *formatPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -2440,7 +2453,8 @@ MatchFileFormat(
}
}
}
- if (formatPtr == NULL) {
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+if (formatPtr == NULL) {
useoldformat = 1;
for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
formatPtr = formatPtr->nextPtr) {
@@ -2474,6 +2488,7 @@ MatchFileFormat(
}
}
}
+#endif
if (formatPtr == NULL) {
if ((formatObj != NULL) && !matched) {
@@ -2593,6 +2608,7 @@ MatchStringFormat(
}
}
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
if (formatPtr == NULL) {
useoldformat = 1;
for (formatPtr = tsdPtr->oldFormatList; formatPtr != NULL;
@@ -2622,6 +2638,7 @@ MatchStringFormat(
}
}
}
+#endif
if (formatPtr == NULL) {
/*
@@ -2680,7 +2697,7 @@ MatchStringFormat(
* Tk_FindPhoto --
*
* This function is called to get an opaque handle (actually a
- * PhotoMaster *) for a given image, which can be used in subsequent
+ * PhotoModel *) for a given image, which can be used in subsequent
* calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of
* the image.
*
@@ -2702,7 +2719,7 @@ Tk_FindPhoto(
{
const Tk_ImageType *typePtr;
ClientData clientData =
- Tk_GetImageMasterData(interp, imageName, &typePtr);
+ Tk_GetImageModelData(interp, imageName, &typePtr);
if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
return NULL;
@@ -2745,7 +2762,7 @@ Tk_PhotoPutBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -2764,12 +2781,12 @@ Tk_PhotoPutBlock(
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if ((width <= 0) || (height <= 0)) {
return TCL_OK;
@@ -2790,11 +2807,24 @@ Tk_PhotoPutBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
- sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height
- * sourceBlock.pitch);
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
+ /*
+ * Fix 5c51be6411: avoid reading
+ *
+ * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
+ *
+ * bytes past the end of modelPtr->pix32[] when
+ *
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
+ * sourceBlock.height * sourceBlock.pitch)
+ */
+ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
+ sourceBlock.width * sourceBlock.pixelSize;
+
+ sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen);
if (sourceBlock.pixelPtr == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -2804,16 +2834,15 @@ Tk_PhotoPutBlock(
return TCL_ERROR;
}
memToFree = sourceBlock.pixelPtr;
- memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, sourceBlock.height
- * sourceBlock.pitch);
+ memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen);
}
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -2823,14 +2852,14 @@ Tk_PhotoPutBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -2848,7 +2877,7 @@ Tk_PhotoPutBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -2856,8 +2885,8 @@ Tk_PhotoPutBlock(
* single memmove, we do.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
- pitch = masterPtr->width * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ pitch = modelPtr->width * 4;
/*
* Test to see if we can do the whole write in a single copy. This test is
@@ -2868,7 +2897,7 @@ Tk_PhotoPutBlock(
if ((sourceBlock.pixelSize == 4)
&& (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3)
&& (width <= sourceBlock.width) && (height <= sourceBlock.height)
- && ((height == 1) || ((x == 0) && (width == masterPtr->width)
+ && ((height == 1) || ((x == 0) && (width == modelPtr->width)
&& (sourceBlock.pitch == pitch)))
&& (compRule == TK_PHOTO_COMPOSITE_SET)) {
memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0],
@@ -3050,8 +3079,8 @@ Tk_PhotoPutBlock(
rect.width = width;
rect.height = height;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
@@ -3060,17 +3089,17 @@ Tk_PhotoPutBlock(
* allow for more efficient per-platform implementations. [Bug 919066]
*/
- TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x,
(unsigned) y, (unsigned) width, (unsigned) height,
- masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
- 4, (unsigned) masterPtr->width * 4);
+ modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3,
+ 4, (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3085,21 +3114,21 @@ Tk_PhotoPutBlock(
* [Patch 1539990]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
int x1;
for (x1=x ; x1<x+width ; x1++) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4;
+ destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
break;
}
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
@@ -3107,21 +3136,21 @@ Tk_PhotoPutBlock(
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height,
+ modelPtr->width, modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3171,7 +3200,7 @@ Tk_PhotoPutZoomedBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -3199,12 +3228,12 @@ Tk_PhotoPutZoomedBlock(
if (zoomX <= 0 || zoomY <= 0) {
return TCL_OK;
}
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if (width <= 0 || height <= 0) {
return TCL_OK;
@@ -3224,11 +3253,24 @@ Tk_PhotoPutZoomedBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
- sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height
- * sourceBlock.pitch);
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
+ /*
+ * Fix 5c51be6411: avoid reading
+ *
+ * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
+ *
+ * bytes past the end of modelPtr->pix32[] when
+ *
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
+ * sourceBlock.height * sourceBlock.pitch)
+ */
+ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
+ sourceBlock.width * sourceBlock.pixelSize;
+
+ sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen);
if (sourceBlock.pixelPtr == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -3238,15 +3280,14 @@ Tk_PhotoPutZoomedBlock(
return TCL_ERROR;
}
memToFree = sourceBlock.pixelPtr;
- memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, sourceBlock.height
- * sourceBlock.pitch);
+ memcpy(sourceBlock.pixelPtr, blockPtr->pixelPtr, cpyLen);
}
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3256,14 +3297,14 @@ Tk_PhotoPutZoomedBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -3281,7 +3322,7 @@ Tk_PhotoPutZoomedBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -3310,7 +3351,7 @@ Tk_PhotoPutZoomedBlock(
* Copy the data into our local 32-bit/pixel array.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0];
if (subsampleX < 0) {
srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize;
@@ -3319,7 +3360,7 @@ Tk_PhotoPutZoomedBlock(
srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch;
}
- pitch = masterPtr->width * 4;
+ pitch = modelPtr->width * 4;
for (hLeft = height; hLeft > 0; ) {
hCopy = MIN(hLeft, blockHt);
hLeft -= hCopy;
@@ -3406,22 +3447,22 @@ Tk_PhotoPutZoomedBlock(
rect.width = width;
rect.height = 1;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
- TkpBuildRegionFromAlphaData(masterPtr->validRegion,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion,
(unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height,
- &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4,
- (unsigned) masterPtr->width * 4);
+ &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4,
+ (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3434,38 +3475,38 @@ Tk_PhotoPutZoomedBlock(
* builds up large simple-alpha images by single pixels. We don't
* negate COMPLEX_ALPHA in this case. [Bug 1409140]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height, modelPtr->width,
+ modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3483,14 +3524,14 @@ Tk_PhotoPutZoomedBlock(
* Tk_DitherPhoto --
*
* This function is called to update an area of each instance's pixmap by
- * dithering the corresponding area of the image master.
+ * dithering the corresponding area of the image model.
*
* Results:
* None.
*
* Side effects:
* The pixmap of each instance of this image gets updated. The fields in
- * *masterPtr indicating which area of the image is correctly dithered
+ * *modelPtr indicating which area of the image is correctly dithered
* get updated.
*
*----------------------------------------------------------------------
@@ -3498,20 +3539,20 @@ Tk_PhotoPutZoomedBlock(
void
Tk_DitherPhoto(
- Tk_PhotoHandle photo, /* Image master whose instances are to be
+ Tk_PhotoHandle photo, /* Image model whose instances are to be
* updated. */
int x, int y, /* Coordinates of the top-left pixel in the
* area to be dithered. */
int width, int height) /* Dimensions of the area to be dithered. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) photo;
+ PhotoModel *modelPtr = (PhotoModel *) photo;
PhotoInstance *instancePtr;
if ((width <= 0) || (height <= 0)) {
return;
}
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgDitherInstance(instancePtr, x, y, width, height);
}
@@ -3521,23 +3562,23 @@ Tk_DitherPhoto(
* will extend the correctly dithered region.
*/
- if (((y < masterPtr->ditherY)
- || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
- && ((y + height) > (masterPtr->ditherY))) {
+ if (((y < modelPtr->ditherY)
+ || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX)))
+ && ((y + height) > (modelPtr->ditherY))) {
/*
* This block starts inside (or immediately after) the correctly
* dithered region, so the first scan line at least will be right.
- * Furthermore this block extends into scanline masterPtr->ditherY.
+ * Furthermore this block extends into scanline modelPtr->ditherY.
*/
- if ((x == 0) && (width == masterPtr->width)) {
+ if ((x == 0) && (width == modelPtr->width)) {
/*
* We are doing the full width, therefore the dithering will be
* correct to the end.
*/
- masterPtr->ditherX = 0;
- masterPtr->ditherY = y + height;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = y + height;
} else {
/*
* We are doing partial scanlines, therefore the
@@ -3545,11 +3586,11 @@ Tk_DitherPhoto(
* line.
*/
- if (x <= masterPtr->ditherX) {
- masterPtr->ditherX = x + width;
- if (masterPtr->ditherX >= masterPtr->width) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY++;
+ if (x <= modelPtr->ditherX) {
+ modelPtr->ditherX = x + width;
+ if (modelPtr->ditherX >= modelPtr->width) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY++;
}
}
}
@@ -3577,29 +3618,29 @@ void
Tk_PhotoBlank(
Tk_PhotoHandle handle) /* Handle for the image to be blanked. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
PhotoInstance *instancePtr;
- masterPtr->ditherX = masterPtr->ditherY = 0;
- masterPtr->flags = 0;
+ modelPtr->ditherX = modelPtr->ditherY = 0;
+ modelPtr->flags = 0;
/*
* The image has valid data nowhere.
*/
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr->validRegion = TkCreateRegion();
/*
* Clear out the 32-bit pixel storage array. Clear out the dithering error
* arrays for each instance.
*/
- memset(masterPtr->pix32, 0,
- ((size_t)masterPtr->width * masterPtr->height * 4));
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ memset(modelPtr->pix32, 0,
+ ((size_t)modelPtr->width * modelPtr->height * 4));
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgResetDither(instancePtr);
}
@@ -3608,8 +3649,8 @@ Tk_PhotoBlank(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
}
/*
@@ -3639,17 +3680,17 @@ Tk_PhotoExpand(
Tk_PhotoHandle handle, /* Handle for the image to be expanded. */
int width, int height) /* Desired minimum dimensions of the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- if (width <= masterPtr->width) {
- width = masterPtr->width;
+ if (width <= modelPtr->width) {
+ width = modelPtr->width;
}
- if (height <= masterPtr->height) {
- height = masterPtr->height;
+ if (height <= modelPtr->height) {
+ height = modelPtr->height;
}
- if ((width != masterPtr->width) || (height != masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
- MAX(height, masterPtr->height)) == TCL_ERROR) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width),
+ MAX(height, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3657,8 +3698,8 @@ Tk_PhotoExpand(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return TCL_OK;
}
@@ -3687,10 +3728,10 @@ Tk_PhotoGetSize(
/* The dimensions of the image are returned
* here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- *widthPtr = masterPtr->width;
- *heightPtr = masterPtr->height;
+ *widthPtr = modelPtr->width;
+ *heightPtr = modelPtr->height;
}
/*
@@ -3719,12 +3760,12 @@ Tk_PhotoSetSize(
* set. */
int width, int height) /* New dimensions for the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- masterPtr->userWidth = width;
- masterPtr->userHeight = height;
- if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
- ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) {
+ modelPtr->userWidth = width;
+ modelPtr->userHeight = height;
+ if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width),
+ ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3732,8 +3773,8 @@ Tk_PhotoSetSize(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -3762,9 +3803,9 @@ TkPhotoGetValidRegion(
Tk_PhotoHandle handle) /* Handle for the image whose valid region is
* to obtained. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- return masterPtr->validRegion;
+ return modelPtr->validRegion;
}
/*
@@ -3790,7 +3831,7 @@ TkPhotoGetValidRegion(
static char *
ImgGetPhoto(
- PhotoMaster *masterPtr, /* Handle for the photo image from which image
+ PhotoModel *modelPtr, /* Handle for the photo image from which image
* data is desired. */
Tk_PhotoImageBlock *blockPtr,
/* Information about the address and layout of
@@ -3800,13 +3841,13 @@ ImgGetPhoto(
unsigned char *pixelPtr;
int x, y, greenOffset, blueOffset, alphaOffset;
- Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr);
+ Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);
blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
+ optPtr->fromX * blockPtr->pixelSize;
blockPtr->width = optPtr->fromX2 - optPtr->fromX;
blockPtr->height = optPtr->fromY2 - optPtr->fromY;
- if (!(masterPtr->flags & COLOR_IMAGE) &&
+ if (!(modelPtr->flags & COLOR_IMAGE) &&
(!(optPtr->options & OPT_BACKGROUND)
|| ((optPtr->background->red == optPtr->background->green)
&& (optPtr->background->red == optPtr->background->blue)))) {
@@ -3834,7 +3875,7 @@ ImgGetPhoto(
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) {
- int newPixelSize,x,y;
+ int newPixelSize;
unsigned char *srcPtr, *destPtr;
char *data;
@@ -3987,12 +4028,12 @@ Tk_PhotoGetImage(
/* Information about the address and layout of
* the image data is returned here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- blockPtr->pixelPtr = masterPtr->pix32;
- blockPtr->width = masterPtr->width;
- blockPtr->height = masterPtr->height;
- blockPtr->pitch = masterPtr->width * 4;
+ blockPtr->pixelPtr = modelPtr->pix32;
+ blockPtr->width = modelPtr->width;
+ blockPtr->height = modelPtr->height;
+ blockPtr->pitch = modelPtr->width * 4;
blockPtr->pixelSize = 4;
blockPtr->offset[0] = 0;
blockPtr->offset[1] = 1;
@@ -4022,15 +4063,13 @@ static int
ImgPhotoPostscript(
ClientData clientData, /* Handle for the photo image. */
Tcl_Interp *interp, /* Interpreter. */
- Tk_Window tkwin, /* (unused) */
+ TCL_UNUSED(Tk_Window), /* (unused) */
Tk_PostscriptInfo psInfo, /* Postscript info. */
int x, int y, /* First pixel to output. */
int width, int height, /* Width and height of area. */
- int prepass) /* (unused) */
+ TCL_UNUSED(int)) /* (unused) */
{
Tk_PhotoImageBlock block;
- (void)tkwin;
- (void)prepass;
Tk_PhotoGetImage(clientData, &block);
block.pixelPtr += y * block.pitch + x * block.pixelSize;
@@ -4043,7 +4082,7 @@ ImgPhotoPostscript(
*
* Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite --
*
- * These backward-compatability functions just exist to fill slots in stubs
+ * These backward-compatibility functions just exist to fill slots in stubs
* table. For the behaviour of *_NoComposite, refer to the corresponding
* function without the extra suffix, except that the compositing rule is
* always "overlay" and the function always panics on memory-allocation
@@ -4084,7 +4123,7 @@ Tk_PhotoPutZoomedBlock_NoComposite(
* Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic,
* Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic
*
- * Backward compatability functions for preserving the old behaviour (i.e.
+ * Backward compatibility functions for preserving the old behaviour (i.e.
* panic on memory allocation failure) so that extensions do not need to be
* significantly updated to take account of TIP #116. These call the new
* interface (i.e. the interface without the extra suffix), but panic if an
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index a84ebb3..d7283b3 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -27,10 +27,11 @@
* Forward declarations of the structures we define.
*/
+#define PhotoMaster PhotoModel
typedef struct ColorTableId ColorTableId;
typedef struct ColorTable ColorTable;
typedef struct PhotoInstance PhotoInstance;
-typedef struct PhotoMaster PhotoMaster;
+typedef struct PhotoModel PhotoModel;
/*
* A signed 8-bit integral type. If chars are unsigned and the compiler isn't
@@ -49,13 +50,6 @@ typedef struct PhotoMaster PhotoMaster;
#endif
/*
- * An unsigned 32-bit integral type, used for pixel values. We use int rather
- * than long here to accommodate those systems where longs are 64 bits.
- */
-
-typedef unsigned int pixel;
-
-/*
* The maximum number of pixels to transmit to the server in a single
* XPutImage call.
*/
@@ -109,10 +103,10 @@ struct ColorTable {
XVisualInfo visualInfo; /* Information about the visual for windows
* using this color table. */
- pixel redValues[256]; /* Maps 8-bit values of red intensity to a
+ unsigned redValues[256]; /* Maps 8-bit values of red intensity to a
* pixel value or index in pixelMap. */
- pixel greenValues[256]; /* Ditto for green intensity. */
- pixel blueValues[256]; /* Ditto for blue intensity. */
+ unsigned greenValues[256]; /* Ditto for green intensity. */
+ unsigned blueValues[256]; /* Ditto for blue intensity. */
unsigned long *pixelMap; /* Actual pixel values allocated. */
unsigned char colorQuant[3][256];
@@ -144,11 +138,11 @@ struct ColorTable {
#define MAP_COLORS 8
/*
- * Definition of the data associated with each photo image master.
+ * Definition of the data associated with each photo image model.
*/
-struct PhotoMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+struct PhotoModel {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter associated with the application
* using this image. */
@@ -171,11 +165,11 @@ struct PhotoMaster {
TkRegion validRegion; /* Tk region indicating which parts of the
* image have valid image data. */
PhotoInstance *instancePtr; /* First in the list of instances associated
- * with this master. */
+ * with this model. */
};
/*
- * Bit definitions for the flags field of a PhotoMaster.
+ * Bit definitions for the flags field of a PhotoModel.
* COLOR_IMAGE: 1 means that the image has different color
* components.
* IMAGE_CHANGED: 1 means that the instances of this image need
@@ -202,12 +196,12 @@ struct PhotoMaster {
*/
struct PhotoInstance {
- PhotoMaster *masterPtr; /* Pointer to master for image. */
+ PhotoModel *modelPtr; /* Pointer to model for image. */
Display *display; /* Display for windows using this instance. */
Colormap colormap; /* The image may only be used in windows with
* this particular colormap. */
PhotoInstance *nextPtr; /* Pointer to the next instance in the list of
- * instances associated with this master. */
+ * instances associated with this model. */
#if TCL_MAJOR_VERSION > 8
size_t refCount; /* Number of instances using this structure. */
#else
@@ -216,7 +210,7 @@ struct PhotoInstance {
Tk_Uid palette; /* Palette for these particular instances. */
double gamma; /* Gamma value for these instances. */
Tk_Uid defaultPalette; /* Default palette to use if a palette is not
- * specified for the master. */
+ * specified for the model. */
ColorTable *colorTablePtr; /* Pointer to information about colors
* allocated for image display in windows like
* this one. */
diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index 7575f86..4cdb648 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -5,14 +5,14 @@
*
* Copyright (c) 2013-14 Mikko Mononen memon@inside.org
* Copyright (c) 2018 Christian Gollwitzer auriocus@gmx.de
+ * Copyright (c) 2018 Christian Werner https://www.androwish.org/
* Copyright (c) 2018 Rene Zaumseil r.zaumseil@freenet.de
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* This handler is build using the original nanosvg library files from
- * https://github.com/memononen/nanosvg and the tcl extension files from
- * https://github.com/auriocus/tksvg
+ * https://github.com/memononen/nanosvg
*
*/
@@ -336,7 +336,7 @@ ParseSVGWithOptions(
static const char *const fmtOptions[] = {
"-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH
};
@@ -394,7 +394,7 @@ ParseSVGWithOptions(
/*
* check that only one scale option is given
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum)optIndex) {
case OPT_SCALE:
case OPT_SCALE_TO_HEIGHT:
case OPT_SCALE_TO_WIDTH:
@@ -414,7 +414,7 @@ ParseSVGWithOptions(
/*
* Decode parameters
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_DPI:
if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) {
goto error;
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index b5e4d3c..7886355 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -635,8 +635,16 @@ declare 184 {
double y, double angle)
}
+# Support for aqua's inability to draw outside [NSView drawRect:]
+declare 185 macosx {
+ void TkpRedrawWidget(Tk_Window tkwin)
+}
+declare 186 macosx {
+ int TkpWillDrawWidget(Tk_Window tkwin)
+}
+
# Debugging / testing functions for photo images
-declare 185 {
+declare 187 {
int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
}
@@ -910,9 +918,10 @@ declare 9 aqua {
declare 10 aqua {
int TkMacOSXDispatchMenuEvent(int menuID, int index)
}
-declare 11 aqua {
- void TkMacOSXInstallCursor(int resizeOverride)
-}
+# Now a static function
+# declare 11 aqua {
+# void TkMacOSXInstallCursor(int resizeOverride)
+# }
declare 12 aqua {
void TkMacOSXHandleTearoffMenu(void)
}
@@ -954,9 +963,10 @@ declare 24 aqua {
declare 25 aqua {
void TkMacOSXMenuClick(void)
}
-declare 26 aqua {
- void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
-}
+# The corresponding Unregister was not a stub, and this should be static.
+#declare 26 aqua {
+# void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
+#}
declare 27 aqua {
int TkMacOSXResizable(TkWindow *winPtr)
}
@@ -975,9 +985,10 @@ declare 31 aqua {
declare 32 aqua {
void TkMacOSXUpdateClipRgn(TkWindow *winPtr)
}
-declare 33 aqua {
- void TkMacOSXUnregisterMacWindow(void *portPtr)
-}
+# This was not implemented. Perhaps meant to be OffScreen ?
+#declare 33 aqua {
+# void TkMacOSXUnregisterMacWindow(void *portPtr)
+#}
declare 34 aqua {
int TkMacOSXUseMenuID(short macID)
}
@@ -1019,7 +1030,7 @@ declare 47 aqua {
Tk_Window TkpGetCapture(void)
}
declare 49 aqua {
- Tk_Window TkGetTransientMaster(TkWindow *winPtr)
+ Tk_Window TkMacOSXGetContainer(TkWindow *winPtr)
}
declare 50 aqua {
int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state)
@@ -1923,6 +1934,10 @@ declare 104 macosx {
declare 105 macosx {
XHostAddress *XListHosts(Display *d, int *i, Bool *b)
}
+declare 106 macosx {
+ int XSetClipRectangles(Display *display, GC gc, int clip_x_origin,
+ int clip_y_origin, XRectangle rectangles[], int n, int ordering)
+}
declare 107 macosx {
int XFlush(Display *display)
}
diff --git a/generic/tkInt.h b/generic/tkInt.h
index ab06435..ac3667b 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -88,6 +88,16 @@
# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TKFLEXARRAY 0
+#else
+# define TKFLEXARRAY 1
+#endif
+
+#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
+# define Tcl_GetParent Tcl_GetMaster
+#endif
+
/*
* Macros used to cast between pointers and integers (e.g. when storing an int
* in ClientData), on 64-bit architectures they avoid gcc warning about "cast
@@ -359,12 +369,12 @@ typedef struct TkDisplay {
*/
Tcl_HashTable maintainHashTable;
- /* Hash table that maps from a master's
- * Tk_Window token to a list of slaves managed
- * by that master. */
+ /* Hash table that maps from a container's
+ * Tk_Window token to a list of windows managed
+ * by that container. */
int geomInit;
-#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
+#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)
/*
@@ -442,9 +452,9 @@ typedef struct TkDisplay {
*/
int placeInit; /* 0 means tables below need initializing. */
- Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
+ Tcl_HashTable containerTable; /* Maps from Tk_Window token to the Container
* structure for the window, if it exists. */
- Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
+ Tcl_HashTable contentTable; /* Maps from Tk_Window token to the Content
* structure for the window, if it exists. */
/*
@@ -576,14 +586,11 @@ typedef struct TkDisplay {
* Whether to use input methods for this display
* TK_DISPLAY_WM_TRACING: (default off)
* Whether we should do wm tracing on this display.
- * TK_DISPLAY_IN_WARP: (default off)
- * Indicates that we are in a pointer warp
*/
#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0)
#define TK_DISPLAY_USE_IM (1 << 1)
#define TK_DISPLAY_WM_TRACING (1 << 3)
-#define TK_DISPLAY_IN_WARP (1 << 4)
/*
* One of the following structures exists for each error handler created by a
@@ -679,7 +686,7 @@ typedef struct TkMainInfo {
/* Top level of option hierarchy for this main
* window. NULL means uninitialized. Managed
* by tkOption.c. */
- Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster
+ Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel
* structures. Managed by tkImage.c. */
int strictMotif; /* This is linked to the tk_strictMotif global
* variable. */
@@ -726,7 +733,7 @@ typedef struct TkWindow {
Visual *visual; /* Visual to use for window. If not default,
* MUST be set before X window is created. */
int depth; /* Number of bits/pixel. */
- Window window; /* X's id for window. NULL means window hasn't
+ Window window; /* X's id for window. None means window hasn't
* actually been created yet, or it's been
* deleted. */
struct TkWindow *childList; /* First in list of child windows, or NULL if
@@ -874,9 +881,9 @@ typedef struct TkWindow {
#endif /* TK_USE_INPUT_METHODS */
char *geomMgrName; /* Records the name of the geometry manager. */
struct TkWindow *maintainerPtr;
- /* The geometry master for this window. The
- * value is NULL if the window has no master or
- * if its master is its parent. */
+ /* The geometry container for this window. The
+ * value is NULL if the window has no container or
+ * if its container is its parent. */
#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9)
XIC inputContext; /* XIM input context. */
int ximGeneration; /* Used to invalidate XIC */
@@ -1004,6 +1011,11 @@ typedef struct TkpClipMask {
#define ALT_MASK (AnyModifier<<2)
#define EXTENDED_MASK (AnyModifier<<3)
+/*
+ * Buttons 8 and 9 are the Xbuttons (left and right side-buttons). On Windows/Mac, those
+ * are known as Buttons 4 and 5. At script level, they also get the numbers 4 and 5.
+ */
+
#ifndef Button8
# define Button8 8
#endif
@@ -1034,8 +1046,6 @@ typedef struct TkpClipMask {
|Button6Mask|Button7Mask|Button8Mask|Button9Mask)
-MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int);
-
/*
* Object types not declared in tkObj.c need to be mentioned here so they can
* be properly registered with Tcl:
@@ -1111,6 +1121,10 @@ void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
#include "tkIntDecls.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Themed widget set init function:
*/
@@ -1263,13 +1277,10 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData,
MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *objPtr,
- double *doublePtr);
-MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp,
- Tk_Window tkwin, const char *master);
-MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin,
- const char *master);
+MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp,
+ Tk_Window tkwin, const char *name);
+MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin,
+ const char *name);
MODULE_SCOPE void TkEventInit(void);
MODULE_SCOPE void TkRegisterObjTypes(void);
@@ -1311,11 +1322,14 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
int *pad1Ptr, int *pad2Ptr);
MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr);
MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr);
-MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin);
MODULE_SCOPE void TkpDrawCharsInContext(Display * display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
int rangeLength, int x, int y);
+MODULE_SCOPE void TkpDrawAngledCharsInContext(Display * display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, double x, double y, double angle);
MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
int rangeLength, int maxLength, int flags,
@@ -1329,7 +1343,6 @@ MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable,
Tk_3DBorder border, int highlightWidth,
int borderWidth, int relief);
-MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin,
@@ -1339,8 +1352,6 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
TkBusy busy);
MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv, int flags);
-MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin,
- const char *eventName, Tcl_Obj *detail);
MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
const char *nsname, const char *name,
ClientData clientData, const TkEnsemble *map);
@@ -1350,8 +1361,8 @@ MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
ClientData clientData);
MODULE_SCOPE void TkInitEmbeddedConfigurationInformation(
Tcl_Interp *interp);
+MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr);
MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr);
-MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr);
MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
Tcl_Interp *interp, Tcl_Obj *listObj,
int toplevel, Tcl_Obj *nameObj);
@@ -1360,6 +1371,7 @@ MODULE_SCOPE void TkRotatePoint(double originX, double originY,
double *yPtr);
MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*);
+#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1)
#ifdef _WIN32
#define TkParseColor XParseColor
@@ -1440,6 +1452,10 @@ MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp);
MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKINT */
/*
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 619e3cf..6741704 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -558,7 +558,15 @@ EXTERN void TkDrawAngledChars(Display *display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, double x,
double y, double angle);
+#ifdef MAC_OSX_TCL /* MACOSX */
/* 185 */
+EXTERN void TkpRedrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+/* 186 */
+EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
+/* 187 */
EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter,
Tcl_Obj *data, Tcl_Obj *formatString,
int *widthPtr, int *heightPtr);
@@ -779,7 +787,25 @@ typedef struct TkIntStubs {
void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */
- int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 185 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved185)(void);
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ void (*reserved185)(void);
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved186)(void);
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ void (*reserved186)(void);
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */
+#endif /* MACOSX */
+ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 187 */
} TkIntStubs;
extern const TkIntStubs *tkIntStubsPtr;
@@ -1152,8 +1178,16 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */
#define TkDrawAngledChars \
(tkIntStubsPtr->tkDrawAngledChars) /* 184 */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#define TkpRedrawWidget \
+ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+#define TkpWillDrawWidget \
+ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */
+#endif /* MACOSX */
#define TkDebugPhotoStringMatchDef \
- (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 185 */
+ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 187 */
#endif /* defined(USE_TK_STUBS) */
@@ -1171,4 +1205,11 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
+#if !defined(MAC_OSX_TK)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+# define TkpWillDrawWidget(w) 0
+# define TkpRedrawWidget(w)
+#endif
+
#endif /* _TKINTDECLS */
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index aecc222..348868b 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -170,8 +170,7 @@ EXTERN unsigned int TkMacOSXButtonKeyState(void);
EXTERN void TkMacOSXClearMenubarActive(void);
/* 10 */
EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index);
-/* 11 */
-EXTERN void TkMacOSXInstallCursor(int resizeOverride);
+/* Slot 11 is reserved */
/* 12 */
EXTERN void TkMacOSXHandleTearoffMenu(void);
/* Slot 13 is reserved */
@@ -199,9 +198,7 @@ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr);
EXTERN void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
/* 25 */
EXTERN void TkMacOSXMenuClick(void);
-/* 26 */
-EXTERN void TkMacOSXRegisterOffScreenWindow(Window window,
- void *portPtr);
+/* Slot 26 is reserved */
/* 27 */
EXTERN int TkMacOSXResizable(TkWindow *winPtr);
/* 28 */
@@ -214,8 +211,7 @@ EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable);
EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort);
/* 32 */
EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
-/* 33 */
-EXTERN void TkMacOSXUnregisterMacWindow(void *portPtr);
+/* Slot 33 is reserved */
/* 34 */
EXTERN int TkMacOSXUseMenuID(short macID);
/* 35 */
@@ -248,7 +244,7 @@ EXTERN int TkpIsWindowFloating(void *window);
EXTERN Tk_Window TkpGetCapture(void);
/* Slot 48 is reserved */
/* 49 */
-EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr);
+EXTERN Tk_Window TkMacOSXGetContainer(TkWindow *winPtr);
/* 50 */
EXTERN int TkGenerateButtonEvent(int x, int y, Window window,
unsigned int state);
@@ -405,7 +401,7 @@ typedef struct TkIntPlatStubs {
unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */
void (*tkMacOSXClearMenubarActive) (void); /* 9 */
int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */
- void (*tkMacOSXInstallCursor) (int resizeOverride); /* 11 */
+ void (*reserved11)(void);
void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */
void (*reserved13)(void);
int (*tkMacOSXDoHLEvent) (void *theEvent); /* 14 */
@@ -420,14 +416,14 @@ typedef struct TkIntPlatStubs {
void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */
void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
void (*tkMacOSXMenuClick) (void); /* 25 */
- void (*tkMacOSXRegisterOffScreenWindow) (Window window, void *portPtr); /* 26 */
+ void (*reserved26)(void);
int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */
void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */
void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */
void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */
void (*tkMacOSXSetUpGraphicsPort) (GC gc, void *destPort); /* 31 */
void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
- void (*tkMacOSXUnregisterMacWindow) (void *portPtr); /* 33 */
+ void (*reserved33)(void);
int (*tkMacOSXUseMenuID) (short macID); /* 34 */
Region (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */
@@ -443,7 +439,7 @@ typedef struct TkIntPlatStubs {
int (*tkpIsWindowFloating) (void *window); /* 46 */
Tk_Window (*tkpGetCapture) (void); /* 47 */
void (*reserved48)(void);
- Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */
+ Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */
int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */
void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */
void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */
@@ -631,8 +627,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */
#define TkMacOSXDispatchMenuEvent \
(tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */
-#define TkMacOSXInstallCursor \
- (tkIntPlatStubsPtr->tkMacOSXInstallCursor) /* 11 */
+/* Slot 11 is reserved */
#define TkMacOSXHandleTearoffMenu \
(tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */
/* Slot 13 is reserved */
@@ -657,8 +652,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */
#define TkMacOSXMenuClick \
(tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */
-#define TkMacOSXRegisterOffScreenWindow \
- (tkIntPlatStubsPtr->tkMacOSXRegisterOffScreenWindow) /* 26 */
+/* Slot 26 is reserved */
#define TkMacOSXResizable \
(tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */
#define TkMacOSXSetHelpMenuItemCount \
@@ -671,8 +665,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */
#define TkMacOSXUpdateClipRgn \
(tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */
-#define TkMacOSXUnregisterMacWindow \
- (tkIntPlatStubsPtr->tkMacOSXUnregisterMacWindow) /* 33 */
+/* Slot 33 is reserved */
#define TkMacOSXUseMenuID \
(tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */
#define TkMacOSXVisableClipRgn \
@@ -701,8 +694,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkpGetCapture \
(tkIntPlatStubsPtr->tkpGetCapture) /* 47 */
/* Slot 48 is reserved */
-#define TkGetTransientMaster \
- (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 */
+#define TkMacOSXGetContainer \
+ (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */
#define TkGenerateButtonEvent \
(tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */
#define TkGenWMDestroyEvent \
@@ -798,6 +791,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
#undef TkGenerateActivateEvents_
+#undef TkMacOSXSetUpClippingRgn
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 774075d..fe11c09 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -38,6 +38,10 @@
# endif
#endif
+#if defined(MAC_OSX_TK) && !defined(MAC_OSX_TCL)
+# define MAC_OSX_TCL 1
+#endif
+
typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */
Display* /* display */
);
@@ -765,7 +769,10 @@ EXTERN Status XIconifyWindow(Display *d, Window w, int i);
EXTERN Status XWithdrawWindow(Display *d, Window w, int i);
/* 105 */
EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b);
-/* Slot 106 is reserved */
+/* 106 */
+EXTERN int XSetClipRectangles(Display *display, GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XRectangle rectangles[], int n, int ordering);
/* 107 */
EXTERN int XFlush(Display *display);
/* 108 */
@@ -1162,7 +1169,7 @@ typedef struct TkIntXlibStubs {
Status (*xIconifyWindow) (Display *d, Window w, int i); /* 103 */
Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 104 */
XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 105 */
- void (*reserved106)(void);
+ int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 106 */
int (*xFlush) (Display *display); /* 107 */
int (*xGrabServer) (Display *display); /* 108 */
int (*xUngrabServer) (Display *display); /* 109 */
@@ -1748,7 +1755,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xWithdrawWindow) /* 104 */
#define XListHosts \
(tkIntXlibStubsPtr->xListHosts) /* 105 */
-/* Slot 106 is reserved */
+#define XSetClipRectangles \
+ (tkIntXlibStubsPtr->xSetClipRectangles) /* 106 */
#define XFlush \
(tkIntXlibStubsPtr->xFlush) /* 107 */
#define XGrabServer \
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index d190adc..7bca20e 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -579,7 +579,7 @@ Tk_ListboxObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(listPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(listPtr->tkwin));
return TCL_OK;
}
@@ -842,7 +842,7 @@ ListboxWidgetObjCmd(
if (result != TCL_OK) {
break;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
result = TCL_OK;
break;
@@ -906,7 +906,7 @@ ListboxWidgetObjCmd(
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "index ?-option? ?value? ?-option value ...?");
+ "index ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -2742,7 +2742,7 @@ GetListboxIndex(
result = TkGetIntForIndex(indexObj, listPtr->nElements - 1, lastOK, &idx);
if (result == TCL_OK) {
- if (idx + 1 > (TkSizeT)listPtr->nElements + 1) {
+ if ((idx != TCL_INDEX_NONE) && (idx > (TkSizeT)listPtr->nElements)) {
idx = listPtr->nElements;
}
*indexPtr = (int)idx;
@@ -3229,7 +3229,7 @@ static void
GenerateListboxSelectEvent(
Listbox *listPtr) /* Information about widget. */
{
- TkSendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
+ Tk_SendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
}
/*
@@ -3324,7 +3324,7 @@ ListboxUpdateVScrollbar(
/*
* We must hold onto the interpreter from the listPtr because the data at
- * listPtr might be freed as a result of the Tcl_VarEval.
+ * listPtr might be freed as a result of the Tcl_EvalEx.
*/
interp = listPtr->interp;
@@ -3335,7 +3335,7 @@ ListboxUpdateVScrollbar(
Tcl_DStringAppend(&buf, firstStr, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, lastStr, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -3396,7 +3396,7 @@ ListboxUpdateHScrollbar(
/*
* We must hold onto the interpreter because the data referred to at
- * listPtr might be freed as a result of the call to Tcl_VarEval.
+ * listPtr might be freed as a result of the call to Tcl_EvalEx.
*/
interp = listPtr->interp;
@@ -3407,7 +3407,7 @@ ListboxUpdateHScrollbar(
Tcl_DStringAppend(&buf, firstStr, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, lastStr, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp,
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 879a7c0..2a445e2 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -32,6 +32,9 @@ static const char DEFAULT_PRIMARY_PROMPT[] = "% ";
* to strcmp here.
*/
#ifdef _WIN32
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
@@ -41,7 +44,10 @@ typedef struct TclIntPlatStubs {
void (*dummy[16]) (void); /* dummy entries 0-15, not used */
int (*tclpIsAtty) (int fd); /* 16 */
} TclIntPlatStubs;
-const TclIntPlatStubs *tclIntPlatStubsPtr;
+extern const TclIntPlatStubs *tclIntPlatStubsPtr;
+#ifdef __cplusplus
+}
+#endif
# include "tkWinInt.h"
#else
# define TCHAR char
@@ -397,19 +403,18 @@ Tk_MainEx(
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
- int mask) /* Not used. */
+ TCL_UNUSED(int))
{
char *cmd;
int code;
- size_t count;
+ TkSizeT count;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Interp *interp = isPtr->interp;
- (void)mask;
- count = (size_t)Tcl_Gets(chan, &isPtr->line);
+ count = Tcl_Gets(chan, &isPtr->line);
- if (count == (size_t)-1 && !isPtr->gotPartial) {
+ if ((count == TCL_IO_FAILURE) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 3b50daa..a67be21 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -39,12 +39,12 @@
* right; they have a Tk window and pathname associated with them; they have a
* TkMenu structure and array of entries. However, they are linked with the
* original menu that they were cloned from. They reflect the attributes of the
- * original, or "master", menu. So if an item is added to a menu, and that
+ * original, or "main", menu. So if an item is added to a menu, and that
* menu has clones, then the item must be added to all of its clones also.
* Menus are cloned when a menu is torn-off or when a menu is assigned as a
* menubar using the "-menu" option of the toplevel's pathname configure
* subcommand. When a clone is destroyed, only the clone is destroyed, but
- * when the master menu is destroyed, all clones are also destroyed. This
+ * when the main menu is destroyed, all clones are also destroyed. This
* allows the developer to just deal with one set of menus when creating and
* destroying.
*
@@ -461,7 +461,7 @@ Tk_MenuObjCmd(
MenuCmdDeletedProc);
menuPtr->active = TCL_INDEX_NONE;
menuPtr->cursorPtr = NULL;
- menuPtr->masterMenuPtr = menuPtr;
+ menuPtr->mainMenuPtr = menuPtr;
menuPtr->menuType = UNKNOWN_TYPE;
TkMenuInitializeDrawingFields(menuPtr);
@@ -518,7 +518,7 @@ Tk_MenuObjCmd(
nextCascadePtr = cascadeListPtr->nextCascadePtr;
/*
- * If we have a new master menu, and an existing cloned menu
+ * If we have a new main menu, and an existing cloned menu
* points to this menu in a cascade entry, we have to clone the
* new menu and point the entry to the clone instead of the menu
* we are creating. Otherwise, ConfigureMenuEntry will hook up the
@@ -526,9 +526,9 @@ Tk_MenuObjCmd(
* creating exists.
*/
- if ((menuPtr->masterMenuPtr != menuPtr)
- || ((menuPtr->masterMenuPtr == menuPtr)
- && ((cascadeListPtr->menuPtr->masterMenuPtr
+ if ((menuPtr->mainMenuPtr != menuPtr)
+ || ((menuPtr->mainMenuPtr == menuPtr)
+ && ((cascadeListPtr->menuPtr->mainMenuPtr
== cascadeListPtr->menuPtr)))) {
newObjv[0] = Tcl_NewStringObj("-menu", -1);
newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1);
@@ -593,7 +593,7 @@ Tk_MenuObjCmd(
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj(menuPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(menuPtr->tkwin));
return TCL_OK;
}
@@ -845,9 +845,8 @@ MenuWidgetObjCmd(
}
if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
- } else {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
- }
+ } else
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
case MENU_INSERT:
@@ -1027,7 +1026,7 @@ TkInvokeMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, "tk::TearOffMenu ", -1);
Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&ds);
} else if ((mePtr->type == CHECK_BUTTON_ENTRY)
&& (mePtr->namePtr != NULL)) {
@@ -1108,8 +1107,8 @@ DestroyMenuInstance(
TkMenu *menuInstancePtr;
TkMenuEntry *cascadePtr, *nextCascadePtr;
Tcl_Obj *newObjv[2];
- TkMenu *parentMasterMenuPtr;
- TkMenuEntry *parentMasterEntryPtr;
+ TkMenu *parentMainMenuPtr;
+ TkMenuEntry *parentMainEntryPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1118,11 +1117,11 @@ DestroyMenuInstance(
* entries need to be told that the menu is going away. We need to clear
* the menu ptr field in the menu reference at this point in the code so
* that everything else can forget about this menu properly. We also need
- * to reset -menu field of all entries that are not master menus back to
- * this entry name if this is a master menu pointed to by another master
+ * to reset -menu field of all entries that are not main menus back to
+ * this entry name if this is a main menu pointed to by another main
* menu. If there is a clone menu that points to this menu, then this menu
* is itself a clone, so when this menu goes away, the -menu field of the
- * pointing entry must be set back to this menu's master menu name so that
+ * pointing entry must be set back to this menu's main menu name so that
* later if another menu is created the cascade hierarchy can be
* maintained.
*/
@@ -1140,14 +1139,14 @@ DestroyMenuInstance(
for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) {
nextCascadePtr = cascadePtr->nextCascadePtr;
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- parentMasterMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
- parentMasterEntryPtr =
- parentMasterMenuPtr->entries[cascadePtr->index];
+ parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr;
+ parentMainEntryPtr =
+ parentMainMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
- newObjv[1] = parentMasterEntryPtr->namePtr;
+ newObjv[1] = parentMainEntryPtr->namePtr;
/*
* It is possible that the menu info is out of sync, and these
@@ -1166,8 +1165,8 @@ DestroyMenuInstance(
}
}
- if (menuPtr->masterMenuPtr != menuPtr) {
- for (menuInstancePtr = menuPtr->masterMenuPtr;
+ if (menuPtr->mainMenuPtr != menuPtr) {
+ for (menuInstancePtr = menuPtr->mainMenuPtr;
menuInstancePtr != NULL;
menuInstancePtr = menuInstancePtr->nextInstancePtr) {
if (menuInstancePtr->nextInstancePtr == menuPtr) {
@@ -1177,7 +1176,7 @@ DestroyMenuInstance(
}
}
} else if (menuPtr->nextInstancePtr != NULL) {
- Tcl_Panic("Attempting to delete master menu when there are still clones");
+ Tcl_Panic("Attempting to delete main menu when there are still clones");
}
/*
@@ -1217,8 +1216,8 @@ DestroyMenuInstance(
*
* This function is invoked by Tcl_EventuallyFree or Tcl_Release to clean
* up the internal structure of a menu at a safe time (when no-one is
- * using it anymore). If called on a master instance, destroys all of the
- * slave instances. If called on a non-master instance, just destroys
+ * using it anymore). If called on a main instance, destroys all of the
+ * instances. If called on a non-main instance, just destroys
* that instance.
*
* Results:
@@ -1264,7 +1263,7 @@ TkDestroyMenu(
topLevelListPtr = nextTopLevelPtr;
}
}
- if (menuPtr->masterMenuPtr == menuPtr) {
+ if (menuPtr->mainMenuPtr == menuPtr) {
while (menuPtr->nextInstancePtr != NULL) {
menuInstancePtr = menuPtr->nextInstancePtr;
menuPtr->nextInstancePtr = menuInstancePtr->nextInstancePtr;
@@ -1412,7 +1411,7 @@ DestroyMenuEntry(
*/
if (mePtr->type == CASCADE_ENTRY) {
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
TkMenu *destroyThis = NULL;
TkMenuReferences *menuRefPtr = mePtr->childMenuRefPtr;
@@ -1432,7 +1431,7 @@ DestroyMenuEntry(
*/
if ((destroyThis != NULL)
- && (destroyThis->masterMenuPtr == destroyThis)) {
+ && (destroyThis->mainMenuPtr == destroyThis)) {
destroyThis = NULL;
}
}
@@ -1538,14 +1537,14 @@ ConfigureMenu(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
result = Tk_SetOptions(interp, menuListPtr,
tsdPtr->menuOptionTable, objc, objv,
menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
if (result != TCL_OK) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1579,7 +1578,7 @@ ConfigureMenu(
* menuTypeName field to tell that this is a menu bar.
*/
- if (menuListPtr->menuType == MASTER_MENU) {
+ if (menuListPtr->menuType == MAIN_MENU) {
int typeFlag = TK_MAKE_MENU_POPUP;
Tk_Window tkwin = menuPtr->tkwin;
@@ -1614,7 +1613,7 @@ ConfigureMenu(
if ((menuListPtr->numEntries == 0)
|| (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) {
if (MenuNewEntry(menuListPtr, 0, TEAROFF_ENTRY) == NULL) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1631,7 +1630,6 @@ ConfigureMenu(
}
} else if ((menuListPtr->numEntries > 0)
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
- int i;
Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry);
@@ -1664,7 +1662,7 @@ ConfigureMenu(
TkEventuallyRecomputeMenu(menuListPtr);
}
- for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != NULL;
+ for (cleanupPtr = menuPtr->mainMenuPtr; cleanupPtr != NULL;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_FreeSavedOptions(cleanupPtr->errorStructPtr);
ckfree(cleanupPtr->errorStructPtr);
@@ -1826,7 +1824,6 @@ PostProcessEntry(
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
Tcl_Obj *valuePtr;
- const char *name;
if (mePtr->namePtr == NULL) {
if (mePtr->labelPtr == NULL) {
@@ -1990,14 +1987,14 @@ ConfigureMenuCloneEntries(
/*
* Cascades are kind of tricky here. This is special case #3 in the
- * comment at the top of this file. Basically, if a menu is the master
+ * comment at the top of this file. Basically, if a menu is the main
* menu of a clone chain, and has an entry with a cascade menu, the clones
* of the menu will point to clones of the cascade menu. We have to
* destroy the clones of the cascades, clone the new cascade menu, and
* configure the entry to point to the new clone.
*/
- mePtr = menuPtr->masterMenuPtr->entries[index];
+ mePtr = menuPtr->mainMenuPtr->entries[index];
if (mePtr->type == CASCADE_ENTRY) {
oldCascadePtr = mePtr->namePtr;
if (oldCascadePtr != NULL) {
@@ -2042,7 +2039,7 @@ ConfigureMenuCloneEntries(
}
}
- for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
+ for (menuListPtr = menuPtr->mainMenuPtr->nextInstancePtr;
menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
@@ -2129,7 +2126,8 @@ GetMenuIndex(
const char *string;
if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) {
- if (*indexPtr != TCL_INDEX_NONE) {
+ /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */
+ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') {
if (*indexPtr >= menuPtr->numEntries) {
*indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
}
@@ -2361,7 +2359,7 @@ MenuAddOrInsert(
}
if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\"", Tcl_GetString(indexPtr)));
+ "bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
return TCL_ERROR;
}
@@ -2382,7 +2380,7 @@ MenuAddOrInsert(
* Now we have to add an entry for every instance related to this menu.
*/
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
mePtr = MenuNewEntry(menuListPtr, index, type);
@@ -2393,7 +2391,7 @@ MenuAddOrInsert(
TkMenu *errorMenuPtr;
TkSizeT i;
- for (errorMenuPtr = menuPtr->masterMenuPtr;
+ for (errorMenuPtr = menuPtr->mainMenuPtr;
errorMenuPtr != NULL;
errorMenuPtr = errorMenuPtr->nextInstancePtr) {
Tcl_EventuallyFree(errorMenuPtr->entries[index],
@@ -2417,7 +2415,7 @@ MenuAddOrInsert(
* If a menu has cascades, then every instance of the menu has to have
* its own parallel cascade structure. So adding an entry to a menu
* with clones means that the menu that the entry points to has to be
- * cloned for every clone the master menu has. This is special case #2
+ * cloned for every clone the main menu has. This is special case #2
* in the comment at the top of this file.
*/
@@ -2426,7 +2424,7 @@ MenuAddOrInsert(
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
TkMenu *cascadeMenuPtr =
- mePtr->childMenuRefPtr->menuPtr->masterMenuPtr;
+ mePtr->childMenuRefPtr->menuPtr->mainMenuPtr;
Tcl_Obj *newCascadePtr, *newObjv[2];
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
Tcl_Obj *windowNamePtr =
@@ -2700,7 +2698,7 @@ CloneMenu(
Tcl_Obj *menuDupCommandArray[4];
if (newMenuTypePtr == NULL) {
- menuType = MASTER_MENU;
+ menuType = MAIN_MENU;
} else {
if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr,
menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) {
@@ -2735,7 +2733,7 @@ CloneMenu(
&& (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) {
TkMenu *newMenuPtr = menuRefPtr->menuPtr;
Tcl_Obj *newObjv[3];
- int i, numElements;
+ int numElements;
/*
* Now put this newly created menu into the parent menu's instance
@@ -2744,18 +2742,18 @@ CloneMenu(
if (menuPtr->nextInstancePtr == NULL) {
menuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = menuPtr->masterMenuPtr;
+ newMenuPtr->mainMenuPtr = menuPtr->mainMenuPtr;
} else {
- TkMenu *masterMenuPtr;
+ TkMenu *mainMenuPtr;
- masterMenuPtr = menuPtr->masterMenuPtr;
- newMenuPtr->nextInstancePtr = masterMenuPtr->nextInstancePtr;
- masterMenuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = masterMenuPtr;
+ mainMenuPtr = menuPtr->mainMenuPtr;
+ newMenuPtr->nextInstancePtr = mainMenuPtr->nextInstancePtr;
+ mainMenuPtr->nextInstancePtr = newMenuPtr;
+ newMenuPtr->mainMenuPtr = mainMenuPtr;
}
/*
- * Add the master menu's window to the bind tags for this window after
+ * Add the main menu's window to the bind tags for this window after
* this window's tag. This is so the user can bind to either this
* clone (which may not be easy to do) or the entire menu clone
* structure.
@@ -2781,7 +2779,7 @@ CloneMenu(
if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
== 0) {
Tcl_Obj *newElementPtr = Tcl_NewStringObj(
- Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), -1);
/*
* The newElementPtr will have its refCount incremented
@@ -3181,7 +3179,7 @@ TkSetWindowMenuBar(
menuPtr = menuRefPtr->menuPtr;
- for (instancePtr = menuPtr->masterMenuPtr;
+ for (instancePtr = menuPtr->mainMenuPtr;
instancePtr != NULL;
instancePtr = instancePtr->nextInstancePtr) {
if (instancePtr->menuType == MENUBAR
@@ -3529,7 +3527,7 @@ DeleteMenuCloneEntries(
int numDeleted, i, j;
numDeleted = last + 1 - first;
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
for (i = last; i >= first; i--) {
Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry);
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index ecb6fac..ee7405a 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -185,7 +185,7 @@ typedef struct TkMenuEntry {
* the menu. */
/*
- * Bookeeping for master menus and cascade menus.
+ * Bookeeping for main menus and cascade menus.
*/
struct TkMenuReferences *childMenuRefPtr;
@@ -266,7 +266,7 @@ typedef struct TkMenu {
TkSizeT numEntries; /* Number of elements in entries. */
TkSizeT active; /* Index of active entry. TCL_INDEX_NONE means
* nothing active. */
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See
+ int menuType; /* MAIN_MENU, TEAROFF_MENU, or MENUBAR. See
* below for definitions. */
Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a
* toplevel or not. "normal", "menubar", or
@@ -351,10 +351,10 @@ typedef struct TkMenu {
struct TkMenu *nextInstancePtr;
/* The next instance of this menu in the
* chain. */
- struct TkMenu *masterMenuPtr;
+ struct TkMenu *mainMenuPtr;
/* A pointer to the original menu for this
* clone chain. Points back to this structure
- * if this menu is a master menu. */
+ * if this menu is a main menu. */
void *reserved1; /* not used any more. */
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
* toplevel that owns the menu. Only
@@ -434,7 +434,7 @@ typedef struct TkMenuReferences {
* MENU_DELETION_PENDING Non-zero means that we are currently
* destroying this menu's internal structures.
* This is useful when we are in the middle of
- * cleaning this master menu's chain of menus up
+ * cleaning this main menu's chain of menus up
* when TkDestroyMenu was called again on this
* menu (via a destroy binding or somesuch).
* MENU_WIN_DESTRUCTION_PENDING Non-zero means we are in the middle of
@@ -452,16 +452,16 @@ typedef struct TkMenuReferences {
#define MENU_PLATFORM_FLAG3 (1 << 28)
/*
- * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a
+ * Each menu created by the user is a MAIN_MENU. When a menu is torn off, a
* TEAROFF_MENU instance is created. When a menu is assigned to a toplevel as
* a menu bar, a MENUBAR instance is created. All instances have the same
- * configuration information. If the master instance is deleted, all instances
+ * configuration information. If the main instance is deleted, all instances
* are deleted. If one of the other instances is deleted, only that instance
* is deleted.
*/
#define UNKNOWN_TYPE -1
-#define MASTER_MENU 0
+#define MAIN_MENU 0
#define TEAROFF_MENU 1
#define MENUBAR 2
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 4b7a492..b12e0eb 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -13,7 +13,6 @@
#include "tkInt.h"
#include "tkMenubutton.h"
-#include "default.h"
/*
* The structure below defines menubutton class behavior by means of
@@ -319,7 +318,7 @@ Tk_MenubuttonObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(mbPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(mbPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index f7d1a33..8bd8573 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -278,7 +278,7 @@ Tk_MessageObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(msgPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(msgPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 63c6db7..3f623f6 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -117,7 +117,7 @@ extern const struct TclIntStubs *tclIntStubsPtr;
tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr)))
#elif TCL_MINOR_VERSION < 7
extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*);
-# define Tcl_GetIntForIndex TclGetIntForIndex
+# define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr)
#endif
#endif
@@ -965,12 +965,11 @@ TkGetWindowFromObj(
static int
SetWindowFromAny(
- Tcl_Interp *dummy, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
WindowRep *winPtr;
- (void)dummy;
/*
* Free the old internalRep before setting the new one.
@@ -1057,7 +1056,7 @@ FreeWindowInternalRep(
/*
*----------------------------------------------------------------------
*
- * TkNewWindowObj --
+ * Tk_NewWindowObj --
*
* This function allocates a new Tcl_Obj that refers to a particular to a
* particular Tk window.
@@ -1072,7 +1071,7 @@ FreeWindowInternalRep(
*/
Tcl_Obj *
-TkNewWindowObj(
+Tk_NewWindowObj(
Tk_Window tkwin)
{
Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 7400b32..49c576a 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -775,28 +775,28 @@ FormatConfigValue(
result = "";
switch (specPtr->type) {
case TK_CONFIG_BOOLEAN:
- if (*((int *) ptr) == 0) {
+ if (*((int *)ptr) == 0) {
result = "0";
} else {
result = "1";
}
break;
case TK_CONFIG_INT:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_DOUBLE:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_STRING:
- result = (*(char **) ptr);
+ result = (*(char **)ptr);
if (result == NULL) {
result = "";
}
break;
case TK_CONFIG_UID: {
- Tk_Uid uid = *((Tk_Uid *) ptr);
+ Tk_Uid uid = *((Tk_Uid *)ptr);
if (uid != NULL) {
result = uid;
@@ -804,7 +804,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_COLOR: {
- XColor *colorPtr = *((XColor **) ptr);
+ XColor *colorPtr = *((XColor **)ptr);
if (colorPtr != NULL) {
result = Tk_NameOfColor(colorPtr);
@@ -812,7 +812,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_FONT: {
- Tk_Font tkfont = *((Tk_Font *) ptr);
+ Tk_Font tkfont = *((Tk_Font *)ptr);
if (tkfont != NULL) {
result = Tk_NameOfFont(tkfont);
@@ -820,7 +820,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BITMAP: {
- Pixmap pixmap = *((Pixmap *) ptr);
+ Pixmap pixmap = *((Pixmap *)ptr);
if (pixmap != None) {
result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap);
@@ -828,7 +828,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) ptr);
+ Tk_3DBorder border = *((Tk_3DBorder *)ptr);
if (border != NULL) {
result = Tk_NameOf3DBorder(border);
@@ -836,11 +836,11 @@ FormatConfigValue(
break;
}
case TK_CONFIG_RELIEF:
- result = Tk_NameOfRelief(*((int *) ptr));
+ result = Tk_NameOfRelief(*((int *)ptr));
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) ptr);
+ Tk_Cursor cursor = *((Tk_Cursor *)ptr);
if (cursor != NULL) {
result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
@@ -848,29 +848,27 @@ FormatConfigValue(
break;
}
case TK_CONFIG_JUSTIFY:
- result = Tk_NameOfJustify(*((Tk_Justify *) ptr));
+ result = Tk_NameOfJustify(*((Tk_Justify *)ptr));
break;
case TK_CONFIG_ANCHOR:
- result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr));
+ result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr));
break;
case TK_CONFIG_CAP_STYLE:
- result = Tk_NameOfCapStyle(*((int *) ptr));
+ result = Tk_NameOfCapStyle(*((int *)ptr));
break;
case TK_CONFIG_JOIN_STYLE:
- result = Tk_NameOfJoinStyle(*((int *) ptr));
+ result = Tk_NameOfJoinStyle(*((int *)ptr));
break;
case TK_CONFIG_PIXELS:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_MM:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_WINDOW: {
- Tk_Window tkwin;
-
- tkwin = *((Tk_Window *) ptr);
+ tkwin = *((Tk_Window *)ptr);
if (tkwin != NULL) {
result = Tk_PathName(tkwin);
}
@@ -1108,7 +1106,7 @@ GetCachedSpecs(
/*
* Now allocate our working copy's space and copy over the contents
- * from the master copy.
+ * from the origin.
*/
cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace);
@@ -1161,12 +1159,11 @@ GetCachedSpecs(
static void
DeleteSpecCacheTable(
ClientData clientData,
- Tcl_Interp *dummy)
+ TCL_UNUSED(Tcl_Interp *))
{
Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
- (void)dummy;
for (entryPtr = Tcl_FirstHashEntry(tablePtr,&search); entryPtr != NULL;
entryPtr = Tcl_NextHashEntry(&search)) {
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index d9e8053..22522d8 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -24,18 +24,19 @@
#endif
#include "tkInt.h"
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
Tcl_Interp *interp; /* Interpreter for application. */
int width, height; /* Dimensions of image. */
char *imageName; /* Name of image (malloc-ed). */
char *varName; /* Name of variable in which to log events for
* image (malloc-ed). */
-} TImageMaster;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -43,7 +44,7 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
} TImageInstance;
@@ -54,7 +55,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
char *name, int argc, char **argv,
- Tk_ImageType *typePtr, Tk_ImageMaster master,
+ Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -84,7 +85,7 @@ static Tk_ImageType imageType = {
static int ImageObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
-
+#endif
/*
*----------------------------------------------------------------------
@@ -113,7 +114,9 @@ TkOldTestInit(
if (!initialized) {
initialized = 1;
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
Tk_CreateImageType(&imageType);
+#endif
}
return TCL_OK;
}
@@ -133,7 +136,7 @@ TkOldTestInit(
*
*----------------------------------------------------------------------
*/
-
+#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
static int
ImageCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -143,12 +146,12 @@ ImageCreate(
char **argv, /* Argument strings for options (doesn't
* include image name or type). */
Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- TImageMaster *timPtr;
+ TImageModel *timPtr;
const char *varName;
int i;
(void)typePtr;
@@ -168,8 +171,8 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
@@ -179,7 +182,7 @@ ImageCreate(
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -207,7 +210,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -228,7 +231,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -260,9 +263,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -272,7 +275,7 @@ ImageGet(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
@@ -313,15 +316,15 @@ ImageDisplay(
char buffer[200 + TCL_INTEGER_SPACE * 6];
sprintf(buffer, "%s display %d %d %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height,
+ instPtr->modelPtr->imageName, imageX, imageY, width, height,
drawableX, drawableY);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
(unsigned) (width-1), (unsigned) (height-1));
@@ -357,8 +360,8 @@ ImageFree(
TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -384,11 +387,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -400,6 +403,7 @@ ImageDelete(
ckfree(timPtr->varName);
ckfree(timPtr);
}
+#endif
/*
* Local Variables:
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 54ddb34..a8c9f62 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -521,7 +521,7 @@ Tk_GetOption(
if (masqName != NULL) {
char *masqClass;
Tk_Uid nodeId, winClassId, winNameId;
- size_t classNameLength;
+ TkSizeT classNameLength;
Element *nodePtr, *leafPtr;
static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
@@ -534,7 +534,7 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (unsigned) (masqName - name);
+ classNameLength = masqName - name;
masqClass = (char *)ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -1085,7 +1085,7 @@ ReadOptionFile(
const char *realName;
Tcl_Obj *buffer;
int result;
- size_t bufferSize;
+ TkSizeT bufferSize;
Tcl_Channel chan;
Tcl_DString newName;
@@ -1116,7 +1116,7 @@ ReadOptionFile(
Tcl_IncrRefCount(buffer);
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
bufferSize = Tcl_ReadChars(chan, buffer, -1, 0);
- if (bufferSize == (size_t)-1) {
+ if (bufferSize == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file \"%s\": %s",
fileName, Tcl_PosixError(interp)));
@@ -1420,11 +1420,10 @@ ExtendStacks(
static void
OptionThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
if (tsdPtr->initialized) {
int i;
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 796530a..239b00a 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -20,7 +20,7 @@ static const char *const sideNames[] = {
/*
* For each window that the packer cares about (either because the window is
- * managed by the packer or because the window has slaves that are managed by
+ * managed by the packer or because the window has content that are managed by
* the packer), there is a structure of the following type:
*/
@@ -29,15 +29,15 @@ typedef struct Packer {
* window has been deleted, but the packet
* hasn't had a chance to clean up yet because
* the structure is still in use. */
- struct Packer *masterPtr; /* Master window within which this window is
+ struct Packer *containerPtr; /* Container window within which this window is
* packed (NULL means this window isn't
* managed by the packer). */
- struct Packer *nextPtr; /* Next window packed within same master. List
+ struct Packer *nextPtr; /* Next window packed within same container. List
* is priority-ordered: first on list gets
* packed first. */
- struct Packer *slavePtr; /* First in list of slaves packed inside this
- * window (NULL means no packed slaves). */
- Side side; /* Side of master against which this window is
+ struct Packer *contentPtr; /* First in list of content packed inside this
+ * window (NULL means no packed content). */
+ Side side; /* Side of container against which this window is
* packed. */
Tk_Anchor anchor; /* If frame allocated for window is larger
* than window needs, this indicates how where
@@ -55,13 +55,13 @@ typedef struct Packer {
* each side). */
int doubleBw; /* Twice the window's last known border width.
* If this changes, the window must be
- * repacked within its master. */
+ * repacked within its container. */
int *abortPtr; /* If non-NULL, it means that there is a
* nested call to ArrangePacking already
* working on this window. *abortPtr may be
* set to 1 to abort that nested call. This
* happens, for example, if tkwin or any of
- * its slaves is deleted. */
+ * its content is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
} Packer;
@@ -70,7 +70,7 @@ typedef struct Packer {
* Flag values for Packer structures:
*
* REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request has already
- * been made to repack all the slaves of this
+ * been made to repack all the content of this
* window.
* FILLX: 1 means if frame allocated for window is wider
* than window needs, expand window to fill
@@ -78,17 +78,17 @@ typedef struct Packer {
* than needed.
* FILLY: Same as FILLX, except for height.
* EXPAND: 1 means this window's frame will absorb any
- * extra space in the master window.
+ * extra space in the container window.
* OLD_STYLE: 1 means this window is being managed with the
* old-style packer algorithms (before Tk version
* 3.3). The main difference is that padding and
* filling are done differently.
* DONT_PROPAGATE: 1 means don't set this window's requested
- * size. 0 means if this window is a master then
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Pack has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Pack has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_REPACK 1
@@ -97,20 +97,20 @@ typedef struct Packer {
#define EXPAND 8
#define OLD_STYLE 16
#define DONT_PROPAGATE 32
-#define ALLOCED_MASTER 64
+#define ALLOCED_CONTAINER 64
/*
* The following structure is the official type record for the packer:
*/
static void PackReqProc(ClientData clientData, Tk_Window tkwin);
-static void PackLostSlaveProc(ClientData clientData,
+static void PackLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr packerType = {
"pack", /* name */
PackReqProc, /* requestProc */
- PackLostSlaveProc, /* lostSlaveProc */
+ PackLostContentProc, /* lostContentProc */
};
/*
@@ -118,19 +118,19 @@ static const Tk_GeomMgr packerType = {
*/
static void ArrangePacking(ClientData clientData);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
#ifndef TK_NO_DEPRECATED
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
- Packer *masterPtr, int objc,Tcl_Obj *const objv[]);
+ Packer *containerPtr, int objc,Tcl_Obj *const objv[]);
#endif /* !TK_NO_DEPRECATED */
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
-static int XExpansion(Packer *slavePtr, int cavityWidth);
-static int YExpansion(Packer *slavePtr, int cavityHeight);
+static int XExpansion(Packer *contentPtr, int cavityWidth);
+static int YExpansion(Packer *contentPtr, int cavityHeight);
/*
*------------------------------------------------------------------------
@@ -202,19 +202,21 @@ Tk_PackObjCmd(
#ifndef TK_NO_DEPRECATED
"after", "append", "before", "unpack",
#endif /* !TK_NO_DEPRECATED */
- "configure", "forget", "info", "propagate", "slaves", NULL };
+ "configure", "content", "forget", "info", "propagate", "slaves", NULL };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", "propagate", NULL };
enum options {
#ifndef TK_NO_DEPRECATED
PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
#endif /* !TK_NO_DEPRECATED */
- PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
+ PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
int index;
if (objc >= 2) {
const char *string = Tcl_GetString(objv[1]);
if (string[0] == '.') {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -222,19 +224,16 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
-#ifndef TK_NO_DEPRECATED
/*
* Call it again without the deprecated ones to get a proper error
* message. This works well since there can't be any ambiguity between
* deprecated and new options.
*/
- Tcl_ResetResult(interp);
- Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4],
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
sizeof(char *), "option", 0, &index);
-#endif /* TK_NO_DEPRECATED */
return TCL_ERROR;
}
@@ -249,33 +248,33 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
prevPtr = GetPacker(tkwin2);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3);
}
case PACK_APPEND: {
- Packer *masterPtr;
+ Packer *containerPtr;
Packer *prevPtr;
Tk_Window tkwin2;
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(tkwin2);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(tkwin2);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
case PACK_BEFORE: {
- Packer *packPtr, *masterPtr;
+ Packer *packPtr, *containerPtr;
Packer *prevPtr;
Tk_Window tkwin2;
@@ -283,14 +282,14 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if (packPtr->masterPtr == NULL) {
+ if (packPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- masterPtr = packPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = packPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == packPtr) {
prevPtr = NULL;
} else {
@@ -303,7 +302,7 @@ Tk_PackObjCmd(
}
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
#endif /* !TK_NO_DEPRECATED */
case PACK_CONFIGURE:
@@ -313,43 +312,43 @@ Tk_PackObjCmd(
Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL);
return TCL_ERROR;
}
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case PACK_FORGET: {
- Tk_Window slave;
- Packer *slavePtr;
+ Tk_Window content;
+ Packer *contentPtr;
int i;
for (i = 2; i < objc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
continue;
}
- slavePtr = GetPacker(slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ contentPtr = GetPacker(content);
+ if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) {
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
break;
}
case PACK_INFO: {
- Packer *slavePtr;
- Tk_Window slave;
+ Packer *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetPacker(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
@@ -358,12 +357,12 @@ Tk_PackObjCmd(
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1),
- Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1));
+ Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1),
- Tcl_NewBooleanObj(slavePtr->flags & EXPAND));
- switch (slavePtr->flags & (FILLX|FILLY)) {
+ Tcl_NewBooleanObj(contentPtr->flags & EXPAND));
+ switch (contentPtr->flags & (FILLX|FILLY)) {
case 0:
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1),
Tcl_NewStringObj("none", -1));
@@ -381,31 +380,31 @@ Tk_PackObjCmd(
Tcl_NewStringObj("both", -1));
break;
}
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1),
- Tcl_NewStringObj(sideNames[slavePtr->side], -1));
+ Tcl_NewStringObj(sideNames[contentPtr->side], -1));
Tcl_SetObjResult(interp, infoObj);
break;
}
case PACK_PROPAGATE: {
- Tk_Window master;
- Packer *masterPtr;
+ Tk_Window container;
+ Packer *containerPtr;
int propagate;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(master);
+ containerPtr = GetPacker(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -413,56 +412,57 @@ Tk_PackObjCmd(
}
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content windows, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "pack") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
/*
- * Repack the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Repack the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
break;
}
- case PACK_SLAVES: {
- Tk_Window master;
- Packer *masterPtr, *slavePtr;
+ case PACK_SLAVES:
+ case PACK_CONTENT: {
+ Tk_Window container;
+ Packer *containerPtr, *contentPtr;
Tcl_Obj *resultObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
resultObj = Tcl_NewObj();
- masterPtr = GetPacker(master);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ containerPtr = GetPacker(container);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(slavePtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -480,11 +480,11 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
+ if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) {
Tk_ManageGeometry(tkwin2, NULL, NULL);
- if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
+ if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
Tk_UnmapWindow(packPtr->tkwin);
@@ -519,13 +519,12 @@ static void
PackReqProc(
ClientData clientData, /* Packer's information about window that got
* new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
Packer *packPtr = (Packer *)clientData;
- (void)tkwin;
- packPtr = packPtr->masterPtr;
+ packPtr = packPtr->containerPtr;
if (!(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
@@ -535,34 +534,33 @@ PackReqProc(
/*
*------------------------------------------------------------------------
*
- * PackLostSlaveProc --
+ * PackLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all packer-related information about the slave.
+ * Forgets all packer-related information about the content.
*
*------------------------------------------------------------------------
*/
static void
-PackLostSlaveProc(
- ClientData clientData, /* Packer structure for slave window that was
+PackLostContentProc(
+ void *clientData, /* Packer structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- Packer *slavePtr = (Packer *)clientData;
- (void)tkwin;
+ Packer *contentPtr = (Packer *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -579,22 +577,22 @@ PackLostSlaveProc(
* None.
*
* Side effects:
- * The packed slaves of masterPtr may get resized or moved.
+ * The packed content of containerPtr may get resized or moved.
*
*------------------------------------------------------------------------
*/
static void
ArrangePacking(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- Packer *masterPtr = (Packer *)clientData;
- Packer *slavePtr;
+ Packer *containerPtr = (Packer *)clientData;
+ Packer *contentPtr;
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
* as-yet-unallocated space remaining in the
- * middle of the master window. */
+ * middle of the container window. */
int frameX, frameY, frameWidth, frameHeight;
/* These variables keep track of the frame
* allocated to the current window. */
@@ -607,15 +605,15 @@ ArrangePacking(
int borderLeft, borderRight;
int maxWidth, maxHeight, tmp;
- masterPtr->flags &= ~REQUESTED_REPACK;
+ containerPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the master has no slaves anymore, then leave the master's size as-is.
- * Otherwise there is no way to "relinquish" control over the master
+ * If the container has no content anymore, then leave the container's size as-is.
+ * Otherwise there is no way to "relinquish" control over the container
* so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
@@ -625,52 +623,52 @@ ArrangePacking(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * Pass #1: scan all the slaves to figure out the total amount of space
+ * Pass #1: scan all the content to figure out the total amount of space
* needed. Two separate width and height values are computed:
*
* width - Holds the sum of the widths (plus padding) of all the
- * slaves seen so far that were packed LEFT or RIGHT.
+ * content seen so far that were packed LEFT or RIGHT.
* height - Holds the sum of the heights (plus padding) of all the
- * slaves seen so far that were packed TOP or BOTTOM.
+ * content seen so far that were packed TOP or BOTTOM.
*
- * maxWidth - Gradually builds up the width needed by the master to
- * just barely satisfy all the slave's needs. For each
- * slave, the code computes the width needed for all the
- * slaves so far and updates maxWidth if the new value is
+ * maxWidth - Gradually builds up the width needed by the container to
+ * just barely satisfy all the content's needs. For each
+ * content, the code computes the width needed for all the
+ * content so far and updates maxWidth if the new value is
* greater.
* maxHeight - Same as maxWidth, except keeps height info.
*/
- width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) +
- Tk_InternalBorderRight(masterPtr->tkwin);
- height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) +
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
- tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX + width;
+ width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
+ tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX + width;
if (tmp > maxWidth) {
maxWidth = tmp;
}
- height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
+ height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
} else {
- tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY + height;
+ tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY + height;
if (tmp > maxHeight) {
maxHeight = tmp;
}
- width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
+ width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
}
}
if (width > maxWidth) {
@@ -680,31 +678,31 @@ ArrangePacking(
maxHeight = height;
}
- if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) {
- maxWidth = Tk_MinReqWidth(masterPtr->tkwin);
+ if (maxWidth < Tk_MinReqWidth(containerPtr->tkwin)) {
+ maxWidth = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) {
- maxHeight = Tk_MinReqHeight(masterPtr->tkwin);
+ if (maxHeight < Tk_MinReqHeight(containerPtr->tkwin)) {
+ maxHeight = Tk_MinReqHeight(containerPtr->tkwin);
}
/*
- * If the total amount of space needed in the master window has changed,
+ * If the total amount of space needed in the container window has changed,
* and if we're propagating geometry information, then notify the next
* geometry manager up and requeue ourselves to start again after the
- * master has had a chance to resize us.
+ * container has had a chance to resize us.
*/
- if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin))
- || (maxHeight != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight);
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (((maxWidth != Tk_ReqWidth(containerPtr->tkwin))
+ || (maxHeight != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, maxWidth, maxHeight);
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
goto done;
}
/*
- * Pass #2: scan the slaves a second time assigning new sizes. The
+ * Pass #2: scan the content a second time assigning new sizes. The
* "cavity" variables keep track of the unclaimed space in the cavity of
* the window; this shrinks inward as we allocate windows around the
* edges. The "frame" variables keep track of the space allocated to the
@@ -712,22 +710,22 @@ ArrangePacking(
* somewhere inside the frame, depending on anchor.
*/
- cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin);
- cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin);
- cavityWidth = Tk_Width(masterPtr->tkwin) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- cavityHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ cavityX = x = Tk_InternalBorderLeft(containerPtr->tkwin);
+ cavityY = y = Tk_InternalBorderTop(containerPtr->tkwin);
+ cavityWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ cavityHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
frameWidth = cavityWidth;
- frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if (slavePtr->flags & EXPAND) {
- frameHeight += YExpansion(slavePtr, cavityHeight);
+ frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if (contentPtr->flags & EXPAND) {
+ frameHeight += YExpansion(contentPtr, cavityHeight);
}
cavityHeight -= frameHeight;
if (cavityHeight < 0) {
@@ -735,7 +733,7 @@ ArrangePacking(
cavityHeight = 0;
}
frameX = cavityX;
- if (slavePtr->side == TOP) {
+ if (contentPtr->side == TOP) {
frameY = cavityY;
cavityY += frameHeight;
} else {
@@ -743,10 +741,10 @@ ArrangePacking(
}
} else {
frameHeight = cavityHeight;
- frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if (slavePtr->flags & EXPAND) {
- frameWidth += XExpansion(slavePtr, cavityWidth);
+ frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if (contentPtr->flags & EXPAND) {
+ frameWidth += XExpansion(contentPtr, cavityWidth);
}
cavityWidth -= frameWidth;
if (cavityWidth < 0) {
@@ -754,7 +752,7 @@ ArrangePacking(
cavityWidth = 0;
}
frameY = cavityY;
- if (slavePtr->side == LEFT) {
+ if (contentPtr->side == LEFT) {
frameX = cavityX;
cavityX += frameWidth;
} else {
@@ -771,31 +769,31 @@ ArrangePacking(
* completely ignored except when computing frame size).
*/
- if (slavePtr->flags & OLD_STYLE) {
+ if (contentPtr->flags & OLD_STYLE) {
borderX = borderY = 0;
borderTop = borderBtm = 0;
borderLeft = borderRight = 0;
} else {
- borderX = slavePtr->padX;
- borderY = slavePtr->padY;
- borderLeft = slavePtr->padLeft;
+ borderX = contentPtr->padX;
+ borderY = contentPtr->padY;
+ borderLeft = contentPtr->padLeft;
borderRight = borderX - borderLeft;
- borderTop = slavePtr->padTop;
+ borderTop = contentPtr->padTop;
borderBtm = borderY - borderTop;
}
- width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadX;
- if ((slavePtr->flags & FILLX)
+ width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadX;
+ if ((contentPtr->flags & FILLX)
|| (width > (frameWidth - borderX))) {
width = frameWidth - borderX;
}
- height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadY;
- if ((slavePtr->flags & FILLY)
+ height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadY;
+ if ((contentPtr->flags & FILLY)
|| (height > (frameHeight - borderY))) {
height = frameHeight - borderY;
}
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
y = frameY + borderTop;
@@ -835,44 +833,44 @@ ArrangePacking(
default:
Tcl_Panic("bad frame factor in ArrangePacking");
}
- width -= slavePtr->doubleBw;
- height -= slavePtr->doubleBw;
+ width -= contentPtr->doubleBw;
+ height -= contentPtr->doubleBw;
/*
* The final step is to set the position, size, and mapped/unmapped
- * state of the slave. If the slave is a child of the master, then do
+ * state of the content. If the content is a child of the container, then do
* this here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
goto done;
}
/*
- * Don't map the slave if the master isn't mapped: wait until
- * the master gets mapped later.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
@@ -889,8 +887,8 @@ ArrangePacking(
}
done:
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -898,7 +896,7 @@ ArrangePacking(
*
* XExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the
+ * Given a list of packed content, the first of which is packed on the
* left or right and is expandable, compute how much to expand the child.
*
* Results:
@@ -913,9 +911,9 @@ ArrangePacking(
static int
XExpansion(
- Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityWidth) /* Horizontal space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childWidth;
@@ -933,10 +931,10 @@ XExpansion(
minExpand = cavityWidth;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
if (numExpand) {
curExpand = (cavityWidth - childWidth)/numExpand;
if (curExpand < minExpand) {
@@ -945,7 +943,7 @@ XExpansion(
}
} else {
cavityWidth -= childWidth;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -964,7 +962,7 @@ XExpansion(
*
* YExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the top
+ * Given a list of packed content, the first of which is packed on the top
* or bottom and is expandable, compute how much to expand the child.
*
* Results:
@@ -979,9 +977,9 @@ XExpansion(
static int
YExpansion(
- Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityHeight) /* Vertical space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childHeight;
@@ -992,10 +990,10 @@ YExpansion(
minExpand = cavityHeight;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) {
if (numExpand) {
curExpand = (cavityHeight - childHeight)/numExpand;
if (curExpand < minExpand) {
@@ -1004,7 +1002,7 @@ YExpansion(
}
} else {
cavityHeight -= childHeight;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -1064,9 +1062,9 @@ GetPacker(
}
packPtr = (Packer *)ckalloc(sizeof(Packer));
packPtr->tkwin = tkwin;
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
packPtr->nextPtr = NULL;
- packPtr->slavePtr = NULL;
+ packPtr->contentPtr = NULL;
packPtr->side = TOP;
packPtr->anchor = TK_ANCHOR_CENTER;
packPtr->padX = packPtr->padY = 0;
@@ -1087,7 +1085,7 @@ GetPacker(
* PackAfter --
*
* This function does most of the real work of adding one or more windows
- * into the packing order for its master.
+ * into the packing order for its container.
*
* Results:
* A standard Tcl return value.
@@ -1105,8 +1103,8 @@ PackAfter(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Packer *prevPtr, /* Pack windows in argv just after this
* window; NULL means pack as first child of
- * masterPtr. */
- Packer *masterPtr, /* Master in which to pack windows. */
+ * containerPtr. */
+ Packer *containerPtr, /* Container in which to pack windows. */
int objc, /* Number of elements in objv. */
Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements:
* window name and side against which to
@@ -1138,21 +1136,21 @@ PackAfter(
* its parent.
*/
- if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin)
+ if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin)
!= TCL_OK) {
return TCL_ERROR;
}
parent = Tk_Parent(tkwin);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[0]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[0]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
@@ -1160,7 +1158,7 @@ PackAfter(
if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) {
goto badWindow;
}
- if (tkwin == masterPtr->tkwin) {
+ if (tkwin == containerPtr->tkwin) {
goto badWindow;
}
packPtr = GetPacker(tkwin);
@@ -1270,53 +1268,53 @@ PackAfter(
* Unpack this window if it's currently packed.
*/
- if (packPtr->masterPtr != NULL) {
- if ((packPtr->masterPtr != masterPtr) &&
- (packPtr->masterPtr->tkwin
+ if (packPtr->containerPtr != NULL) {
+ if ((packPtr->containerPtr != containerPtr) &&
+ (packPtr->containerPtr->tkwin
!= Tk_Parent(packPtr->tkwin))) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
}
/*
- * Add the window in the correct place in its master's packing
+ * Add the window in the correct place in its container's packing
* order, then make sure that the window is managed by us.
*/
- packPtr->masterPtr = masterPtr;
+ packPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- packPtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = packPtr;
+ packPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = packPtr;
} else {
packPtr->nextPtr = prevPtr->nextPtr;
prevPtr->nextPtr = packPtr;
}
Tk_ManageGeometry(tkwin, &packerType, packPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
Tk_ManageGeometry(tkwin, NULL, NULL);
Unlink(packPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
}
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
return TCL_OK;
}
@@ -1327,13 +1325,13 @@ PackAfter(
*
* Unlink --
*
- * Remove a packer from its master's list of slaves.
+ * Remove a packer from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for repacking.
+ * The container will be scheduled for repacking.
*
*----------------------------------------------------------------------
*/
@@ -1342,16 +1340,16 @@ static void
Unlink(
Packer *packPtr) /* Window to unlink. */
{
- Packer *masterPtr, *packPtr2;
+ Packer *containerPtr, *packPtr2;
- masterPtr = packPtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = packPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == packPtr) {
- masterPtr->slavePtr = packPtr->nextPtr;
+ if (containerPtr->contentPtr == packPtr) {
+ containerPtr->contentPtr = packPtr->nextPtr;
} else {
- for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) {
+ for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) {
if (packPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
@@ -1361,28 +1359,28 @@ Unlink(
}
}
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -1428,7 +1426,7 @@ DestroyPacker(
*
* Side effects:
* If a window was just deleted, clean up all its packer-related
- * information. If it was just resized, repack its slaves, if any.
+ * information. If it was just resized, repack its content, if any.
*
*----------------------------------------------------------------------
*/
@@ -1442,33 +1440,33 @@ PackStructureProc(
Packer *packPtr = (Packer *)clientData;
if (eventPtr->type == ConfigureNotify) {
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
- if ((packPtr->masterPtr != NULL)
+ if ((packPtr->containerPtr != NULL)
&& (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
- if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
+ if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
- packPtr->masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr);
+ packPtr->containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, packPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- Packer *slavePtr, *nextPtr;
+ Packer *contentPtr, *nextPtr;
- if (packPtr->masterPtr != NULL) {
+ if (packPtr->containerPtr != NULL) {
Unlink(packPtr);
}
- for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = packPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
if (packPtr->tkwin != NULL) {
@@ -1484,11 +1482,11 @@ PackStructureProc(
Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker);
} else if (eventPtr->type == MapNotify) {
/*
- * When a master gets mapped, must redo the geometry computation so
- * that all of its slaves get remapped.
+ * When a container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
@@ -1497,11 +1495,11 @@ PackStructureProc(
Packer *packPtr2;
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't bother to keep redisplaying themselves.
*/
- for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL;
+ for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL;
packPtr2 = packPtr2->nextPtr) {
Tk_UnmapWindow(packPtr2->tkwin);
}
@@ -1511,36 +1509,36 @@ PackStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* This implements the guts of the "pack configure" command. Given a list
- * of slaves and configuration options, it arranges for the packer to
- * manage the slaves and sets the specified options.
+ * of content and configuration options, it arranges for the packer to
+ * manage the content and sets the specified options.
*
* Results:
* TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned
* and the interp's result is set to contain an error message.
*
* Side effects:
- * Slave windows get taken over by the packer.
+ * Content windows get taken over by the packer.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content names. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
{
- Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr;
- Tk_Window other, slave, parent, ancestor;
- TkWindow *master;
+ Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, numWindows, tmp, positionGiven;
const char *string;
static const char *const optionStrings[] = {
@@ -1563,45 +1561,45 @@ ConfigureSlaves(
}
/*
- * Iterate over all of the slave windows, parsing the configuration
- * options for each slave. It's a bit wasteful to re-parse the options for
- * each slave, but things get too messy if we try to parse the arguments
- * just once at the beginning. For example, if a slave already is packed
+ * Iterate over all of the content windows, parsing the configuration
+ * options for each content. It's a bit wasteful to re-parse the options for
+ * each content, but things get too messy if we try to parse the arguments
+ * just once at the beginning. For example, if a content already is packed
* we want to just change a few existing values without resetting
* everything. If there are multiple windows, the -after, -before, and -in
* options only get processed for the first window.
*/
- masterPtr = NULL;
+ containerPtr = NULL;
prevPtr = NULL;
positionGiven = 0;
for (j = 0; j < numWindows; j++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- slavePtr->flags &= ~OLD_STYLE;
+ contentPtr = GetPacker(content);
+ contentPtr->flags &= ~OLD_STYLE;
/*
- * If the slave isn't currently packed, reset all of its configuration
+ * If the content isn't currently packed, reset all of its configuration
* information to default values (there could be old values left from
* a previous packing).
*/
- if (slavePtr->masterPtr == NULL) {
- slavePtr->side = TOP;
- slavePtr->anchor = TK_ANCHOR_CENTER;
- slavePtr->padX = slavePtr->padY = 0;
- slavePtr->padLeft = slavePtr->padTop = 0;
- slavePtr->iPadX = slavePtr->iPadY = 0;
- slavePtr->flags &= ~(FILLX|FILLY|EXPAND);
+ if (contentPtr->containerPtr == NULL) {
+ contentPtr->side = TOP;
+ contentPtr->anchor = TK_ANCHOR_CENTER;
+ contentPtr->padX = contentPtr->padY = 0;
+ contentPtr->padLeft = contentPtr->padTop = 0;
+ contentPtr->iPadX = contentPtr->iPadY = 0;
+ contentPtr->flags &= ~(FILLX|FILLY|EXPAND);
}
for (i = numWindows; i < objc; i+=2) {
@@ -1625,7 +1623,7 @@ ConfigureSlaves(
return TCL_ERROR;
}
prevPtr = GetPacker(other);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
notPacked:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed",
@@ -1634,12 +1632,12 @@ ConfigureSlaves(
NULL);
return TCL_ERROR;
}
- masterPtr = prevPtr->masterPtr;
+ containerPtr = prevPtr->containerPtr;
positionGiven = 1;
}
break;
case CONF_ANCHOR:
- if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor)
+ if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -1651,11 +1649,11 @@ ConfigureSlaves(
return TCL_ERROR;
}
otherPtr = GetPacker(other);
- if (otherPtr->masterPtr == NULL) {
+ if (otherPtr->containerPtr == NULL) {
goto notPacked;
}
- masterPtr = otherPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = otherPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == otherPtr) {
prevPtr = NULL;
} else {
@@ -1670,21 +1668,21 @@ ConfigureSlaves(
if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->flags &= ~EXPAND;
+ contentPtr->flags &= ~EXPAND;
if (tmp) {
- slavePtr->flags |= EXPAND;
+ contentPtr->flags |= EXPAND;
}
break;
case CONF_FILL:
string = Tcl_GetString(objv[i+1]);
if (strcmp(string, "none") == 0) {
- slavePtr->flags &= ~(FILLX|FILLY);
+ contentPtr->flags &= ~(FILLX|FILLY);
} else if (strcmp(string, "x") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX;
+ contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX;
} else if (strcmp(string, "y") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY;
+ contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY;
} else if (strcmp(string, "both") == 0) {
- slavePtr->flags |= FILLX|FILLY;
+ contentPtr->flags |= FILLX|FILLY;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad fill style \"%s\": must be "
@@ -1699,8 +1697,8 @@ ConfigureSlaves(
!= TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(other);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(other);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1710,7 +1708,7 @@ ConfigureSlaves(
}
break;
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen"
@@ -1718,10 +1716,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen"
@@ -1729,17 +1727,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -1748,42 +1746,42 @@ ConfigureSlaves(
sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->side = (Side) side;
+ contentPtr->side = (Side) side;
break;
}
}
/*
- * If no position in a packing list was specified and the slave is
+ * If no position in a packing list was specified and the content is
* already packed, then leave it in its current location in its
* current packing list.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
/*
- * If the slave is going to be put back after itself or the same -in
+ * If the content is going to be put back after itself or the same -in
* window is passed in again, then just skip the whole operation,
* since it won't work anyway.
*/
- if (prevPtr == slavePtr) {
- masterPtr = slavePtr->masterPtr;
+ if (prevPtr == contentPtr) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
/*
* If none of the "-in", "-before", or "-after" options has been
- * specified, arrange for the slave to go at the end of the order for
+ * specified, arrange for the content to go at the end of the order for
* its parent.
*/
if (!positionGiven) {
- masterPtr = GetPacker(Tk_Parent(slave));
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(Tk_Parent(content));
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1792,27 +1790,27 @@ ConfigureSlaves(
}
/*
- * Make sure that the slave's parent is either the master or an
- * ancestor of the master, and that the master and slave aren't the
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- parent = Tk_Parent(slave);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ parent = Tk_Parent(content);
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
}
- if (slave == masterPtr->tkwin) {
+ if (content == containerPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside itself", Tcl_GetString(objv[j])));
+ "can't pack \"%s\" inside itself", Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
@@ -1821,67 +1819,67 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
/*
- * Unpack the slave if it's currently packed, then position it after
+ * Unpack the content if it's currently packed, then position it after
* prevPtr.
*/
- if (slavePtr->masterPtr != NULL) {
- if ((slavePtr->masterPtr != masterPtr) &&
- (slavePtr->masterPtr->tkwin
- != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL) {
+ if ((contentPtr->containerPtr != containerPtr) &&
+ (contentPtr->containerPtr->tkwin
+ != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
+ Unlink(contentPtr);
}
- slavePtr->masterPtr = masterPtr;
+ contentPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
} else {
- slavePtr->nextPtr = prevPtr->nextPtr;
- prevPtr->nextPtr = slavePtr;
+ contentPtr->nextPtr = prevPtr->nextPtr;
+ prevPtr->nextPtr = contentPtr;
}
- Tk_ManageGeometry(slave, &packerType, slavePtr);
- prevPtr = slavePtr;
+ Tk_ManageGeometry(content, &packerType, contentPtr);
+ prevPtr = contentPtr;
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
}
return TCL_OK;
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index f25726e..c15236d 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -70,7 +70,7 @@ enum stretch {
typedef struct {
Tk_OptionTable pwOptions; /* Token for paned window option table. */
- Tk_OptionTable slaveOpts; /* Token for slave cget option table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget option table. */
} OptionTables;
/*
@@ -78,35 +78,35 @@ typedef struct {
* managed by a paned window widget.
*/
-typedef struct Slave {
+typedef struct Pane {
Tk_Window tkwin; /* Window being managed. */
int minSize; /* Minimum size of this pane, on the relevant
* axis, in pixels. */
- int padx; /* Additional padding requested for slave, in
+ int padx; /* Additional padding requested for pane, in
* the x dimension. */
- int pady; /* Additional padding requested for slave, in
+ int pady; /* Additional padding requested for pane, in
* the y dimension. */
Tcl_Obj *widthPtr, *heightPtr;
- /* Tcl_Obj rep's of slave width/height, to
+ /* Tcl_Obj rep's of pane width/height, to
* allow for null values. */
- int width; /* Slave width. */
- int height; /* Slave height. */
+ int width; /* Pane width. */
+ int height; /* Pane height. */
int sticky; /* Sticky string. */
int x, y; /* Coordinates of the widget. */
int paneWidth, paneHeight; /* Pane dimensions (may be different from
- * slave width/height). */
+ * pane width/height). */
int sashx, sashy; /* Coordinates of the sash of the right or
* bottom of this pane. */
int markx, marky; /* Coordinates of the last mark set for the
* sash. */
int handlex, handley; /* Coordinates of the sash handle. */
- enum stretch stretch; /* Controls how slave grows/shrinks */
+ enum stretch stretch; /* Controls how pane grows/shrinks */
int hide; /* Controls visibility of pane */
- struct PanedWindow *masterPtr;
+ struct PanedWindow *containerPtr;
/* Paned window managing the window. */
Tk_Window after; /* Placeholder for parsing options. */
Tk_Window before; /* Placeholder for parsing options. */
-} Slave;
+} Pane;
/*
* A data structure of the following type is kept for each paned window widget
@@ -121,7 +121,7 @@ typedef struct PanedWindow {
Tcl_Command widgetCmd; /* Token for square's widget command. */
Tk_OptionTable optionTable; /* Token representing the configuration
* specifications. */
- Tk_OptionTable slaveOpts; /* Token for slave cget table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget table. */
Tk_3DBorder background; /* Background color. */
int borderWidth; /* Value of -borderwidth option. */
int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */
@@ -151,9 +151,9 @@ typedef struct PanedWindow {
Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */
int proxyBorderWidth; /* Borderwidth used to draw proxy. */
int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */
- Slave **slaves; /* Pointer to array of Slaves. */
- int numSlaves; /* Number of slaves. */
- int sizeofSlaves; /* Number of elements in the slaves array. */
+ Pane **panes; /* Pointer to array of Panes. */
+ int numPanes; /* Number of panes. */
+ int sizeofPanes; /* Number of elements in the panes array. */
int flags; /* Flags for widget; see below. */
} PanedWindow;
@@ -200,16 +200,16 @@ static void DisplayProxyWindow(ClientData clientData);
static void PanedWindowWorldChanged(ClientData instanceData);
static int PanedWindowWidgetObjCmd(ClientData clientData,
Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
-static void PanedWindowLostSlaveProc(ClientData clientData,
+static void PanedWindowLostPaneProc(ClientData clientData,
Tk_Window tkwin);
static void PanedWindowReqProc(ClientData clientData,
Tk_Window tkwin);
static void ArrangePanes(ClientData clientData);
-static void Unlink(Slave *slavePtr);
-static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
+static void Unlink(Pane *panePtr);
+static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
static void GetFirstLastVisiblePane(PanedWindow *pwPtr,
int *firstPtr, int *lastPtr);
-static void SlaveStructureProc(ClientData clientData,
+static void PaneStructureProc(ClientData clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
@@ -218,7 +218,7 @@ static int PanedWindowProxyCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void ComputeGeometry(PanedWindow *pwPtr);
-static int ConfigureSlaves(PanedWindow *pwPtr,
+static int ConfigurePanes(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void DestroyOptionTables(ClientData clientData,
@@ -233,7 +233,7 @@ static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
char *internalPtr, char *oldInternalPtr);
static void AdjustForSticky(int sticky, int cavityWidth,
int cavityHeight, int *xPtr, int *yPtr,
- int *slaveWidthPtr, int *slaveHeightPtr);
+ int *paneWidthPtr, int *paneHeightPtr);
static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
static int ObjectIsEmpty(Tcl_Obj *objPtr);
static void * ComputeSlotAddress(void *recordPtr, TkSizeT offset);
@@ -241,16 +241,16 @@ static int PanedWindowIdentifyCoords(PanedWindow *pwPtr,
Tcl_Interp *interp, int x, int y);
/*
- * Sashes are between panes only, so there is one less sash than slaves
+ * Sashes are between panes only, so there is one less sash than panes
*/
#define ValidSashIndex(pwPtr, sash) \
- (((sash) >= 0) && ((sash) < ((pwPtr)->numSlaves-1)))
+ (((sash) >= 0) && ((sash) < ((pwPtr)->numPanes-1)))
static const Tk_GeomMgr panedWindowMgrType = {
"panedwindow", /* name */
PanedWindowReqProc, /* requestProc */
- PanedWindowLostSlaveProc, /* lostSlaveProc */
+ PanedWindowLostPaneProc, /* lostPaneProc */
};
/*
@@ -261,7 +261,7 @@ static const Tk_GeomMgr panedWindowMgrType = {
/*
* The following structure contains pointers to functions used for processing
- * the custom "-sticky" option for slave windows.
+ * the custom "-sticky" option for panes.
*/
static const Tk_ObjCustomOption stickyOption = {
@@ -334,33 +334,33 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
-static const Tk_OptionSpec slaveOptionSpecs[] = {
+static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_WINDOW, "-after", NULL, NULL,
- DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Slave, after),
+ DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-before", NULL, NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Slave, before),
+ DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Slave, heightPtr),
- offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
+ offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
- DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Slave, hide), 0,0,GEOMETRY},
+ DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Slave, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Slave, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Slave, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
- DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Slave, sticky), 0,
+ DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0,
&stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
- DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Slave, stretch), 0,
+ DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), 0,
(ClientData) stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Slave, widthPtr),
- offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
+ offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = {
int
Tk_PanedWindowObjCmd(
- ClientData dummy, /* NULL. */
+ TCL_UNUSED(ClientData), /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
@@ -392,7 +392,6 @@ Tk_PanedWindowObjCmd(
Tk_Window tkwin, parent;
OptionTables *pwOpts;
XSetWindowAttributes atts;
- (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -429,7 +428,7 @@ Tk_PanedWindowObjCmd(
*/
pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs);
- pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs);
+ pwOpts->paneOpts = Tk_CreateOptionTable(interp, paneOptionSpecs);
}
Tk_SetClass(tkwin, "Panedwindow");
@@ -447,7 +446,7 @@ Tk_PanedWindowObjCmd(
Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr,
PanedWindowCmdDeletedProc);
pwPtr->optionTable = pwOpts->pwOptions;
- pwPtr->slaveOpts = pwOpts->slaveOpts;
+ pwPtr->paneOpts = pwOpts->paneOpts;
pwPtr->relief = TK_RELIEF_RAISED;
pwPtr->gc = NULL;
pwPtr->cursor = NULL;
@@ -472,7 +471,7 @@ Tk_PanedWindowObjCmd(
/*
* Find the toplevel ancestor of the panedwindow, and make a proxy win as
* a child of that window; this way the proxy can always float above
- * slaves in the panedwindow.
+ * panes in the panedwindow.
*/
parent = Tk_Parent(pwPtr->tkwin);
@@ -507,7 +506,7 @@ Tk_PanedWindowObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(pwPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(pwPtr->tkwin));
return TCL_OK;
}
@@ -549,10 +548,10 @@ PanedWindowWidgetObjCmd(
Tcl_Obj *resultObj;
int index, count, i, x, y;
Tk_Window tkwin;
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -570,7 +569,7 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
break;
case PW_CGET:
@@ -605,7 +604,6 @@ PanedWindowWidgetObjCmd(
break;
case PW_FORGET: {
- int i;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
@@ -617,21 +615,21 @@ PanedWindowWidgetObjCmd(
* Clean up each window named in the arg list.
*/
for (count = 0, i = 2; i < objc; i++) {
- Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
+ Tk_Window pane = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
pwPtr->tkwin);
- if (slave == NULL) {
+ if (pane == NULL) {
continue;
}
- slavePtr = GetPane(pwPtr, slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
+ panePtr = GetPane(pwPtr, pane);
+ if ((panePtr != NULL) && (panePtr->containerPtr != NULL)) {
count++;
- Tk_ManageGeometry(slave, NULL, NULL);
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- Unlink(slavePtr);
+ Tk_ManageGeometry(pane, NULL, NULL);
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ Unlink(panePtr);
}
if (count != 0) {
ComputeGeometry(pwPtr);
@@ -667,15 +665,15 @@ PanedWindowWidgetObjCmd(
break;
}
resultObj = NULL;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionValue(interp,
- pwPtr->slaves[i], pwPtr->slaveOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
objv[3], tkwin);
}
}
if (resultObj == NULL) {
- if (i == pwPtr->numSlaves) {
+ if (i == pwPtr->numPanes) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not managed by this window", -1));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED",
@@ -690,7 +688,7 @@ PanedWindowWidgetObjCmd(
case PW_PANECONFIGURE:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "pane ?option? ?value option value ...?");
+ "pane ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -707,10 +705,10 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
- pwPtr->slaves[i], pwPtr->slaveOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
(objc == 4) ? objv[3] : NULL,
pwPtr->tkwin);
if (resultObj == NULL) {
@@ -722,15 +720,15 @@ PanedWindowWidgetObjCmd(
}
}
} else {
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
}
break;
case PW_PANES:
resultObj = Tcl_NewObj();
- for (i = 0; i < pwPtr->numSlaves; i++) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(pwPtr->slaves[i]->tkwin));
+ Tk_NewWindowObj(pwPtr->panes[i]->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -750,37 +748,37 @@ PanedWindowWidgetObjCmd(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigurePanes --
*
- * Add or alter the configuration options of a slave in a paned window.
+ * Add or alter the configuration options of a pane in a paned window.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Depends on options; may add a slave to the paned window, may alter the
- * geometry management options of a slave.
+ * Depends on options; may add a pane to the paned window, may alter the
+ * geometry management options of a pane.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigurePanes(
PanedWindow *pwPtr, /* Information about paned window. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
+ int i, firstOptionArg, j, found, doubleBw, index, numNewPanes, haveLoc;
int insertIndex;
Tk_Window tkwin = NULL, ancestor, parent;
- Slave *slavePtr, **inserts, **newSlaves;
- Slave options;
+ Pane *panePtr, **inserts, **newPanes;
+ Pane options;
const char *arg;
/*
* Find the non-window name arguments; these are the configure options for
- * the slaves. Also validate that the window names given are legitimate
+ * the panes. Also validate that the window names given are legitimate
* (ie, they are real windows, they are not the panedwindow itself, etc.).
*/
@@ -818,8 +816,8 @@ ConfigureSlaves(
return TCL_ERROR;
} else {
/*
- * Make sure the panedwindow is the parent of the slave,
- * or a descendant of the slave's parent.
+ * Make sure the panedwindow is the parent of the pane,
+ * or a descendant of the pane's parent.
*/
parent = Tk_Parent(tkwin);
@@ -848,8 +846,8 @@ ConfigureSlaves(
* extra testing in the for loop below.
*/
- memset((void *)&options, 0, sizeof(Slave));
- if (Tk_SetOptions(interp, &options, pwPtr->slaveOpts,
+ memset((void *)&options, 0, sizeof(Pane));
+ if (Tk_SetOptions(interp, &options, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -866,8 +864,8 @@ ConfigureSlaves(
if (options.after != NULL) {
tkwin = options.after;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.after == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.after == pwPtr->panes[i]->tkwin) {
index = i + 1;
break;
}
@@ -875,8 +873,8 @@ ConfigureSlaves(
} else if (options.before != NULL) {
tkwin = options.before;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.before == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.before == pwPtr->panes[i]->tkwin) {
index = i;
break;
}
@@ -893,28 +891,28 @@ ConfigureSlaves(
"window \"%s\" is not managed by %s",
Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL);
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts,
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts,
pwPtr->tkwin);
return TCL_ERROR;
}
/*
- * Allocate an array to hold, in order, the pointers to the slave
+ * Allocate an array to hold, in order, the pointers to the pane
* structures corresponding to the windows specified. Some of those
* structures may already have existed, some may be new.
*/
- inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
+ inserts = (Pane **)ckalloc(sizeof(Pane *) * (firstOptionArg - 2));
insertIndex = 0;
/*
- * Populate the inserts array, creating new slave structures as necessary,
+ * Populate the inserts array, creating new pane structures as necessary,
* applying the options to each structure as we go, and, if necessary,
- * marking the spot in the original slaves array as empty (for
- * pre-existing slave structures).
+ * marking the spot in the original panes array as empty (for
+ * pre-existing pane structures).
*/
- for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) {
+ for (i = 0, numNewPanes = 0; i < firstOptionArg - 2; i++) {
/*
* We don't check that tkwin is NULL here, because the pre-pass above
* guarantees that the input at this stage is good.
@@ -924,24 +922,24 @@ ConfigureSlaves(
pwPtr->tkwin);
found = 0;
- for (j = 0; j < pwPtr->numSlaves; j++) {
- if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) {
- Tk_SetOptions(interp, pwPtr->slaves[j],
- pwPtr->slaveOpts, objc - firstOptionArg,
+ for (j = 0; j < pwPtr->numPanes; j++) {
+ if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
+ Tk_SetOptions(interp, pwPtr->panes[j],
+ pwPtr->paneOpts, objc - firstOptionArg,
objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
- if (pwPtr->slaves[j]->minSize < 0) {
- pwPtr->slaves[j]->minSize = 0;
+ if (pwPtr->panes[j]->minSize < 0) {
+ pwPtr->panes[j]->minSize = 0;
}
found = 1;
/*
- * If the slave is supposed to move, add it to the inserts
+ * If the pane is supposed to move, add it to the inserts
* array now; otherwise, leave it where it is.
*/
if (index != -1) {
- inserts[insertIndex++] = pwPtr->slaves[j];
- pwPtr->slaves[j] = NULL;
+ inserts[insertIndex++] = pwPtr->panes[j];
+ pwPtr->panes[j] = NULL;
}
break;
}
@@ -952,7 +950,7 @@ ConfigureSlaves(
}
/*
- * Make sure this slave wasn't already put into the inserts array,
+ * Make sure this pane wasn't already put into the inserts array,
* i.e., when the user specifies the same window multiple times in a
* single add commaned.
*/
@@ -967,104 +965,104 @@ ConfigureSlaves(
}
/*
- * Create a new slave structure and initialize it. All slaves start
+ * Create a new pane structure and initialize it. All panes start
* out with their "natural" dimensions.
*/
- slavePtr = (Slave *)ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts,
+ panePtr = (Pane *)ckalloc(sizeof(Pane));
+ memset(panePtr, 0, sizeof(Pane));
+ Tk_InitOptions(interp, panePtr, pwPtr->paneOpts,
pwPtr->tkwin);
- Tk_SetOptions(interp, slavePtr, pwPtr->slaveOpts,
+ Tk_SetOptions(interp, panePtr, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
- slavePtr->tkwin = tkwin;
- slavePtr->masterPtr = pwPtr;
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- if (slavePtr->width > 0) {
- slavePtr->paneWidth = slavePtr->width;
+ panePtr->tkwin = tkwin;
+ panePtr->containerPtr = pwPtr;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ if (panePtr->width > 0) {
+ panePtr->paneWidth = panePtr->width;
} else {
- slavePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
+ panePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
}
- if (slavePtr->height > 0) {
- slavePtr->paneHeight = slavePtr->height;
+ if (panePtr->height > 0) {
+ panePtr->paneHeight = panePtr->height;
} else {
- slavePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
+ panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
}
- if (slavePtr->minSize < 0) {
- slavePtr->minSize = 0;
+ if (panePtr->minSize < 0) {
+ panePtr->minSize = 0;
}
/*
- * Set up the geometry management callbacks for this slave.
+ * Set up the geometry management callbacks for this pane.
*/
- Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr);
- inserts[insertIndex++] = slavePtr;
- numNewSlaves++;
+ Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_ManageGeometry(panePtr->tkwin, &panedWindowMgrType, panePtr);
+ inserts[insertIndex++] = panePtr;
+ numNewPanes++;
}
/*
- * Allocate the new slaves array, then copy the slaves into it, in order.
+ * Allocate the new panes array, then copy the panes into it, in order.
*/
- i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves);
- newSlaves = (Slave **)ckalloc(i);
- memset(newSlaves, 0, i);
+ i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes);
+ newPanes = (Pane **)ckalloc(i);
+ memset(newPanes, 0, i);
if (index == -1) {
/*
- * If none of the existing slaves have to be moved, just copy the old
+ * If none of the existing panes have to be moved, just copy the old
* and append the new.
*/
- memcpy((void *)&(newSlaves[0]), pwPtr->slaves,
- sizeof(Slave *) * pwPtr->numSlaves);
- memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts,
- sizeof(Slave *) * numNewSlaves);
+ memcpy((void *)&(newPanes[0]), pwPtr->panes,
+ sizeof(Pane *) * pwPtr->numPanes);
+ memcpy((void *)&(newPanes[pwPtr->numPanes]), inserts,
+ sizeof(Pane *) * numNewPanes);
} else {
/*
- * If some of the existing slaves were moved, the old slaves array
+ * If some of the existing panes were moved, the old panes array
* will be partially populated, with some valid and some invalid
- * entries. Walk through it, copying valid entries to the new slaves
+ * entries. Walk through it, copying valid entries to the new panes
* array as we go; when we get to the insert location for the new
- * slaves, copy the inserts array over, then finish off the old slaves
+ * panes, copy the inserts array over, then finish off the old panes
* array.
*/
for (i = 0, j = 0; i < index; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
- memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex);
+ memcpy((void *)&(newPanes[j]), inserts, sizeof(Pane *)*insertIndex);
j += firstOptionArg - 2;
- for (i = index; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ for (i = index; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
}
/*
- * Make the new slaves array the paned window's slave array, and clean up.
+ * Make the new panes array the paned window's pane array, and clean up.
*/
- ckfree(pwPtr->slaves);
+ ckfree(pwPtr->panes);
ckfree(inserts);
- pwPtr->slaves = newSlaves;
+ pwPtr->panes = newPanes;
/*
- * Set the paned window's slave count to the new value.
+ * Set the paned window's pane count to the new value.
*/
- pwPtr->numSlaves += numNewSlaves;
+ pwPtr->numPanes += numNewPanes;
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin);
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts, pwPtr->tkwin);
ComputeGeometry(pwPtr);
return TCL_OK;
@@ -1102,7 +1100,7 @@ PanedWindowSashCommand(
};
int index, sash, x, y, diff;
Tcl_Obj *coords[2];
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
@@ -1131,10 +1129,10 @@ PanedWindowSashCommand(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
- coords[0] = Tcl_NewWideIntObj(slavePtr->sashx);
- coords[1] = Tcl_NewWideIntObj(slavePtr->sashy);
+ coords[0] = Tcl_NewWideIntObj(panePtr->sashx);
+ coords[1] = Tcl_NewWideIntObj(panePtr->sashy);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
@@ -1164,11 +1162,11 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- pwPtr->slaves[sash]->markx = x;
- pwPtr->slaves[sash]->marky = y;
+ pwPtr->panes[sash]->markx = x;
+ pwPtr->panes[sash]->marky = y;
} else {
- coords[0] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->markx);
- coords[1] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->marky);
+ coords[0] = Tcl_NewWideIntObj(pwPtr->panes[sash]->markx);
+ coords[1] = Tcl_NewWideIntObj(pwPtr->panes[sash]->marky);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
}
break;
@@ -1199,18 +1197,18 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (index == SASH_PLACE) {
- diff = x - pwPtr->slaves[sash]->sashx;
+ diff = x - pwPtr->panes[sash]->sashx;
} else {
- diff = x - pwPtr->slaves[sash]->markx;
+ diff = x - pwPtr->panes[sash]->markx;
}
} else {
if (index == SASH_PLACE) {
- diff = y - pwPtr->slaves[sash]->sashy;
+ diff = y - pwPtr->panes[sash]->sashy;
} else {
- diff = y - pwPtr->slaves[sash]->marky;
+ diff = y - pwPtr->panes[sash]->marky;
}
}
@@ -1370,15 +1368,15 @@ PanedWindowEventProc(
} else if (eventPtr->type == DestroyNotify) {
DestroyPanedWindow(pwPtr);
} else if (eventPtr->type == UnmapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_UnmapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_UnmapWindow(pwPtr->panes[i]->tkwin);
}
}
} else if (eventPtr->type == MapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_MapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_MapWindow(pwPtr->panes[i]->tkwin);
}
}
}
@@ -1444,7 +1442,7 @@ DisplayPanedWindow(
ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
- Slave *slavePtr;
+ Pane *panePtr;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->tkwin;
int i, sashWidth, sashHeight;
@@ -1497,19 +1495,19 @@ DisplayPanedWindow(
*/
GetFirstLastVisiblePane(pwPtr, &first, &last);
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide || i == last) {
continue;
}
if (sashWidth > 0 && sashHeight > 0) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->sashx, slavePtr->sashy, sashWidth, sashHeight,
+ panePtr->sashx, panePtr->sashy, sashWidth, sashHeight,
1, pwPtr->sashRelief);
}
if (pwPtr->showHandle) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->handlex, slavePtr->handley,
+ panePtr->handlex, panePtr->handley,
pwPtr->handleSize, pwPtr->handleSize, 1,
TK_RELIEF_RAISED);
}
@@ -1570,23 +1568,23 @@ DestroyPanedWindow(
}
/*
- * Clean up the slave list; foreach slave:
- * o Cancel the slave's structure notification callback
- * o Cancel geometry management for the slave.
- * o Free memory for the slave
+ * Clean up the pane list; foreach pane:
+ * o Cancel the pane's structure notification callback
+ * o Cancel geometry management for the pane.
+ * o Free memory for the pane
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask,
- SlaveStructureProc, pwPtr->slaves[i]);
- Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL);
- Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask,
+ PaneStructureProc, pwPtr->panes[i]);
+ Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL);
+ Tk_FreeConfigOptions((char *) pwPtr->panes[i], pwPtr->paneOpts,
pwPtr->tkwin);
- ckfree(pwPtr->slaves[i]);
- pwPtr->slaves[i] = NULL;
+ ckfree(pwPtr->panes[i]);
+ pwPtr->panes[i] = NULL;
}
- if (pwPtr->slaves) {
- ckfree(pwPtr->slaves);
+ if (pwPtr->panes) {
+ ckfree(pwPtr->panes);
}
/*
@@ -1628,12 +1626,11 @@ static void
PanedWindowReqProc(
ClientData clientData, /* Paned window's information about window
* that got new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
- (void)tkwin;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
if (Tk_IsMapped(pwPtr->tkwin)) {
if (!(pwPtr->flags & RESIZE_PENDING)) {
@@ -1641,13 +1638,13 @@ PanedWindowReqProc(
Tcl_DoWhenIdle(ArrangePanes, pwPtr);
}
} else {
- int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
+ int doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
- if (slavePtr->width <= 0) {
- slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ if (panePtr->width <= 0) {
+ panePtr->paneWidth = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- if (slavePtr->height <= 0) {
- slavePtr->paneHeight = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ if (panePtr->height <= 0) {
+ panePtr->paneHeight = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
ComputeGeometry(pwPtr);
}
@@ -1656,40 +1653,39 @@ PanedWindowReqProc(
/*
*--------------------------------------------------------------
*
- * PanedWindowLostSlaveProc --
+ * PanedWindowLostPaneProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a pane that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all information about the slave. Causes geometry to be
+ * Forgets all information about the pane. Causes geometry to be
* recomputed for the panedwindow.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+PanedWindowLostPaneProc(
+ ClientData clientData, /* Grid structure for the pane that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
- (void)tkwin;
-
- if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- }
- Unlink(slavePtr);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
+
+ if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ }
+ Unlink(panePtr);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
@@ -1707,19 +1703,19 @@ PanedWindowLostSlaveProc(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The panes of containerPtr may get resized or moved.
*
*--------------------------------------------------------------
*/
static void
ArrangePanes(
- ClientData clientData) /* Structure describing parent whose slaves
+ ClientData clientData) /* Structure describing parent whose panes
* are to be re-layed out. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
- Slave *slavePtr;
- int i, slaveWidth, slaveHeight, slaveX, slaveY;
+ Pane *panePtr;
+ int i, newPaneWidth, newPaneHeight, paneX, paneY;
int paneWidth, paneHeight, paneSize, paneMinSize;
int doubleBw;
int x, y;
@@ -1734,13 +1730,13 @@ ArrangePanes(
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
- * If the parent has no slaves anymore, then don't do anything at all:
+ * If the parent has no panes anymore, then don't do anything at all:
* just leave the parent's size as-is. Otherwise there is no way to
* "relinquish" control over the parent so another geometry manager can
* take over.
*/
- if (pwPtr->numSlaves == 0) {
+ if (pwPtr->numPanes == 0) {
return;
}
@@ -1779,37 +1775,37 @@ ArrangePanes(
+ pwPtr->sashPad;
}
- for (i = sashCount = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = sashCount = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * Compute the total size needed by all the slaves and the left-over,
+ * Compute the total size needed by all the panes and the left-over,
* or shortage of space available.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
- stretchReserve -= paneSize + (2 * slavePtr->padx);
+ stretchReserve -= paneSize + (2 * panePtr->padx);
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
- stretchReserve -= paneSize + (2 * slavePtr->pady);
+ stretchReserve -= paneSize + (2 * panePtr->pady);
}
- if (IsStretchable(slavePtr->stretch,i,first,last)
+ if (IsStretchable(panePtr->stretch,i,first,last)
&& Tk_IsMapped(pwPtr->tkwin)) {
paneDynSize += paneSize;
- paneDynMinSize += slavePtr->minSize;
+ paneDynMinSize += panePtr->minSize;
}
if (i != last) {
stretchReserve -= sashWidth;
@@ -1821,53 +1817,53 @@ ArrangePanes(
* Second pass; adjust/arrange panes.
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (panePtr->hide) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
continue;
}
/*
- * Compute the size of this slave. The algorithm (assuming a
+ * Compute the size of this pane. The algorithm (assuming a
* horizontal paned window) is:
*
* 1. Get "base" dimensions. If a width or height is specified for
- * this slave, use those values; else use the ReqWidth/ReqHeight.
+ * this pane, use those values; else use the ReqWidth/ReqHeight.
* 2. Using base dimensions, pane dimensions, and sticky values,
* determine the x and y, and actual width and height of the
* widget.
*/
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- slaveWidth = (slavePtr->width > 0 ? slavePtr->width :
- Tk_ReqWidth(slavePtr->tkwin) + doubleBw);
- slaveHeight = (slavePtr->height > 0 ? slavePtr->height :
- Tk_ReqHeight(slavePtr->tkwin) + doubleBw);
- paneMinSize = slavePtr->minSize;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ newPaneWidth = (panePtr->width > 0 ? panePtr->width :
+ Tk_ReqWidth(panePtr->tkwin) + doubleBw);
+ newPaneHeight = (panePtr->height > 0 ? panePtr->height :
+ Tk_ReqHeight(panePtr->tkwin) + doubleBw);
+ paneMinSize = panePtr->minSize;
/*
* Calculate pane width and height.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
pwSize = pwWidth;
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
pwSize = pwHeight;
}
- if (IsStretchable(slavePtr->stretch, i, first, last)) {
+ if (IsStretchable(panePtr->stretch, i, first, last)) {
double frac;
if (paneDynSize > 0) {
@@ -1877,7 +1873,7 @@ ArrangePanes(
}
paneDynSize -= paneSize;
- paneDynMinSize -= slavePtr->minSize;
+ paneDynMinSize -= panePtr->minSize;
stretchAmount = (int) (frac * stretchReserve);
if (paneSize + stretchAmount >= paneMinSize) {
stretchReserve -= stretchAmount;
@@ -1902,9 +1898,9 @@ ArrangePanes(
}
if (horizontal) {
paneWidth = paneSize;
- paneHeight = pwHeight - (2 * slavePtr->pady);
+ paneHeight = pwHeight - (2 * panePtr->pady);
} else {
- paneWidth = pwWidth - (2 * slavePtr->padx);
+ paneWidth = pwWidth - (2 * panePtr->padx);
paneHeight = paneSize;
}
@@ -1932,15 +1928,15 @@ ArrangePanes(
paneHeight = pwHeight - syReserve - y + internalBW;
}
- if (slaveWidth > paneWidth) {
- slaveWidth = paneWidth;
+ if (newPaneWidth > paneWidth) {
+ newPaneWidth = paneWidth;
}
- if (slaveHeight > paneHeight) {
- slaveHeight = paneHeight;
+ if (newPaneHeight > paneHeight) {
+ newPaneHeight = paneHeight;
}
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Compute the location of the sash at the right or bottom of the
@@ -1948,51 +1944,51 @@ ArrangePanes(
*/
if (horizontal) {
- x += paneWidth + (2 * slavePtr->padx);
+ x += paneWidth + (2 * panePtr->padx);
if (x < internalBW) {
x = internalBW;
}
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += paneHeight + (2 * slavePtr->pady);
+ y += paneHeight + (2 * panePtr->pady);
if (y < internalBW) {
y = internalBW;
}
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Compute the actual dimensions of the slave in the pane.
+ * Compute the actual dimensions of the pane in the pane.
*/
- slaveX = slavePtr->x;
- slaveY = slavePtr->y;
- AdjustForSticky(slavePtr->sticky, paneWidth, paneHeight,
- &slaveX, &slaveY, &slaveWidth, &slaveHeight);
+ paneX = panePtr->x;
+ paneY = panePtr->y;
+ AdjustForSticky(panePtr->sticky, paneWidth, paneHeight,
+ &paneX, &paneY, &newPaneWidth, &newPaneHeight);
- slaveX += slavePtr->padx;
- slaveY += slavePtr->pady;
+ paneX += panePtr->padx;
+ paneY += panePtr->pady;
/*
* Now put the window in the proper spot.
*/
- if (slaveWidth <= 0 || slaveHeight <= 0 ||
- (horizontal ? slaveX - internalBW > pwWidth :
- slaveY - internalBW > pwHeight)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (newPaneWidth <= 0 || newPaneHeight <= 0 ||
+ (horizontal ? paneX - internalBW > pwWidth :
+ paneY - internalBW > pwHeight)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, pwPtr->tkwin,
- slaveX, slaveY, slaveWidth, slaveHeight);
+ Tk_MaintainGeometry(panePtr->tkwin, pwPtr->tkwin,
+ paneX, paneY, newPaneWidth, newPaneHeight);
}
sashCount--;
}
@@ -2004,7 +2000,7 @@ ArrangePanes(
*
* Unlink --
*
- * Remove a slave from a paned window.
+ * Remove a pane from a paned window.
*
* Results:
* None.
@@ -2017,57 +2013,57 @@ ArrangePanes(
static void
Unlink(
- Slave *slavePtr) /* Window to unlink. */
+ Pane *panePtr) /* Window to unlink. */
{
- PanedWindow *masterPtr;
+ PanedWindow *containerPtr;
int i, j;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = panePtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
/*
- * Find the specified slave in the panedwindow's list of slaves, then
+ * Find the specified pane in the panedwindow's list of panes, then
* remove it from that list.
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i] == slavePtr) {
- for (j = i; j < masterPtr->numSlaves - 1; j++) {
- masterPtr->slaves[j] = masterPtr->slaves[j + 1];
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i] == panePtr) {
+ for (j = i; j < containerPtr->numPanes - 1; j++) {
+ containerPtr->panes[j] = containerPtr->panes[j + 1];
}
break;
}
}
/*
- * Clean out any -after or -before references to this slave
+ * Clean out any -after or -before references to this pane
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
- masterPtr->slaves[i]->before = NULL;
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i]->before == panePtr->tkwin) {
+ containerPtr->panes[i]->before = NULL;
}
- if (masterPtr->slaves[i]->after == slavePtr->tkwin) {
- masterPtr->slaves[i]->after = NULL;
+ if (containerPtr->panes[i]->after == panePtr->tkwin) {
+ containerPtr->panes[i]->after = NULL;
}
}
- masterPtr->flags |= REQUESTED_RELAYOUT;
- if (!(masterPtr->flags & REDRAW_PENDING)) {
- masterPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ if (!(containerPtr->flags & REDRAW_PENDING)) {
+ containerPtr->flags |= REDRAW_PENDING;
+ Tcl_DoWhenIdle(DisplayPanedWindow, containerPtr);
}
/*
- * Set the slave's masterPtr to NULL, so that we can tell that the slave
+ * Set the pane's containerPtr to NULL, so that we can tell that the pane
* is no longer attached to any panedwindow.
*/
- slavePtr->masterPtr = NULL;
+ panePtr->containerPtr = NULL;
- masterPtr->numSlaves--;
+ containerPtr->numPanes--;
}
/*
@@ -2079,7 +2075,7 @@ Unlink(
* token in a given paned window.
*
* Results:
- * Pointer to the slave structure, or NULL if the window is not managed
+ * Pointer to the pane structure, or NULL if the window is not managed
* by this paned window.
*
* Side effects:
@@ -2088,16 +2084,16 @@ Unlink(
*----------------------------------------------------------------------
*/
-static Slave *
+static Pane *
GetPane(
PanedWindow *pwPtr, /* Pointer to the paned window info. */
Tk_Window tkwin) /* Window to search for. */
{
int i;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
- return pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
+ return pwPtr->panes[i];
}
}
return NULL;
@@ -2128,8 +2124,8 @@ GetFirstLastVisiblePane(
{
int i;
- for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->hide == 0) {
+ for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->hide == 0) {
if (*firstPtr < 0) {
*firstPtr = i;
}
@@ -2141,7 +2137,7 @@ GetFirstLastVisiblePane(
/*
*--------------------------------------------------------------
*
- * SlaveStructureProc --
+ * PaneStructureProc --
*
* This function is invoked whenever StructureNotify events occur for a
* window that's managed by a paned window. This function's only purpose
@@ -2151,25 +2147,25 @@ GetFirstLastVisiblePane(
* None.
*
* Side effects:
- * The paned window slave structure associated with the window
- * is freed, and the slave is disassociated from the paned
+ * The paned window pane structure associated with the window
+ * is freed, and the pane is disassociated from the paned
* window which managed it.
*
*--------------------------------------------------------------
*/
static void
-SlaveStructureProc(
+PaneStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = slavePtr->masterPtr;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = panePtr->containerPtr;
if (eventPtr->type == DestroyNotify) {
- Unlink(slavePtr);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Unlink(panePtr);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
}
@@ -2180,7 +2176,7 @@ SlaveStructureProc(
* ComputeGeometry --
*
* Compute geometry for the paned window, including coordinates of all
- * slave windows and each sash.
+ * panes and each sash.
*
* Results:
* None.
@@ -2198,7 +2194,7 @@ ComputeGeometry(
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
int reqWidth, reqHeight, dim;
- Slave *slavePtr;
+ Pane *panePtr;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
pwPtr->flags |= REQUESTED_RELAYOUT;
@@ -2224,20 +2220,20 @@ ComputeGeometry(
+ pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * First set the coordinates for the top left corner of the slave's
+ * First set the coordinates for the top left corner of the pane's
* parcel.
*/
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Make sure the pane's paned dimension is at least minsize. This
@@ -2246,12 +2242,12 @@ ComputeGeometry(
*/
if (horizontal) {
- if (slavePtr->paneWidth < slavePtr->minSize) {
- slavePtr->paneWidth = slavePtr->minSize;
+ if (panePtr->paneWidth < panePtr->minSize) {
+ panePtr->paneWidth = panePtr->minSize;
}
} else {
- if (slavePtr->paneHeight < slavePtr->minSize) {
- slavePtr->paneHeight = slavePtr->minSize;
+ if (panePtr->paneHeight < panePtr->minSize) {
+ panePtr->paneHeight = panePtr->minSize;
}
}
@@ -2261,55 +2257,55 @@ ComputeGeometry(
*/
if (horizontal) {
- x += slavePtr->paneWidth + (2 * slavePtr->padx);
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ x += panePtr->paneWidth + (2 * panePtr->padx);
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += slavePtr->paneHeight + (2 * slavePtr->pady);
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ y += panePtr->paneHeight + (2 * panePtr->pady);
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Find the maximum height/width of the slaves, for computing the
+ * Find the maximum height/width of the panes, for computing the
* requested height/width of the paned window.
*/
if (horizontal) {
/*
- * If the slave has an explicit height set, use that; otherwise,
- * use the slave's requested height.
+ * If the pane has an explicit height set, use that; otherwise,
+ * use the pane's requested height.
*/
- if (slavePtr->height > 0) {
- dim = slavePtr->height;
+ if (panePtr->height > 0) {
+ dim = panePtr->height;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->pady;
+ dim += 2 * panePtr->pady;
if (dim > reqHeight) {
reqHeight = dim;
}
} else {
/*
- * If the slave has an explicit width set use that; otherwise, use
- * the slave's requested width.
+ * If the pane has an explicit width set use that; otherwise, use
+ * the pane's requested width.
*/
- if (slavePtr->width > 0) {
- dim = slavePtr->width;
+ if (panePtr->width > 0) {
+ dim = panePtr->width;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->padx;
+ dim += 2 * panePtr->padx;
if (dim > reqWidth) {
reqWidth = dim;
}
@@ -2327,7 +2323,7 @@ ComputeGeometry(
* the paned window.
*
* The height (or width) is equal to the maximum height (or width) of the
- * slaves, plus the width of the border of the top and bottom (or left and
+ * panes, plus the width of the border of the top and bottom (or left and
* right) of the paned window.
*
* If the panedwindow has an explicit width/height set use that;
@@ -2373,10 +2369,8 @@ ComputeGeometry(
static void
DestroyOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
- Tcl_Interp *dummy) /* Pointer to the calling interp */
+ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */
{
- (void)dummy;
-
ckfree(clientData);
}
@@ -2399,8 +2393,8 @@ DestroyOptionTables(
static Tcl_Obj *
GetSticky(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
TkSizeT internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
@@ -2408,8 +2402,6 @@ GetSticky(
int sticky = *(int *)(recordPtr + internalOffset);
char buffer[5];
char *p = &buffer[0];
- (void)dummy;
- (void)tkwin;
if (sticky & STICK_NORTH) {
*p++ = 'n';
@@ -2449,9 +2441,9 @@ GetSticky(
static int
SetSticky(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */
Tcl_Obj **value, /* Pointer to the pointer to the value object.
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
@@ -2465,8 +2457,6 @@ SetSticky(
char c;
void *internalPtr;
const char *string;
- (void)dummy;
- (void)tkwin;
internalPtr = ComputeSlotAddress(recordPtr, internalOffset);
@@ -2531,14 +2521,11 @@ SetSticky(
static void
RestoreSticky(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
- (void)dummy;
- (void)tkwin;
-
*(int *)internalPtr = *(int *)oldInternalPtr;
}
@@ -2548,11 +2535,11 @@ RestoreSticky(
* AdjustForSticky --
*
* Given the x,y coords of the top-left corner of a pane, the dimensions
- * of that pane, and the dimensions of a slave, compute the x,y coords
- * and actual dimensions of the slave based on the slave's sticky value.
+ * of that pane, and the dimensions of a pane, compute the x,y coords
+ * and actual dimensions of the pane based on the pane's sticky value.
*
* Results:
- * No direct return; sets the x, y, slaveWidth and slaveHeight to correct
+ * No direct return; sets the x, y, paneWidth and paneHeight to correct
* values.
*
* Side effects:
@@ -2569,26 +2556,26 @@ AdjustForSticky(
int cavityHeight, /* Height of the cavity. */
int *xPtr, int *yPtr, /* Initially, coordinates of the top-left
* corner of cavity; also return values for
- * actual x, y coords of slave. */
- int *slaveWidthPtr, /* Slave width. */
- int *slaveHeightPtr) /* Slave height. */
+ * actual x, y coords of pane. */
+ int *paneWidthPtr, /* Pane width. */
+ int *paneHeightPtr) /* Pane height. */
{
- int diffx = 0; /* Cavity width - slave width. */
- int diffy = 0; /* Cavity hight - slave height. */
+ int diffx = 0; /* Cavity width - pane width. */
+ int diffy = 0; /* Cavity hight - pane height. */
- if (cavityWidth > *slaveWidthPtr) {
- diffx = cavityWidth - *slaveWidthPtr;
+ if (cavityWidth > *paneWidthPtr) {
+ diffx = cavityWidth - *paneWidthPtr;
}
- if (cavityHeight > *slaveHeightPtr) {
- diffy = cavityHeight - *slaveHeightPtr;
+ if (cavityHeight > *paneHeightPtr) {
+ diffy = cavityHeight - *paneHeightPtr;
}
if ((sticky & STICK_EAST) && (sticky & STICK_WEST)) {
- *slaveWidthPtr += diffx;
+ *paneWidthPtr += diffx;
}
if ((sticky & STICK_NORTH) && (sticky & STICK_SOUTH)) {
- *slaveHeightPtr += diffy;
+ *paneHeightPtr += diffy;
}
if (!(sticky & STICK_WEST)) {
*xPtr += (sticky & STICK_EAST) ? diffx : diffx/2;
@@ -2621,8 +2608,8 @@ MoveSash(
int diff)
{
int i;
- int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset;
- Slave *slavePtr;
+ int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset;
+ Pane *panePtr;
int stretchReserve = 0;
int nextSash = sash + 1;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
@@ -2631,7 +2618,7 @@ MoveSash(
return;
/*
- * Update the slave sizes with their real sizes.
+ * Update the pane sizes with their real sizes.
*/
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
@@ -2640,17 +2627,17 @@ MoveSash(
} else {
sashOffset = pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slavePtr->sashx
- - sashOffset - slavePtr->x - (2 * slavePtr->padx);
+ panePtr->paneWidth = panePtr->width = panePtr->sashx
+ - sashOffset - panePtr->x - (2 * panePtr->padx);
} else {
- slavePtr->paneHeight = slavePtr->height = slavePtr->sashy
- - sashOffset - slavePtr->y - (2 * slavePtr->pady);
+ panePtr->paneHeight = panePtr->height = panePtr->sashy
+ - sashOffset - panePtr->y - (2 * panePtr->pady);
}
}
@@ -2660,7 +2647,7 @@ MoveSash(
* pane to either side of the sash.
*/
- while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) {
+ while (nextSash < pwPtr->numPanes-1 && pwPtr->panes[nextSash]->hide) {
nextSash++;
}
@@ -2671,7 +2658,7 @@ MoveSash(
if (diff > 0) {
expandPane = sash;
reduceFirst = nextSash;
- reduceLast = pwPtr->numSlaves;
+ reduceLast = pwPtr->numPanes;
reduceIncr = 1;
} else {
diff = abs(diff);
@@ -2687,14 +2674,14 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- stretchReserve += slavePtr->width - slavePtr->minSize;
+ stretchReserve += panePtr->width - panePtr->minSize;
} else {
- stretchReserve += slavePtr->height - slavePtr->minSize;
+ stretchReserve += panePtr->height - panePtr->minSize;
}
}
if (stretchReserve <= 0) {
@@ -2708,11 +2695,11 @@ MoveSash(
* Expand pane by diff amount.
*/
- slavePtr = pwPtr->slaves[expandPane];
+ panePtr = pwPtr->panes[expandPane];
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width += diff;
+ panePtr->paneWidth = panePtr->width += diff;
} else {
- slavePtr->paneHeight = slavePtr->height += diff;
+ panePtr->paneHeight = panePtr->height += diff;
}
/*
@@ -2720,26 +2707,26 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slaveSize = slavePtr->width;
+ paneSize = panePtr->width;
} else {
- slaveSize = slavePtr->height;
+ paneSize = panePtr->height;
}
- if (diff > (slaveSize - slavePtr->minSize)) {
- diff -= slaveSize - slavePtr->minSize;
- slaveSize = slavePtr->minSize;
+ if (diff > (paneSize - panePtr->minSize)) {
+ diff -= paneSize - panePtr->minSize;
+ paneSize = panePtr->minSize;
} else {
- slaveSize -= diff;
+ paneSize -= diff;
i = reduceLast - reduceIncr;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slaveSize;
+ panePtr->paneWidth = panePtr->width = paneSize;
} else {
- slavePtr->paneHeight = slavePtr->height = slaveSize;
+ panePtr->paneHeight = panePtr->height = paneSize;
}
}
}
@@ -2962,9 +2949,9 @@ PanedWindowProxyCommand(
/*
* Make sure the proxy window is higher in the stacking order than the
- * slaves, so that it will be visible when drawn. It would be more
+ * panes, so that it will be visible when drawn. It would be more
* correct to push the proxy window just high enough to appear above
- * the highest slave, but it's much easier to just force it all the
+ * the highest pane, but it's much easier to just force it all the
* way to the top of the stacking order.
*/
@@ -3114,12 +3101,12 @@ PanedWindowIdentifyCoords(
GetFirstLastVisiblePane(pwPtr, &first, &last);
isHandle = 0;
found = -1;
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- if (pwPtr->slaves[i]->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ if (pwPtr->panes[i]->hide || i == last) {
continue;
}
- thisx = pwPtr->slaves[i]->sashx;
- thisy = pwPtr->slaves[i]->sashy;
+ thisx = pwPtr->panes[i]->sashx;
+ thisy = pwPtr->panes[i]->sashy;
if (((thisx - lpad) <= x && x <= (thisx + rpad + sashWidth)) &&
((thisy - tpad) <= y && y <= (thisy + bpad + sashHeight))) {
@@ -3130,8 +3117,8 @@ PanedWindowIdentifyCoords(
*/
if (pwPtr->showHandle) {
- thisx = pwPtr->slaves[i]->handlex;
- thisy = pwPtr->slaves[i]->handley;
+ thisx = pwPtr->panes[i]->handlex;
+ thisy = pwPtr->panes[i]->handley;
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (thisy <= y && y <= (thisy + pwPtr->handleSize)) {
isHandle = 1;
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
index a3666d4..ed8fb0b 100644
--- a/generic/tkPkgConfig.c
+++ b/generic/tkPkgConfig.c
@@ -40,7 +40,7 @@
#ifndef TCL_CFGVAL_ENCODING
-#define TCL_CFGVAL_ENCODING "ascii"
+#define TCL_CFGVAL_ENCODING "utf-8"
#endif
/*
@@ -84,7 +84,7 @@
# define CFG_PROFILED "0"
#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
# define CFG_FONTSYSTEM "gdi"
#elif defined(MAC_OSX_TK)
# define CFG_FONTSYSTEM "cocoa"
@@ -100,6 +100,9 @@ static const Tcl_Config cfg[] = {
{"profiled", CFG_PROFILED},
{"64bit", CFG_64},
{"optimized", CFG_OPTIMIZED},
+#ifdef TK_NO_DEPRECATED
+ {"nodeprecated", "1"},
+#endif
{"mem_debug", CFG_MEMDEBUG},
{"fontsystem", CFG_FONTSYSTEM},
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 2b5ab2d..8d6b87e 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -17,10 +17,10 @@
* Border modes for relative placement:
*
* BM_INSIDE: relative distances computed using area inside all
- * borders of master window.
+ * borders of container window.
* BM_OUTSIDE: relative distances computed using outside area that
- * includes all borders of master.
- * BM_IGNORE: border issues are ignored: place relative to master's
+ * includes all borders of container.
+ * BM_IGNORE: border issues are ignored: place relative to container's
* actual window size.
*/
@@ -35,16 +35,16 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;
* structure of the following type:
*/
-typedef struct Slave {
+typedef struct Content {
Tk_Window tkwin; /* Tk's token for window. */
Tk_Window inTkwin; /* Token for the -in window. */
- struct Master *masterPtr; /* Pointer to information for window relative
+ struct Container *containerPtr; /* Pointer to information for window relative
* to which tkwin is placed. This isn't
* necessarily the logical parent of tkwin.
- * NULL means the master was deleted or never
+ * NULL means the container was deleted or never
* assigned. */
- struct Slave *nextPtr; /* Next in list of windows placed relative to
- * same master (NULL for end of list). */
+ struct Content *nextPtr; /* Next in list of windows placed relative to
+ * same container (NULL for end of list). */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this command. */
/*
@@ -57,22 +57,22 @@ typedef struct Slave {
Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel
* spec. information. */
double relX, relY; /* X and Y coordinates relative to size of
- * master. */
+ * container. */
int width, height; /* Absolute dimensions for tkwin. */
Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel
* spec. */
Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel
* spec. */
double relWidth, relHeight; /* Dimensions for tkwin relative to size of
- * master. */
+ * container. */
Tcl_Obj *relWidthPtr;
Tcl_Obj *relHeightPtr;
Tk_Anchor anchor; /* Which point on tkwin is placed at the given
* position. */
- BorderMode borderMode; /* How to treat borders of master window. */
+ BorderMode borderMode; /* How to treat borders of container window. */
int flags; /* Various flags; see below for bit
* definitions. */
-} Slave;
+} Content;
/*
* Type masks for options:
@@ -82,34 +82,34 @@ typedef struct Slave {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
- offsetof(Slave, anchor), 0, 0, 0},
+ offsetof(Content, anchor), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
- offsetof(Slave, borderMode), 0, borderModeStrings, 0},
- {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Slave, heightPtr),
- offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Slave, inTkwin),
+ offsetof(Content, borderMode), 0, borderModeStrings, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr),
+ offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
0, 0, IN_MASK},
{TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "",
- offsetof(Slave, relHeightPtr), offsetof(Slave, relHeight),
+ offsetof(Content, relHeightPtr), offsetof(Content, relHeight),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "",
- offsetof(Slave, relWidthPtr), offsetof(Slave, relWidth),
+ offsetof(Content, relWidthPtr), offsetof(Content, relWidth),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", TCL_INDEX_NONE,
- offsetof(Slave, relX), 0, 0, 0},
+ offsetof(Content, relX), 0, 0, 0},
{TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", TCL_INDEX_NONE,
- offsetof(Slave, relY), 0, 0, 0},
- {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Slave, widthPtr),
- offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Slave, xPtr),
- offsetof(Slave, x), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Slave, yPtr),
- offsetof(Slave, y), TK_OPTION_NULL_OK, 0, 0},
+ offsetof(Content, relY), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr),
+ offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr),
+ offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr),
+ offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
- * Flag definitions for Slave structures:
+ * Flag definitions for Content structures:
*
* CHILD_WIDTH - 1 means -width was specified;
* CHILD_REL_WIDTH - 1 means -relwidth was specified.
@@ -123,25 +123,25 @@ static const Tk_OptionSpec optionSpecs[] = {
#define CHILD_REL_HEIGHT 8
/*
- * For each master window that has a slave managed by the placer there is a
+ * For each container window that has a content managed by the placer there is a
* structure of the following form:
*/
-typedef struct Master {
- Tk_Window tkwin; /* Tk's token for master window. */
- struct Slave *slavePtr; /* First in linked list of slaves placed
- * relative to this master. */
+typedef struct Container {
+ Tk_Window tkwin; /* Tk's token for container window. */
+ struct Content *contentPtr; /* First in linked list of content windowslaced
+ * relative to this container. */
int *abortPtr; /* If non-NULL, it means that there is a nested
* call to RecomputePlacement already working on
* this window. *abortPtr may be set to 1 to
* abort that nested call. This happens, for
- * example, if tkwin or any of its slaves
+ * example, if tkwin or any of its content
* is deleted. */
int flags; /* See below for bit definitions. */
-} Master;
+} Container;
/*
- * Flag definitions for masters:
+ * Flag definitions for containers:
*
* PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is
* already pending via a Do_When_Idle handler.
@@ -155,34 +155,34 @@ typedef struct Master {
static void PlaceRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void PlaceLostSlaveProc(ClientData clientData,
+static void PlaceLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr placerType = {
"place", /* name */
PlaceRequestProc, /* requestProc */
- PlaceLostSlaveProc, /* lostSlaveProc */
+ PlaceLostContentProc, /* lostContentProc */
};
/*
* Forward declarations for functions defined later in this file:
*/
-static void SlaveStructureProc(ClientData clientData,
+static void ContentStructureProc(ClientData clientData,
XEvent *eventPtr);
-static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
Tk_OptionTable table, int objc,
Tcl_Obj *const objv[]);
static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin);
-static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table);
-static void FreeSlave(Slave *slavePtr);
-static Slave * FindSlave(Tk_Window tkwin);
-static Master * CreateMaster(Tk_Window tkwin);
-static Master * FindMaster(Tk_Window tkwin);
-static void MasterStructureProc(ClientData clientData,
+static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table);
+static void FreeContent(Content *contentPtr);
+static Content * FindContent(Tk_Window tkwin);
+static Container * CreateContainer(Tk_Window tkwin);
+static Container * FindContainer(Tk_Window tkwin);
+static void PlaceStructureProc(ClientData clientData,
XEvent *eventPtr);
static void RecomputePlacement(ClientData clientData);
-static void UnlinkSlave(Slave *slavePtr);
+static void UnlinkContent(Content *contentPtr);
/*
*--------------------------------------------------------------
@@ -210,13 +210,16 @@ Tk_PlaceObjCmd(
{
Tk_Window main_win = (Tk_Window)clientData;
Tk_Window tkwin;
- Slave *slavePtr;
+ Content *contentPtr;
TkDisplay *dispPtr;
Tk_OptionTable optionTable;
static const char *const optionStrings[] = {
- "configure", "forget", "info", "slaves", NULL
+ "configure", "content", "forget", "info", "slaves", NULL
};
- enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", NULL
+ };
+ enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
if (objc < 3) {
@@ -247,12 +250,12 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, optionTable, objc-2, objv+2);
}
/*
@@ -271,13 +274,21 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+ /*
+ * Call it again without the deprecated ones to get a proper error
+ * message. This works well since there can't be any ambiguity between
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -286,11 +297,11 @@ Tk_PlaceObjCmd(
if (objc == 3 || objc == 4) {
Tcl_Obj *objPtr;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- objPtr = Tk_GetOptionInfo(interp, slavePtr, optionTable,
+ objPtr = Tk_GetOptionInfo(interp, contentPtr, optionTable,
(objc == 4) ? objv[3] : NULL, tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -298,29 +309,29 @@ Tk_PlaceObjCmd(
Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3);
+ return ConfigureContent(interp, tkwin, optionTable, objc-3, objv+3);
case PLACE_FORGET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pathName");
return TCL_ERROR;
}
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ UnlinkContent(contentPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
Tk_ManageGeometry(tkwin, NULL, NULL);
Tk_UnmapWindow(tkwin);
- FreeSlave(slavePtr);
+ FreeContent(contentPtr);
break;
case PLACE_INFO:
@@ -330,21 +341,22 @@ Tk_PlaceObjCmd(
}
return PlaceInfoCommand(interp, tkwin);
- case PLACE_SLAVES: {
- Master *masterPtr;
+ case PLACE_SLAVES:
+ case PLACE_CONTENT: {
+ Container *containerPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pathName");
return TCL_ERROR;
}
- masterPtr = FindMaster(tkwin);
- if (masterPtr != NULL) {
+ containerPtr = FindContainer(tkwin);
+ if (containerPtr != NULL) {
Tcl_Obj *listPtr = Tcl_NewObj();
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, listPtr,
- TkNewWindowObj(slavePtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, listPtr);
}
@@ -358,59 +370,59 @@ Tk_PlaceObjCmd(
/*
*----------------------------------------------------------------------
*
- * CreateSlave --
+ * CreateContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Slave structure.
+ * Pointer to the Content structure.
*
* Side effects:
- * A new Slave structure may be created.
+ * A new Content structure may be created.
*
*----------------------------------------------------------------------
*/
-static Slave *
-CreateSlave(
- Tk_Window tkwin, /* Token for desired slave. */
+static Content *
+CreateContent(
+ Tk_Window tkwin, /* Token for desired content. */
Tk_OptionTable table)
{
Tcl_HashEntry *hPtr;
- Slave *slavePtr;
+ Content *contentPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->contentTable, (char *) tkwin, &isNew);
if (!isNew) {
- return (Slave *)Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
- * No preexisting slave structure for that window, so make a new one and
+ * No preexisting content structure for that window, so make a new one and
* populate it with some default values.
*/
- slavePtr = (Slave *)ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- slavePtr->tkwin = tkwin;
- slavePtr->inTkwin = NULL;
- slavePtr->anchor = TK_ANCHOR_NW;
- slavePtr->borderMode = BM_INSIDE;
- slavePtr->optionTable = table;
- Tcl_SetHashValue(hPtr, slavePtr);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- return slavePtr;
+ contentPtr = (Content *)ckalloc(sizeof(Content));
+ memset(contentPtr, 0, sizeof(Content));
+ contentPtr->tkwin = tkwin;
+ contentPtr->inTkwin = NULL;
+ contentPtr->anchor = TK_ANCHOR_NW;
+ contentPtr->borderMode = BM_INSIDE;
+ contentPtr->optionTable = table;
+ Tcl_SetHashValue(hPtr, contentPtr);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ return contentPtr;
}
/*
*----------------------------------------------------------------------
*
- * FreeSlave --
+ * FreeContent --
*
- * Frees the resources held by a Slave structure.
+ * Frees the resources held by a Content structure.
*
* Results:
* None
@@ -422,25 +434,25 @@ CreateSlave(
*/
static void
-FreeSlave(
- Slave *slavePtr)
+FreeContent(
+ Content *contentPtr)
{
- Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable,
- slavePtr->tkwin);
- ckfree(slavePtr);
+ Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable,
+ contentPtr->tkwin);
+ ckfree(contentPtr);
}
/*
*----------------------------------------------------------------------
*
- * FindSlave --
+ * FindContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content structure corresponding to
* that token. This is purely a lookup function; it will not create a
* record if one does not yet exist.
*
* Results:
- * Pointer to Slave structure; NULL if none exists.
+ * Pointer to Content structure; NULL if none exists.
*
* Side effects:
* None.
@@ -448,121 +460,121 @@ FreeSlave(
*----------------------------------------------------------------------
*/
-static Slave *
-FindSlave(
- Tk_Window tkwin) /* Token for desired slave. */
+static Content *
+FindContent(
+ Tk_Window tkwin) /* Token for desired content. */
{
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->contentTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
- return (Slave *)Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * UnlinkSlave --
+ * UnlinkContent --
*
- * This function removes a slave window from the chain of slaves in its
- * master.
+ * This function removes a content window from the chain of content windows in its
+ * container.
*
* Results:
* None.
*
* Side effects:
- * The slave list of slavePtr's master changes.
+ * The content list of contentPtr's container changes.
*
*----------------------------------------------------------------------
*/
static void
-UnlinkSlave(
- Slave *slavePtr) /* Slave structure to be unlinked. */
+UnlinkContent(
+ Content *contentPtr) /* Content structure to be unlinked. */
{
- Master *masterPtr;
- Slave *prevPtr;
+ Container *containerPtr;
+ Content *prevPtr;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- Tcl_Panic("UnlinkSlave couldn't find slave to unlink");
+ Tcl_Panic("UnlinkContent couldn't find content to unlink");
}
- if (prevPtr->nextPtr == slavePtr) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (prevPtr->nextPtr == contentPtr) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- slavePtr->masterPtr = NULL;
+ contentPtr->containerPtr = NULL;
}
/*
*----------------------------------------------------------------------
*
- * CreateMaster --
+ * CreateContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Master structure.
+ * Pointer to the Container structure.
*
* Side effects:
- * A new Master structure may be created.
+ * A new Container structure may be created.
*
*----------------------------------------------------------------------
*/
-static Master *
-CreateMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+CreateContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
Tcl_HashEntry *hPtr;
- Master *masterPtr;
+ Container *containerPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->containerTable, (char *)tkwin, &isNew);
if (isNew) {
- masterPtr = (Master *)ckalloc(sizeof(Master));
- masterPtr->tkwin = tkwin;
- masterPtr->slavePtr = NULL;
- masterPtr->abortPtr = NULL;
- masterPtr->flags = 0;
- Tcl_SetHashValue(hPtr, masterPtr);
- Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask,
- MasterStructureProc, masterPtr);
+ containerPtr = (Container *)ckalloc(sizeof(Container));
+ containerPtr->tkwin = tkwin;
+ containerPtr->contentPtr = NULL;
+ containerPtr->abortPtr = NULL;
+ containerPtr->flags = 0;
+ Tcl_SetHashValue(hPtr, containerPtr);
+ Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask,
+ PlaceStructureProc, containerPtr);
} else {
- masterPtr = (Master *)Tcl_GetHashValue(hPtr);
+ containerPtr = (Container *)Tcl_GetHashValue(hPtr);
}
- return masterPtr;
+ return containerPtr;
}
/*
*----------------------------------------------------------------------
*
- * FindMaster --
+ * FindContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container structure corresponding to
* that token. This is simply a lookup function; a new record will not be
* created if one does not already exist.
*
* Results:
- * Pointer to the Master structure; NULL if one does not exist for the
+ * Pointer to the Container structure; NULL if one does not exist for the
* given Tk_Window token.
*
* Side effects:
@@ -571,24 +583,24 @@ CreateMaster(
*----------------------------------------------------------------------
*/
-static Master *
-FindMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+FindContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->containerTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
- return (Master *)Tcl_GetHashValue(hPtr);
+ return (Container *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * ConfigureSlave --
+ * ConfigureContent --
*
* This function is called to process an argv/argc list to reconfigure
* the placement of a window.
@@ -598,26 +610,26 @@ FindMaster(
* the interp's result.
*
* Side effects:
- * Information in slavePtr may change, and slavePtr's master is scheduled
+ * Information in contentPtr may change, and contentPtr's container is scheduled
* for reconfiguration.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlave(
+ConfigureContent(
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Window tkwin, /* Token for the window to manipulate. */
Tk_OptionTable table, /* Token for option table. */
int objc, /* Number of config arguments. */
Tcl_Obj *const objv[]) /* Object values for arguments. */
{
- Master *masterPtr;
+ Container *containerPtr;
Tk_SavedOptions savedOptions;
int mask;
- Slave *slavePtr;
- Tk_Window masterWin = NULL;
- TkWindow *master;
+ Content *contentPtr;
+ Tk_Window containerWin = NULL;
+ TkWindow *container;
if (Tk_TopWinHierarchy(tkwin)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -627,71 +639,71 @@ ConfigureSlave(
return TCL_ERROR;
}
- slavePtr = CreateSlave(tkwin, table);
+ contentPtr = CreateContent(tkwin, table);
- if (Tk_SetOptions(interp, slavePtr, table, objc, objv,
- slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) {
+ if (Tk_SetOptions(interp, contentPtr, table, objc, objv,
+ contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
goto error;
}
/*
- * Set slave flags. First clear the field, then add bits as needed.
+ * Set content flags. First clear the field, then add bits as needed.
*/
- slavePtr->flags = 0;
- if (slavePtr->heightPtr) {
- slavePtr->flags |= CHILD_HEIGHT;
+ contentPtr->flags = 0;
+ if (contentPtr->heightPtr) {
+ contentPtr->flags |= CHILD_HEIGHT;
}
- if (slavePtr->relHeightPtr) {
- slavePtr->flags |= CHILD_REL_HEIGHT;
+ if (contentPtr->relHeightPtr) {
+ contentPtr->flags |= CHILD_REL_HEIGHT;
}
- if (slavePtr->relWidthPtr) {
- slavePtr->flags |= CHILD_REL_WIDTH;
+ if (contentPtr->relWidthPtr) {
+ contentPtr->flags |= CHILD_REL_WIDTH;
}
- if (slavePtr->widthPtr) {
- slavePtr->flags |= CHILD_WIDTH;
+ if (contentPtr->widthPtr) {
+ contentPtr->flags |= CHILD_WIDTH;
}
- if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) {
+ if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) {
/*
- * If no -in option was passed and the slave is already placed then
+ * If no -in option was passed and the content is already placed then
* just recompute the placement.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
} else if (mask & IN_MASK) {
/* -in changed */
- Tk_Window tkwin;
+ Tk_Window win;
Tk_Window ancestor;
- tkwin = slavePtr->inTkwin;
+ win = contentPtr->inTkwin;
/*
- * Make sure that the new master is either the logical parent of the
- * slave or a descendant of that window, and that the master and slave
+ * Make sure that the new container is either the logical parent of the
+ * content window or a descendant of that window, and that the container and content
* aren't the same.
*/
- for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) {
- if (ancestor == Tk_Parent(slavePtr->tkwin)) {
+ for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) {
+ if (ancestor == Tk_Parent(contentPtr->tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to %s",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ "can't place \"%s\" relative to \"%s\"",
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
goto error;
}
}
- if (slavePtr->tkwin == tkwin) {
+ if (contentPtr->tkwin == win) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to itself",
- Tk_PathName(slavePtr->tkwin)));
+ "can't place \"%s\" relative to itself",
+ Tk_PathName(contentPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
@@ -700,66 +712,66 @@ ConfigureSlave(
* Check for management loops.
*/
- for (master = (TkWindow *)tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slavePtr->tkwin) {
+ for (container = (TkWindow *)win; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
}
- if (tkwin != Tk_Parent(slavePtr->tkwin)) {
- ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin;
+ if (win != Tk_Parent(contentPtr->tkwin)) {
+ ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win;
}
- if ((slavePtr->masterPtr != NULL)
- && (slavePtr->masterPtr->tkwin == tkwin)) {
+ if ((contentPtr->containerPtr != NULL)
+ && (contentPtr->containerPtr->tkwin == win)) {
/*
- * Re-using same old master. Nothing to do.
+ * Re-using same old container. Nothing to do.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
- masterWin = tkwin;
+ UnlinkContent(contentPtr);
+ containerWin = win;
}
/*
- * If there's no master specified for this slave, use its Tk_Parent.
+ * If there's no container specified for this content, use its Tk_Parent.
*/
- if (masterWin == NULL) {
- masterWin = Tk_Parent(slavePtr->tkwin);
- slavePtr->inTkwin = masterWin;
+ if (containerWin == NULL) {
+ containerWin = Tk_Parent(contentPtr->tkwin);
+ contentPtr->inTkwin = containerWin;
}
/*
- * Manage the slave window in this master.
+ * Manage the content window in this container.
*/
- masterPtr = CreateMaster(masterWin);
- slavePtr->masterPtr = masterPtr;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr);
+ containerPtr = CreateContainer(containerWin);
+ contentPtr->containerPtr = containerPtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr);
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
Tk_FreeSavedOptions(&savedOptions);
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return TCL_OK;
@@ -795,49 +807,49 @@ PlaceInfoCommand(
Tcl_Interp *interp, /* Interp into which to place result. */
Tk_Window tkwin) /* Token for the window to get info on. */
{
- Slave *slavePtr;
+ Content *contentPtr;
Tcl_Obj *infoObj;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
infoObj = Tcl_NewObj();
- if (slavePtr->masterPtr != NULL) {
+ if (contentPtr->containerPtr != NULL) {
Tcl_AppendToObj(infoObj, "-in", -1);
Tcl_ListObjAppendElement(NULL, infoObj,
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_AppendToObj(infoObj, " ", -1);
}
Tcl_AppendPrintfToObj(infoObj,
"-x %d -relx %.4g -y %d -rely %.4g",
- slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY);
- if (slavePtr->flags & CHILD_WIDTH) {
- Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width);
+ contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY);
+ if (contentPtr->flags & CHILD_WIDTH) {
+ Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width);
} else {
Tcl_AppendToObj(infoObj, " -width {}", -1);
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->flags & CHILD_REL_WIDTH) {
Tcl_AppendPrintfToObj(infoObj,
- " -relwidth %.4g", slavePtr->relWidth);
+ " -relwidth %.4g", contentPtr->relWidth);
} else {
Tcl_AppendToObj(infoObj, " -relwidth {}", -1);
}
- if (slavePtr->flags & CHILD_HEIGHT) {
- Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height);
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height);
} else {
Tcl_AppendToObj(infoObj, " -height {}", -1);
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
Tcl_AppendPrintfToObj(infoObj,
- " -relheight %.4g", slavePtr->relHeight);
+ " -relheight %.4g", contentPtr->relHeight);
} else {
Tcl_AppendToObj(infoObj, " -relheight {}", -1);
}
Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s",
- Tk_NameOfAnchor(slavePtr->anchor),
- borderModeStrings[slavePtr->borderMode]);
+ Tk_NameOfAnchor(contentPtr->anchor),
+ borderModeStrings[contentPtr->borderMode]);
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -848,7 +860,7 @@ PlaceInfoCommand(
* RecomputePlacement --
*
* This function is called as a when-idle handler. It recomputes the
- * geometries of all the slaves of a given master.
+ * geometries of all the content of a given container.
*
* Results:
* None.
@@ -861,17 +873,17 @@ PlaceInfoCommand(
static void
RecomputePlacement(
- ClientData clientData) /* Pointer to Master record. */
+ ClientData clientData) /* Pointer to Container record. */
{
- Master *masterPtr = (Master *)clientData;
- Slave *slavePtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr;
int x, y, width, height, tmp;
- int masterWidth, masterHeight, masterX, masterY;
+ int containerWidth, containerHeight, containerX, containerY;
double x1, y1, x2, y2;
int abort; /* May get set to non-zero to abort this
* placement operation. */
- masterPtr->flags &= ~PARENT_RECONFIG_PENDING;
+ containerPtr->flags &= ~PARENT_RECONFIG_PENDING;
/*
* Abort any nested call to RecomputePlacement for this window, since
@@ -879,57 +891,57 @@ RecomputePlacement(
* aborted if necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * Iterate over all the slaves for the master. Each slave's geometry can
- * be computed independently of the other slaves. Changes to the window's
+ * Iterate over all the content windows for the container. Each content's geometry can
+ * be computed independently of the other content. Changes to the window's
* structure could cause almost anything to happen, including deleting the
* parent or child. If this happens, we'll be told to abort.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
/*
- * Step 1: compute size and borderwidth of master, taking into account
+ * Step 1: compute size and borderwidth of container, taking into account
* desired border mode.
*/
- masterX = masterY = 0;
- masterWidth = Tk_Width(masterPtr->tkwin);
- masterHeight = Tk_Height(masterPtr->tkwin);
- if (slavePtr->borderMode == BM_INSIDE) {
- masterX = Tk_InternalBorderLeft(masterPtr->tkwin);
- masterY = Tk_InternalBorderTop(masterPtr->tkwin);
- masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin);
- masterHeight -= masterY +
- Tk_InternalBorderBottom(masterPtr->tkwin);
- } else if (slavePtr->borderMode == BM_OUTSIDE) {
- masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width;
- masterWidth -= 2 * masterX;
- masterHeight -= 2 * masterY;
+ containerX = containerY = 0;
+ containerWidth = Tk_Width(containerPtr->tkwin);
+ containerHeight = Tk_Height(containerPtr->tkwin);
+ if (contentPtr->borderMode == BM_INSIDE) {
+ containerX = Tk_InternalBorderLeft(containerPtr->tkwin);
+ containerY = Tk_InternalBorderTop(containerPtr->tkwin);
+ containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin);
+ containerHeight -= containerY +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ } else if (contentPtr->borderMode == BM_OUTSIDE) {
+ containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width;
+ containerWidth -= 2 * containerX;
+ containerHeight -= 2 * containerY;
}
/*
- * Step 2: compute size of slave (outside dimensions including border)
- * and location of anchor point within master.
+ * Step 2: compute size of content (outside dimensions including border)
+ * and location of anchor point within container.
*/
- x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth);
+ x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth);
x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5));
- y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight);
+ y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight);
y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5));
- if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
+ if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
width = 0;
- if (slavePtr->flags & CHILD_WIDTH) {
- width += slavePtr->width;
+ if (contentPtr->flags & CHILD_WIDTH) {
+ width += contentPtr->width;
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->flags & CHILD_REL_WIDTH) {
/*
* The code below is a bit tricky. In order to round correctly
* when both relX and relWidth are specified, compute the
@@ -938,40 +950,40 @@ RecomputePlacement(
* errors in relX and relWidth accumulate.
*/
- x2 = x1 + (slavePtr->relWidth*masterWidth);
+ x2 = x1 + (contentPtr->relWidth*containerWidth);
tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5));
width += tmp - x;
}
} else {
- width = Tk_ReqWidth(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width = Tk_ReqWidth(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
- if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
+ if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
height = 0;
- if (slavePtr->flags & CHILD_HEIGHT) {
- height += slavePtr->height;
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ height += contentPtr->height;
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
/*
* See note above for rounding errors in width computation.
*/
- y2 = y1 + (slavePtr->relHeight*masterHeight);
+ y2 = y1 + (contentPtr->relHeight*containerHeight);
tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5));
height += tmp - y;
}
} else {
- height = Tk_ReqHeight(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ height = Tk_ReqHeight(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
/*
* Step 3: adjust the x and y positions so that the desired anchor
- * point on the slave appears at that position. Also adjust for the
- * border mode and master's border.
+ * point on the content appears at that position. Also adjust for the
+ * border mode and container's border.
*/
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x -= width/2;
break;
@@ -1010,8 +1022,8 @@ RecomputePlacement(
* height aren't zero.
*/
- width -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
- height -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
+ height -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
if (width <= 0) {
width = 1;
}
@@ -1020,121 +1032,121 @@ RecomputePlacement(
}
/*
- * Step 5: reconfigure the window and map it if needed. If the slave
- * is a child of the master, we do this ourselves. If the slave isn't
- * a child of the master, let Tk_MaintainGeometry do the work (it will
+ * Step 5: reconfigure the window and map it if needed. If the content
+ * is a child of the container, we do this ourselves. If the content isn't
+ * a child of the container, let Tk_MaintainGeometry do the work (it will
* re-adjust things as relevant windows map, unmap, and move).
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
- if ((x != Tk_X(slavePtr->tkwin))
- || (y != Tk_Y(slavePtr->tkwin))
- || (width != Tk_Width(slavePtr->tkwin))
- || (height != Tk_Height(slavePtr->tkwin))) {
- Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height);
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
break;
}
/*
- * Don't map the slave unless the master is mapped: the slave will
- * get mapped later, when the master is mapped.
+ * Don't map the content unless the container is mapped: the content will
+ * get mapped later, when the container is mapped.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
*----------------------------------------------------------------------
*
- * MasterStructureProc --
+ * PlaceStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a master window.
+ * events occur for a container window.
*
* Results:
* None.
*
* Side effects:
* Structures get cleaned up if the window was deleted. If the window was
- * resized then slave geometries get recomputed.
+ * resized then content geometries get recomputed.
*
*----------------------------------------------------------------------
*/
static void
-MasterStructureProc(
- ClientData clientData, /* Pointer to Master structure for window
+PlaceStructureProc(
+ ClientData clientData, /* Pointer to Container structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Master *masterPtr = (Master *)clientData;
- Slave *slavePtr, *nextPtr;
- TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr, *nextPtr;
+ TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr;
switch (eventPtr->type) {
case ConfigureNotify:
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case DestroyNotify:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable,
- masterPtr->tkwin));
- if (masterPtr->flags & PARENT_RECONFIG_PENDING) {
- Tcl_CancelIdleCall(RecomputePlacement, masterPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->containerTable,
+ containerPtr->tkwin));
+ if (containerPtr->flags & PARENT_RECONFIG_PENDING) {
+ Tcl_CancelIdleCall(RecomputePlacement, containerPtr);
}
- masterPtr->tkwin = NULL;
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ containerPtr->tkwin = NULL;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(containerPtr, TCL_DYNAMIC);
return;
case MapNotify:
/*
- * When a master gets mapped, must redo the geometry computation so
- * that all of its slaves get remapped.
+ * When a container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case UnmapNotify:
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't keep redisplaying themselves.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
return;
}
@@ -1143,10 +1155,10 @@ MasterStructureProc(
/*
*----------------------------------------------------------------------
*
- * SlaveStructureProc --
+ * ContentStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a slave window.
+ * events occur for a content window.
*
* Results:
* None.
@@ -1158,21 +1170,21 @@ MasterStructureProc(
*/
static void
-SlaveStructureProc(
- ClientData clientData, /* Pointer to Slave structure for window
+ContentStructureProc(
+ ClientData clientData, /* Pointer to Content structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = (Slave *)clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
if (eventPtr->type == DestroyNotify) {
- if (slavePtr->masterPtr != NULL) {
- UnlinkSlave(slavePtr);
+ if (contentPtr->containerPtr != NULL) {
+ UnlinkContent(contentPtr);
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- slavePtr->tkwin));
- FreeSlave(slavePtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
+ contentPtr->tkwin));
+ FreeContent(contentPtr);
}
}
@@ -1181,7 +1193,7 @@ SlaveStructureProc(
*
* PlaceRequestProc --
*
- * This function is invoked by Tk whenever a slave managed by us changes
+ * This function is invoked by Tk whenever a content managed by us changes
* its requested geometry.
*
* Results:
@@ -1196,69 +1208,68 @@ SlaveStructureProc(
static void
PlaceRequestProc(
- ClientData clientData, /* Pointer to our record for slave. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ ClientData clientData, /* Pointer to our record for content. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
- Slave *slavePtr = (Slave *)clientData;
- Master *masterPtr;
- (void)tkwin;
+ Content *contentPtr = (Content *)clientData;
+ Container *containerPtr;
- if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
- && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
+ if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
+ && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
/*
* Send a ConfigureNotify to indicate that the size change
* request was rejected.
*/
- TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin));
+ TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin));
return;
}
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
}
/*
*--------------------------------------------------------------
*
- * PlaceLostSlaveProc --
+ * PlaceLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all placer-related information about the slave.
+ * Forgets all placer-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-PlaceLostSlaveProc(
- ClientData clientData, /* Slave structure for slave window that was
+PlaceLostContentProc(
+ ClientData clientData, /* Content structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window. */
{
- Slave *slavePtr = (Slave *)clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
Tk_UnmapWindow(tkwin);
- UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ UnlinkContent(contentPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- FreeSlave(slavePtr);
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ FreeContent(contentPtr);
}
/*
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index db9141c..902e73d 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -54,28 +54,18 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
LRESULT *result);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
-/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus(void);
-/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
-/* 3 */
-EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
/* 4 */
EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
/* 5 */
-EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
/* 6 */
EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
-/* 7 */
-EXTERN void * TkMacOSXGetDrawablePort(Drawable drawable);
+/* Slot 7 is reserved */
/* 8 */
EXTERN void * TkMacOSXGetRootControl(Drawable drawable);
/* 9 */
@@ -83,22 +73,15 @@ EXTERN void Tk_MacOSXSetupTkNotifier(void);
/* 10 */
EXTERN int Tk_MacOSXIsAppInFront(void);
/* 11 */
-EXTERN void Tk_MacOSXSetEmbedHandler_(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
+EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w);
/* 12 */
-EXTERN void Tk_MacOSXTurnOffMenus_(void);
+EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable);
/* 13 */
-EXTERN void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt);
-/* 14 */
-EXTERN void TkMacOSXInitMenus_(Tcl_Interp *interp);
-/* 15 */
-EXTERN void TkMacOSXInitAppleEvents_(Tcl_Interp *interp);
+EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable);
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
/* 16 */
-EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
#endif /* AQUA */
@@ -115,23 +98,23 @@ typedef struct TkPlatStubs {
int (*tk_TranslateWinEvent) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- void (*tk_MacOSXSetEmbedHandler) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 0 */
- void (*tk_MacOSXTurnOffMenus) (void); /* 1 */
- void (*tk_MacOSXTkOwnsCursor) (int tkOwnsIt); /* 2 */
- void (*tkMacOSXInitMenus) (Tcl_Interp *interp); /* 3 */
+ void (*reserved0)(void);
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
- void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
- void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
+ void (*reserved7)(void);
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
int (*tk_MacOSXIsAppInFront) (void); /* 10 */
- void (*tk_MacOSXSetEmbedHandler_) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 11 */
- void (*tk_MacOSXTurnOffMenus_) (void); /* 12 */
- void (*tk_MacOSXTkOwnsCursor_) (int tkOwnsIt); /* 13 */
- void (*tkMacOSXInitMenus_) (Tcl_Interp *interp); /* 14 */
- void (*tkMacOSXInitAppleEvents_) (Tcl_Interp *interp); /* 15 */
- void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
+ Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */
+ void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */
+ void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */
+ void (*reserved14)(void);
+ void (*reserved15)(void);
+ void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
#endif /* AQUA */
} TkPlatStubs;
@@ -162,53 +145,39 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-#define Tk_MacOSXSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
-#define Tk_MacOSXTurnOffMenus \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */
-#define Tk_MacOSXTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */
-#define TkMacOSXInitMenus \
- (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
#define TkMacOSXInitAppleEvents \
(tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */
+#define TkGenWMConfigureEvent_ \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 5 */
#define TkMacOSXInvalClipRgns \
(tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */
-#define TkMacOSXGetDrawablePort \
- (tkPlatStubsPtr->tkMacOSXGetDrawablePort) /* 7 */
+/* Slot 7 is reserved */
#define TkMacOSXGetRootControl \
(tkPlatStubsPtr->tkMacOSXGetRootControl) /* 8 */
#define Tk_MacOSXSetupTkNotifier \
(tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */
#define Tk_MacOSXIsAppInFront \
(tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */
-#define Tk_MacOSXSetEmbedHandler_ \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler_) /* 11 */
-#define Tk_MacOSXTurnOffMenus_ \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus_) /* 12 */
-#define Tk_MacOSXTkOwnsCursor_ \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor_) /* 13 */
-#define TkMacOSXInitMenus_ \
- (tkPlatStubsPtr->tkMacOSXInitMenus_) /* 14 */
-#define TkMacOSXInitAppleEvents_ \
- (tkPlatStubsPtr->tkMacOSXInitAppleEvents_) /* 15 */
-#define TkGenWMConfigureEvent_ \
- (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 16 */
+#define Tk_MacOSXGetTkWindow \
+ (tkPlatStubsPtr->tk_MacOSXGetTkWindow) /* 11 */
+#define Tk_MacOSXGetCGContextForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetCGContextForDrawable) /* 12 */
+#define Tk_MacOSXGetNSWindowForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+#define TkGenWMConfigureEvent \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 16 */
#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) */
/* !END!: Do not edit above this line. */
-#undef Tk_MacOSXSetEmbedHandler_
-#undef Tk_MacOSXTurnOffMenus_
-#undef Tk_MacOSXTkOwnsCursor_
-#undef TkMacOSXInitMenus_
-#undef TkMacOSXInitAppleEvents_
-#undef TkGenWMConfigureEvent_
-
#ifdef __cplusplus
}
#endif
@@ -216,4 +185,7 @@ extern const TkPlatStubs *tkPlatStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkGenWMConfigureEvent_
+#define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl
+
#endif /* _TKPLATDECLS */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index ece6281..addfd0e 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -25,7 +25,7 @@
typedef struct {
TkWindow *grabWinPtr; /* Window that defines the top of the grab
* tree in a global grab. */
- int lastState; /* Last known state flags. */
+ unsigned lastState; /* Last known state flags. */
XPoint lastPos; /* Last reported mouse position. */
TkWindow *lastWinPtr; /* Last reported mouse window. */
TkWindow *restrictWinPtr; /* Window to which all mouse events will be
@@ -224,8 +224,9 @@ Tk_UpdatePointer(
TkWindow *targetWinPtr;
XPoint pos;
XEvent event;
- int changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
- int type, b, mask;
+ unsigned changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
+ int type, b;
+ unsigned mask;
pos.x = x;
pos.y = y;
@@ -254,7 +255,7 @@ Tk_UpdatePointer(
*/
for (b = Button1; b <= Button9; b++) {
- mask = TkGetButtonMask(b);
+ mask = Tk_GetButtonMask(b);
if (changes & mask) {
if (state & mask) {
type = ButtonPress;
diff --git a/generic/tkScale.c b/generic/tkScale.c
index affea94..f1e2cec 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -357,7 +357,7 @@ Tk_ScaleObjCmd(
scalePtr->flags &= ~INVOKE_COMMAND;
- Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -659,13 +659,11 @@ ConfigureScale(
}
}
- /*
- * Several options need special processing, such as parsing the
- * orientation and creating GCs.
- */
+ /*
+ * The fromValue shall not be rounded to the resolution, but the
+ * toValue and tickInterval do.
+ */
- scalePtr->fromValue = TkRoundValueToResolution(scalePtr,
- scalePtr->fromValue);
scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue);
scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr,
scalePtr->tickInterval);
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 600c7d7..d646434 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -196,7 +196,7 @@ Tk_ScrollbarObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(scrollPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scrollPtr->tkwin));
return TCL_OK;
}
@@ -226,8 +226,8 @@ ScrollbarWidgetObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
- int result = TCL_OK, cmdIndex;
- TkSizeT length;
+ int result = TCL_OK, cmdIndex, length;
+ TkSizeT len;
static const char *const commandNames[] = {
"activate", "cget", "configure", "delta", "fraction",
"get", "identify", "set", NULL
@@ -271,13 +271,13 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "activate element");
goto error;
}
- c = TkGetStringFromObj(objv[2], &length)[0];
+ c = TkGetStringFromObj(objv[2], &len)[0];
oldActiveField = scrollPtr->activeField;
if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) {
scrollPtr->activeField = TOP_ARROW;
} else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) {
scrollPtr->activeField = BOTTOM_ARROW;
- } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", length) == 0)) {
+ } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", len) == 0)) {
scrollPtr->activeField = SLIDER;
} else {
scrollPtr->activeField = OUTSIDE;
@@ -310,7 +310,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_DELTA: {
- int xDelta, yDelta, pixels, length;
+ int xDelta, yDelta, pixels;
double fraction;
if (objc != 4) {
@@ -339,7 +339,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_FRACTION: {
- int x, y, pos, length;
+ int x, y, pos;
double fraction;
if (objc != 4) {
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 58c54f5..7cf62c2 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -28,7 +28,7 @@ typedef struct {
* chunk. */
char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
- char command[1]; /* Command to invoke. Actual space is
+ char command[TKFLEXARRAY]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
* be the last entry in the structure. */
} CommandInfo;
@@ -992,7 +992,7 @@ Tk_SelectionObjCmd(
if ((infoPtr != NULL)
&& (infoPtr->owner != winPtr->dispPtr->clipWindow)) {
- Tcl_SetObjResult(interp, TkNewWindowObj(infoPtr->owner));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(infoPtr->owner));
}
return TCL_OK;
}
@@ -1289,12 +1289,10 @@ static int
SelGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *dummy, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
- (void)dummy;
-
Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 2b2d3c5..04c51fa 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -234,7 +234,7 @@ SquareWidgetObjCmd(
int index;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 8b98928..f459fbd 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -24,6 +24,7 @@
#if defined(MAC_OSX_TK)
/* we could have used _TKMACINT */
#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#endif
/* TODO: These ought to come in some other way */
@@ -43,6 +44,7 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef TkWinGetPlatformId
#undef TkPutImage
#undef XPutImage
+#define TkMacOSXSetUpClippingRgn (void (*)(Drawable))(void *)doNothing
#if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# define Tk_TranslateWinEvent TkTranslateWinEvent
@@ -57,6 +59,12 @@ static int TkWinGetPlatformId(void) {
# define TkWinGetPlatformId 0
#endif
+static int
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+ return 0;
+}
#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
#define Tk_MainEx 0
@@ -70,12 +78,8 @@ static int TkWinGetPlatformId(void) {
#define Tk_PhotoPutBlock_Panic 0
#define Tk_PhotoPutZoomedBlock_Panic 0
#define Tk_PhotoSetSize_Panic 0
+#define Tk_CreateOldPhotoImageFormat 0
#else
-static void
-doNothing(void)
-{
- /* dummy implementation, no need to do anything */
-}
#define Tk_FreeXId ((void (*)(Display *, XID))(void *)doNothing)
#define Tk_FreeStyleFromObj ((void (*)(Tcl_Obj *))(void *)doNothing)
#define Tk_GetStyleFromObj getStyleFromObj
@@ -93,13 +97,9 @@ static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj)
#define TkWmCleanup_ TkWmCleanup
#define TkSendCleanup_ TkSendCleanup
#define TkpTestsendCmd_ TkpTestsendCmd
-#define Tk_MacOSXSetEmbedHandler_ Tk_MacOSXSetEmbedHandler
-#define Tk_MacOSXTurnOffMenus_ Tk_MacOSXTurnOffMenus
-#define Tk_MacOSXTkOwnsCursor_ Tk_MacOSXTkOwnsCursor
-#define TkMacOSXInitMenus_ TkMacOSXInitMenus
-#define TkMacOSXInitAppleEvents_ TkMacOSXInitAppleEvents
#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent
#define TkGenerateActivateEvents_ TkGenerateActivateEvents
+#define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable
#define Tk_CanvasTagsParseProc \
(int (*) (void *, Tcl_Interp *,Tk_Window, const char *, char *, \
int offset))(void *)TkCanvasTagsParseProc
@@ -107,6 +107,13 @@ static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj)
(const char *(*) (void *,Tk_Window, char *, int, \
Tcl_FreeProc **))(void *)TkCanvasTagsPrintProc
+#if !defined(MAC_OSX_TK) && defined(MAC_OSX_TCL)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+# define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing)
+# define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing)
+#endif
+
#ifdef _WIN32
int
@@ -494,7 +501,25 @@ static const TkIntStubs tkIntStubs = {
TkUnderlineAngledTextLayout, /* 182 */
TkIntersectAngledTextLayout, /* 183 */
TkDrawAngledChars, /* 184 */
- TkDebugPhotoStringMatchDef, /* 185 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 185 */
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ 0, /* 185 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpRedrawWidget, /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 186 */
+#endif /* UNIX */
+#if defined(_WIN32) /* WIN */
+ 0, /* 186 */
+#endif /* WIN */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpWillDrawWidget, /* 186 */
+#endif /* MACOSX */
+ TkDebugPhotoStringMatchDef, /* 187 */
};
static const TkIntPlatStubs tkIntPlatStubs = {
@@ -562,7 +587,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXButtonKeyState, /* 8 */
TkMacOSXClearMenubarActive, /* 9 */
TkMacOSXDispatchMenuEvent, /* 10 */
- TkMacOSXInstallCursor, /* 11 */
+ 0, /* 11 */
TkMacOSXHandleTearoffMenu, /* 12 */
0, /* 13 */
TkMacOSXDoHLEvent, /* 14 */
@@ -577,14 +602,14 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXMakeRealWindowExist, /* 23 */
TkMacOSXMakeStippleMap, /* 24 */
TkMacOSXMenuClick, /* 25 */
- TkMacOSXRegisterOffScreenWindow, /* 26 */
+ 0, /* 26 */
TkMacOSXResizable, /* 27 */
TkMacOSXSetHelpMenuItemCount, /* 28 */
TkMacOSXSetScrollbarGrow, /* 29 */
TkMacOSXSetUpClippingRgn, /* 30 */
TkMacOSXSetUpGraphicsPort, /* 31 */
TkMacOSXUpdateClipRgn, /* 32 */
- TkMacOSXUnregisterMacWindow, /* 33 */
+ 0, /* 33 */
TkMacOSXUseMenuID, /* 34 */
TkMacOSXVisableClipRgn, /* 35 */
TkMacOSXWinBounds, /* 36 */
@@ -600,7 +625,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkpIsWindowFloating, /* 46 */
TkpGetCapture, /* 47 */
0, /* 48 */
- TkGetTransientMaster, /* 49 */
+ TkMacOSXGetContainer, /* 49 */
TkGenerateButtonEvent, /* 50 */
TkGenWMDestroyEvent, /* 51 */
TkMacOSXSetDrawingEnabled, /* 52 */
@@ -929,7 +954,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XIconifyWindow, /* 103 */
XWithdrawWindow, /* 104 */
XListHosts, /* 105 */
- 0, /* 106 */
+ XSetClipRectangles, /* 106 */
XFlush, /* 107 */
XGrabServer, /* 108 */
XUngrabServer, /* 109 */
@@ -997,23 +1022,23 @@ static const TkPlatStubs tkPlatStubs = {
Tk_TranslateWinEvent, /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- Tk_MacOSXSetEmbedHandler, /* 0 */
- Tk_MacOSXTurnOffMenus, /* 1 */
- Tk_MacOSXTkOwnsCursor, /* 2 */
- TkMacOSXInitMenus, /* 3 */
+ 0, /* 0 */
+ 0, /* 1 */
+ 0, /* 2 */
+ 0, /* 3 */
TkMacOSXInitAppleEvents, /* 4 */
- TkGenWMConfigureEvent, /* 5 */
+ TkGenWMConfigureEvent_, /* 5 */
TkMacOSXInvalClipRgns, /* 6 */
- TkMacOSXGetDrawablePort, /* 7 */
+ 0, /* 7 */
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
- Tk_MacOSXSetEmbedHandler_, /* 11 */
- Tk_MacOSXTurnOffMenus_, /* 12 */
- Tk_MacOSXTkOwnsCursor_, /* 13 */
- TkMacOSXInitMenus_, /* 14 */
- TkMacOSXInitAppleEvents_, /* 15 */
- TkGenWMConfigureEvent_, /* 16 */
+ Tk_MacOSXGetTkWindow, /* 11 */
+ Tk_MacOSXGetCGContextForDrawable, /* 12 */
+ Tk_MacOSXGetNSWindowForDrawable, /* 13 */
+ 0, /* 14 */
+ 0, /* 15 */
+ TkGenWMConfigureEvent, /* 16 */
#endif /* AQUA */
};
@@ -1125,7 +1150,7 @@ const TkStubs tkStubs = {
Tk_GetFontMetrics, /* 95 */
Tk_GetGC, /* 96 */
Tk_GetImage, /* 97 */
- Tk_GetImageMasterData, /* 98 */
+ Tk_GetImageModelData, /* 98 */
Tk_GetItemTypes, /* 99 */
Tk_GetJoinStyle, /* 100 */
Tk_GetJustify, /* 101 */
@@ -1301,6 +1326,12 @@ const TkStubs tkStubs = {
Tk_Interp, /* 271 */
Tk_CreateOldImageType, /* 272 */
Tk_CreateOldPhotoImageFormat, /* 273 */
+ Tk_AlwaysShowSelection, /* 274 */
+ Tk_GetButtonMask, /* 275 */
+ Tk_GetDoublePixelsFromObj, /* 276 */
+ Tk_NewWindowObj, /* 277 */
+ Tk_SendVirtualEvent, /* 278 */
+ Tk_FontGetDescription, /* 279 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 9ec08ca..e845ad8 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -178,11 +178,10 @@ static const Tcl_ObjType styleObjType = {
void
TkStylePkgInit(
- TkMainInfo *mainPtr) /* The application being created. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being created. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)mainPtr;
if (tsdPtr->nbInit != 0) {
return;
@@ -234,7 +233,7 @@ TkStylePkgInit(
void
TkStylePkgFree(
- TkMainInfo *mainPtr) /* The application being deleted. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -242,7 +241,6 @@ TkStylePkgFree(
Tcl_HashEntry *entryPtr;
StyleEngine *enginePtr;
int i;
- (void)mainPtr;
tsdPtr->nbInit--;
if (tsdPtr->nbInit != 0) {
@@ -523,10 +521,8 @@ InitElement(
static void
FreeElement(
- Element *elementPtr) /* The element to free. */
+ TCL_UNUSED(Element *)) /* The element to free. */
{
- (void)elementPtr;
-
/* Nothing to do. */
}
@@ -1380,9 +1376,8 @@ Tk_GetStyle(
void
Tk_FreeStyle(
- Tk_Style style)
+ TCL_UNUSED(Tk_Style))
{
- (void)style;
}
/*
diff --git a/generic/tkTest.c b/generic/tkTest.c
index ae67f11..4347600 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define LOG_DISPLAY TkTestLogDisplay()
+#define LOG_DISPLAY(drawable) TkTestLogDisplay(drawable)
#else
-#define LOG_DISPLAY 1
+#define LOG_DISPLAY(drawable) 1
#endif
#ifdef __UNIX__
@@ -57,17 +57,17 @@ EXTERN int Tktest_Init(Tcl_Interp *interp);
#endif
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
Tcl_Interp *interp; /* Interpreter for application. */
int width, height; /* Dimensions of image. */
char *imageName; /* Name of image (malloc-ed). */
char *varName; /* Name of variable in which to log events for
* image (malloc-ed). */
-} TImageMaster;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -75,9 +75,11 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
+ Bool displayFailed; /* macOS display attempted out of drawRect. */
+ char buffer[200 + TCL_INTEGER_SPACE * 6]; /* message to log on display. */
} TImageInstance;
/*
@@ -86,7 +88,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -332,13 +334,11 @@ Tktest_Init(
static int
TestbitmapObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bitmap");
return TCL_ERROR;
@@ -367,13 +367,11 @@ TestbitmapObjCmd(
static int
TestborderObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(ClientData), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "border");
return TCL_ERROR;
@@ -402,13 +400,11 @@ TestborderObjCmd(
static int
TestcolorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
return TCL_ERROR;
@@ -437,13 +433,11 @@ TestcolorObjCmd(
static int
TestcursorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
return TCL_ERROR;
@@ -473,16 +467,12 @@ TestcursorObjCmd(
static int
TestdeleteappsObjCmd(
- ClientData clientData, /* Main window for application. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument strings. */
+ TCL_UNUSED(void *), /* Main window for application. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */
{
NewApp *nextPtr;
- (void)clientData;
- (void)interp;
- (void)objc;
- (void)objv;
while (newAppPtr != NULL) {
nextPtr = newAppPtr->nextPtr;
@@ -548,7 +538,7 @@ TestobjconfigObjCmd(
* "chain2" subcommand:
*/
- typedef struct ExtensionWidgetRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *base1ObjPtr;
Tcl_Obj *base2ObjPtr;
@@ -576,7 +566,7 @@ TestobjconfigObjCmd(
switch (index) {
case ALL_TYPES: {
- typedef struct TypesRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *booleanPtr;
Tcl_Obj *integerPtr;
@@ -649,7 +639,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
@@ -705,7 +694,6 @@ TestobjconfigObjCmd(
case CHAIN1: {
ExtensionWidgetRecord *recordPtr;
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -758,7 +746,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) baseSpecs, 0}
};
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -797,7 +784,7 @@ TestobjconfigObjCmd(
}
case CONFIG_ERROR: {
- typedef struct ErrorWidgetRecord {
+ typedef struct {
Tcl_Obj *intPtr;
} ErrorWidgetRecord;
ErrorWidgetRecord widgetRecord;
@@ -851,7 +838,7 @@ TestobjconfigObjCmd(
* objects.
*/
- typedef struct InternalRecord {
+ typedef struct {
TrivialCommandHeader header;
int boolean;
int integer;
@@ -927,7 +914,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
@@ -983,7 +969,7 @@ TestobjconfigObjCmd(
}
case NEW: {
- typedef struct FiveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *one;
Tcl_Obj *two;
@@ -1042,7 +1028,7 @@ TestobjconfigObjCmd(
break;
}
case NOT_ENOUGH_PARAMS: {
- typedef struct NotEnoughRecord {
+ typedef struct {
Tcl_Obj *fooObjPtr;
} NotEnoughRecord;
NotEnoughRecord record;
@@ -1072,17 +1058,17 @@ TestobjconfigObjCmd(
}
case TWO_WINDOWS: {
- typedef struct SlaveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *windowPtr;
- } SlaveRecord;
- SlaveRecord *recordPtr;
- static const Tk_OptionSpec slaveSpecs[] = {
+ } ContentRecord;
+ ContentRecord *recordPtr;
+ static const Tk_OptionSpec contentSpecs[] = {
{TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
- offsetof(SlaveRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
+ offsetof(ContentRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
- Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
+ tkwin = Tk_CreateWindowFromPath(interp,
(Tk_Window)clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
@@ -1090,10 +1076,10 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = (SlaveRecord *)ckalloc(sizeof(SlaveRecord));
+ recordPtr = (ContentRecord *)ckalloc(sizeof(ContentRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
- slaveSpecs);
+ contentSpecs);
tables[index] = recordPtr->header.optionTable;
recordPtr->header.tkwin = tkwin;
recordPtr->windowPtr = NULL;
@@ -1164,7 +1150,7 @@ TrivialConfigObjCmd(
Tk_SavedOptions saved;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -1392,16 +1378,15 @@ ImageCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument strings for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- TImageMaster *timPtr;
+ TImageModel *timPtr;
const char *varName;
int i;
- (void)typePtr;
varName = "log";
for (i = 0; i < objc; i += 2) {
@@ -1418,8 +1403,8 @@ ImageCreate(
varName = Tcl_GetString(objv[i+1]);
}
- timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
@@ -1429,7 +1414,7 @@ ImageCreate(
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -1457,7 +1442,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -1478,7 +1463,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -1510,9 +1495,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -1522,10 +1507,11 @@ ImageGet(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ instPtr->displayFailed = False;
return instPtr;
}
@@ -1560,47 +1546,56 @@ ImageDisplay(
* imageX and imageY. */
{
TImageInstance *instPtr = (TImageInstance *)clientData;
- char buffer[200 + TCL_INTEGER_SPACE * 6];
/*
* The purpose of the test image type is to track the calls to an image
- * display proc and record the parameters passed in each call. On macOS
- * a display proc must be run inside of the drawRect method of an NSView
- * in order for the graphics operations to have any effect. To deal with
+ * display proc and record the parameters passed in each call. On macOS a
+ * display proc must be run inside of the drawRect method of an NSView in
+ * order for the graphics operations to have any effect. To deal with
* this, whenever a display proc is called outside of any drawRect method
- * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
- * This will trigger a later call to the view's drawRect method which will
- * run the display proc a second time.
- *
- * This complicates testing, since it can result in more calls to the display
- * proc than are expected by the test. It can also result in an inconsistent
- * number of calls unless the test waits until the call to drawRect actually
- * occurs before validating its results.
- *
- * In an attempt to work around this, this display proc only logs those
- * calls which occur within a drawRect method. This means that tests must
- * be written so as to ensure that the drawRect method is run before
- * results are validated. In practice it usually suffices to run update
- * idletasks (to run the display proc the first time) followed by update
- * (to run the display proc in drawRect).
+ * it schedules a redraw of the NSView.
*
- * This also has the consequence that the image changed command will log
- * different results on Aqua than on other systems, because when the image
- * is redisplayed in the drawRect method the entire image will be drawn,
- * not just the changed portion. Tests must account for this.
+ * In an attempt to work around this, each image instance maintains it own
+ * copy of the log message which gets written on the first call to the
+ * display proc. This usually means that the message created on macOS is
+ * the same as that created on other platforms. However it is possible
+ * for the messages to differ for other reasons, namely differences in
+ * how damage regions are computed.
*/
- if (LOG_DISPLAY) {
- sprintf(buffer, "%s display %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
- NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ if (LOG_DISPLAY(drawable)) {
+ if (instPtr->displayFailed == False) {
+
+ /*
+ * Drawing is possible on the first call to DisplayImage.
+ * Log the message.
+ */
+
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName,
+ NULL, instPtr->buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ instPtr->displayFailed = False;
+ } else {
+
+ /*
+ * Drawing is not possible on the first call to DisplayImage.
+ * Save the message, but do not log it until the actual display.
+ */
+
+ if (instPtr->displayFailed == False) {
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ instPtr->displayFailed = True;
}
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
@@ -1637,8 +1632,8 @@ ImageFree(
TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -1664,11 +1659,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -1808,14 +1803,13 @@ TestmenubarObjCmd(
#if defined(_WIN32)
static int
TestmetricsObjCmd(
- ClientData dummy, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
- (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -2045,9 +2039,9 @@ TestwrapperObjCmd(
static int
CustomOptionSet(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
Tcl_Obj **value,
char *recordPtr,
TkSizeT internalOffset,
@@ -2056,8 +2050,6 @@ CustomOptionSet(
{
int objEmpty;
char *newStr, *string, *internalPtr;
- (void)dummy;
- (void)tkwin;
objEmpty = 0;
@@ -2108,14 +2100,11 @@ CustomOptionSet(
static Tcl_Obj *
CustomOptionGet(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr,
TkSizeT internalOffset)
{
- (void)dummy;
- (void)tkwin;
-
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
diff --git a/generic/tkText.c b/generic/tkText.c
index 2f5991b..ce4f976 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -279,10 +279,10 @@ typedef ClientData SearchAddLineProc(int lineNum,
typedef int SearchMatchProc(int lineNum,
struct SearchSpec *searchSpecPtr,
ClientData clientData, Tcl_Obj *theLine,
- int matchOffset, int matchLength);
+ TkSizeT matchOffset, TkSizeT matchLength);
typedef int SearchLineIndexProc(Tcl_Interp *interp,
Tcl_Obj *objPtr, struct SearchSpec *searchSpecPtr,
- int *linePosPtr, int *offsetPosPtr);
+ int *linePosPtr, TkSizeT *offsetPosPtr);
typedef struct SearchSpec {
int exact; /* Whether search is exact or regexp. */
@@ -298,10 +298,10 @@ typedef struct SearchSpec {
int all; /* Whether all or the first match should be
* reported. */
int startLine; /* First line to examine. */
- int startOffset; /* Index in first line to start at. */
+ TkSizeT startOffset; /* Index in first line to start at. */
int stopLine; /* Last line to examine, or -1 when we search
* all available text. */
- int stopOffset; /* Index to stop at, provided stopLine is not
+ TkSizeT stopOffset; /* Index to stop at, provided stopLine is not
* -1. */
int numLines; /* Total lines which are available. */
int backwards; /* Searching forwards or backwards. */
@@ -410,8 +410,8 @@ static void TextPushUndoAction(TkText *textPtr,
Tcl_Obj *undoString, int insert,
const TkTextIndex *index1Ptr,
const TkTextIndex *index2Ptr);
-static int TextSearchIndexInLine(const SearchSpec *searchSpecPtr,
- TkTextLine *linePtr, int byteIndex);
+static TkSizeT TextSearchIndexInLine(const SearchSpec *searchSpecPtr,
+ TkTextLine *linePtr, TkSizeT byteIndex);
static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static TkUndoProc TextUndoRedoCallback;
@@ -670,7 +670,7 @@ CreateWidget(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(textPtr->tkwin));
return TCL_OK;
}
@@ -701,7 +701,7 @@ TextWidgetObjCmd(
{
TkText *textPtr = (TkText *)clientData;
int result = TCL_OK;
- int index;
+ int idx;
static const char *const optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
@@ -724,12 +724,12 @@ TextWidgetObjCmd(
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ sizeof(char *), "option", 0, &idx) != TCL_OK) {
return TCL_ERROR;
}
textPtr->refCount++;
- switch ((enum options) index) {
+ switch ((enum options) idx) {
case TEXT_BBOX: {
int x, y, width, height;
const TkTextIndex *indexPtr;
@@ -1051,7 +1051,7 @@ TextWidgetObjCmd(
badOption:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\" must be -chars, -displaychars, "
+ "bad option \"%s\": must be -chars, -displaychars, "
"-displayindices, -displaylines, -indices, -lines, -update, "
"-xpixels, or -ypixels", Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_OPTION", NULL);
@@ -1161,7 +1161,7 @@ TextWidgetObjCmd(
* first to maintain index consistency.
*/
- qsort(indices, objc / 2,
+ qsort(indices, (size_t) objc / 2,
2 * sizeof(TkTextIndex), TextIndexSortProc);
lastStart = NULL;
@@ -1753,7 +1753,7 @@ TextPeerCmd(
while (tPtr != NULL) {
if (tPtr != textPtr) {
Tcl_ListObjAppendElement(NULL, peersObj,
- TkNewWindowObj(tPtr->tkwin));
+ Tk_NewWindowObj(tPtr->tkwin));
}
tPtr = tPtr->next;
}
@@ -3173,7 +3173,7 @@ DeleteIndexRange(
line2 = TkBTreeLinesTo(textPtr, index2.linePtr);
if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
TkTextTag **arrayPtr;
- int arraySize, i;
+ int arraySize;
TkTextIndex oldIndex2;
oldIndex2 = index2;
@@ -3557,7 +3557,7 @@ TkTextLostSelection(
{
TkText *textPtr = (TkText *)clientData;
- if (TkpAlwaysShowSelection(textPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) {
@@ -3615,7 +3615,7 @@ TkTextSelectionEvent(
* event generate $textWidget <<Selection>>
*/
- TkSendVirtualEvent(textPtr->tkwin, "Selection", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Selection", NULL);
}
/*
@@ -4015,7 +4015,7 @@ TextSearchGetLineIndex(
Tcl_Obj *objPtr, /* Contains a textual index like "1.2" */
SearchSpec *searchSpecPtr, /* Contains other search parameters. */
int *linePosPtr, /* For returning the line number. */
- int *offsetPosPtr) /* For returning the text offset in the
+ TkSizeT *offsetPosPtr) /* For returning the text offset in the
* line. */
{
const TkTextIndex *indexPtr;
@@ -4075,35 +4075,36 @@ TextSearchGetLineIndex(
*----------------------------------------------------------------------
*/
-static int
+static TkSizeT
TextSearchIndexInLine(
const SearchSpec *searchSpecPtr,
/* Search parameters. */
TkTextLine *linePtr, /* The line we're looking at. */
- int byteIndex) /* Index into the line. */
+ TkSizeT byteIndex) /* Index into the line. */
{
TkTextSegment *segPtr;
TkTextIndex curIndex;
- int index, leftToScan;
+ TkSizeT index;
+ int leftToScan;
TkText *textPtr = (TkText *)searchSpecPtr->clientData;
index = 0;
curIndex.tree = textPtr->sharedTextPtr->tree;
curIndex.linePtr = linePtr; curIndex.byteIndex = 0;
for (segPtr = linePtr->segPtr, leftToScan = byteIndex;
- leftToScan > 0;
+ leftToScan + 1 > 1;
curIndex.byteIndex += segPtr->size, segPtr = segPtr->nextPtr) {
if ((segPtr->typePtr == &tkTextCharType) &&
(searchSpecPtr->searchElide
|| !TkTextIsElided(textPtr, &curIndex, NULL))) {
- if (leftToScan < (int)segPtr->size) {
+ if (leftToScan + 1 < (int)segPtr->size + 1) {
if (searchSpecPtr->exact) {
index += leftToScan;
} else {
index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan);
}
} else if (searchSpecPtr->exact) {
- index += (int)segPtr->size;
+ index += segPtr->size;
} else {
index += Tcl_NumUtfChars(segPtr->body.chars, -1);
}
@@ -4267,9 +4268,9 @@ TextSearchFoundMatch(
Tcl_Obj *theLine, /* Text from current line, only accessed for
* exact searches, and is allowed to be NULL
* for regexp searches. */
- int matchOffset, /* Offset of found item in utf-8 bytes for
+ TkSizeT matchOffset, /* Offset of found item in utf-8 bytes for
* exact search, Unicode chars for regexp. */
- int matchLength) /* Length also in bytes/chars as per search
+ TkSizeT matchLength) /* Length also in bytes/chars as per search
* type. */
{
TkSizeT numChars;
@@ -4287,7 +4288,7 @@ TextSearchFoundMatch(
*/
if (searchSpecPtr->backwards ^
- (matchOffset >= searchSpecPtr->stopOffset)) {
+ (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4312,7 +4313,7 @@ TextSearchFoundMatch(
if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) {
if (searchSpecPtr->backwards ^
- ((matchOffset + numChars + 1) > (TkSizeT) searchSpecPtr->stopOffset + 1)) {
+ ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4538,8 +4539,8 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = (TkTextTabArray *)ckalloc(sizeof(TkTextTabArray)
- + (count - 1) * sizeof(TkTextTab));
+ tabArrayPtr = (TkTextTabArray *)ckalloc(offsetof(TkTextTabArray, tabs)
+ + count * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
lastStop = 0.0;
@@ -5059,11 +5060,10 @@ DumpSegment(
const char *value, /* Segment value. */
Tcl_Obj *command, /* Script callback. */
const TkTextIndex *index, /* index with line/byte position info. */
- int what) /* Look for TK_DUMP_INDEX bit. */
+ TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */
{
char buffer[TK_POS_CHARS];
Tcl_Obj *values[3], *tuple;
- (void)what;
TkTextPrintIndex(textPtr, index, buffer);
values[0] = Tcl_NewStringObj(key, -1);
@@ -5083,7 +5083,7 @@ DumpSegment(
Tcl_DStringAppend(&buf, Tcl_GetString(command), -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, Tcl_GetString(tuple), -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -5489,7 +5489,7 @@ GenerateModifiedEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "Modified", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Modified", NULL);
}
}
@@ -5519,7 +5519,7 @@ GenerateUndoStackEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
}
}
@@ -5927,7 +5927,7 @@ SearchCore(
* Only use the last part of the line.
*/
- if (searchSpecPtr->startOffset > firstOffset) {
+ if (searchSpecPtr->startOffset + 1 > (TkSizeT)firstOffset + 1) {
firstOffset = searchSpecPtr->startOffset;
}
if ((firstOffset >= lastOffset)
@@ -5939,7 +5939,7 @@ SearchCore(
* Use only the first part of the line.
*/
- if (searchSpecPtr->startOffset < lastOffset) {
+ if (searchSpecPtr->startOffset + 1 < (TkSizeT)lastOffset + 1) {
lastOffset = searchSpecPtr->startOffset;
}
}
@@ -6776,17 +6776,15 @@ SearchCore(
static Tcl_Obj *
GetLineStartEnd(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
TkSizeT internalOffset) /* Offset within *recordPtr containing the
* line value. */
{
TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset);
- (void)dummy;
- (void)tkwin;
- if ((internalOffset == TCL_INDEX_NONE) || (recordPtr == NULL)) {
+ if (linePtr == NULL) {
return Tcl_NewObj();
}
return Tcl_NewWideIntObj(1 + TkBTreeLinesTo(NULL, linePtr));
@@ -6813,9 +6811,9 @@ GetLineStartEnd(
static int
SetLineStartEnd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */
Tcl_Obj **value, /* Pointer to the pointer to the value object.
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
@@ -6828,8 +6826,6 @@ SetLineStartEnd(
TkTextLine *linePtr = NULL;
char *internalPtr;
TkText *textPtr = (TkText *) recordPtr;
- (void)dummy;
- (void)tkwin;
if (internalOffset != TCL_INDEX_NONE) {
internalPtr = (char *)recordPtr + internalOffset;
@@ -6874,14 +6870,11 @@ SetLineStartEnd(
static void
RestoreLineStartEnd(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
- (void)dummy;
- (void)tkwin;
-
*(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr;
}
@@ -6936,7 +6929,7 @@ ObjectIsEmpty(
int
TkpTesttextCmd(
- ClientData dummy, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -6947,7 +6940,6 @@ TkpTesttextCmd(
TkTextIndex index;
char buf[64];
Tcl_CmdInfo info;
- (void)dummy;
if (objc < 3) {
return TCL_ERROR;
diff --git a/generic/tkText.h b/generic/tkText.h
index 75cab59..e9e6303 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -168,7 +168,7 @@ typedef struct TkTextSegment {
TkSizeT size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
- char chars[2]; /* Characters that make up character info.
+ char chars[TKFLEXARRAY]; /* Characters that make up character info.
* Actual length varies to hold as many
* characters as needed.*/
TkTextToggle toggle; /* Information about tag toggle. */
@@ -489,7 +489,7 @@ typedef struct TkTextTabArray {
double tabIncrement; /* The accurate fractional pixel increment
* between interpolated tabs we have to create
* when we exceed numTabs. */
- TkTextTab tabs[1]; /* Array of tabs. The actual size will be
+ TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be
* numTabs. THIS FIELD MUST BE THE LAST IN THE
* STRUCTURE. */
} TkTextTabArray;
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index b95bd9b..8feb2a2 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -4169,7 +4169,7 @@ Rebalance(
Node *otherPtr;
Node *halfwayNodePtr = NULL; /* Initialization needed only */
TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
- int totalChildren, firstChildren, i;
+ int totalChildren, firstChildren;
/*
* Too few children for this node. If this is the root then, it's
@@ -4230,8 +4230,6 @@ Rebalance(
otherPtr->children.linePtr = NULL;
}
if (nodePtr->level == 0) {
- TkTextLine *linePtr;
-
for (linePtr = nodePtr->children.linePtr, i = 1;
linePtr->nextPtr != NULL;
linePtr = linePtr->nextPtr, i++) {
@@ -4246,8 +4244,6 @@ Rebalance(
i++;
}
} else {
- Node *childPtr;
-
for (childPtr = nodePtr->children.nodePtr, i = 1;
childPtr->nextPtr != NULL;
childPtr = childPtr->nextPtr, i++) {
@@ -4592,10 +4588,9 @@ static TkTextSegment *
CharCleanupProc(
TkTextSegment *segPtr, /* Pointer to first of two adjacent segments
* to join. */
- TkTextLine *linePtr) /* Line containing segments (not used). */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segments (not used). */
{
TkTextSegment *segPtr2, *newPtr;
- (void)linePtr;
segPtr2 = segPtr->nextPtr;
if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) {
@@ -4632,14 +4627,11 @@ CharCleanupProc(
static int
CharDeleteProc(
TkTextSegment *segPtr, /* Segment to delete. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
- (void)linePtr;
- (void)treeGone;
-
ckfree(segPtr);
return 0;
}
@@ -4664,10 +4656,8 @@ CharDeleteProc(
static void
CharCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
/*
* Make sure that the segment contains the number of characters indicated
* by its header, and that the last segment in a line ends in a newline.
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 8acf115..2454665 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -16,13 +16,17 @@
#include "tkInt.h"
#include "tkText.h"
-#ifdef MAC_OSX_TK
+#ifdef _WIN32
+#include "tkWinInt.h"
+#elif defined(__CYGWIN__)
+#include "tkUnixInt.h"
+#elif defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
-#define OK_TO_LOG (!TkpAppIsDrawing())
-#define FORCE_DISPLAY(winPtr) TkpDisplayWindow(winPtr)
-#else
+#define OK_TO_LOG (!TkpWillDrawWidget(textPtr->tkwin))
+#endif
+
+#if !defined(MAC_OSX_TK)
#define OK_TO_LOG 1
-#define FORCE_DISPLAY(winPtr)
#endif
/*
@@ -436,12 +440,12 @@ typedef struct TextDInfo {
* points to one of the following structures:
*/
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
- char chars[1]; /* UTF characters to display. Actual size will
- * be numBytes, not 1. THIS MUST BE THE LAST
+ char chars[TKFLEXARRAY]; /* UTF characters to display.
+ * Allocated as large as necessary. THIS MUST BE THE LAST
* FIELD IN THE STRUCTURE. */
} CharInfo;
@@ -548,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr,
static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
static void CharUndisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
@@ -1363,7 +1367,7 @@ LayoutDLine(
* expectations in the rest of the code, but we are able to skip
* elided portions of the line quickly.
*
- * If current chunk is elided and last chunk was too, coalese.
+ * If current chunk is elided and last chunk was too, coalesce.
*
* This also means that each logical line which is entirely elided
* still gets laid out into a DLine, but with zero height. This isn't
@@ -1504,7 +1508,7 @@ LayoutDLine(
}
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr != NULL) {
int expectedX =
((BaseCharInfo *) baseCharChunkPtr->clientData)->width
@@ -1646,7 +1650,7 @@ LayoutDLine(
chunkPtr = NULL;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
@@ -1705,7 +1709,7 @@ LayoutDLine(
segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
byteOffset, maxX, breakByteOffset, 0, wrapMode,
breakChunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
@@ -3151,7 +3155,7 @@ GenerateWidgetViewSyncEvent(
*/
if (!tkTextDebug) {
- FORCE_DISPLAY(textPtr->tkwin);
+ TkpRedrawWidget(textPtr->tkwin);
}
if (NewSyncState != OldSyncState) {
@@ -3160,8 +3164,8 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(NewSyncState));
+ Tk_SendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -4171,11 +4175,23 @@ DisplayText(
* warnings. */
Tcl_Interp *interp;
+
+ if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
+ /*
+ * The widget has been deleted. Don't do anything.
+ */
+
+ return;
+ }
+
#ifdef MAC_OSX_TK
/*
- * If drawing is disabled, all we need to do is
- * clear the REDRAW_PENDING flag.
+ * If the toplevel is being resized it would be dangerous to try redrawing
+ * the widget. But we can just clear the REDRAW_PENDING flag and return.
+ * This display proc will be called again after the widget has been
+ * reconfigured.
*/
+
TkWindow *winPtr = (TkWindow *)(textPtr->tkwin);
MacDrawable *macWin = winPtr->privatePtr;
if (macWin && (macWin->flags & TK_DO_NOT_DRAW)){
@@ -4184,14 +4200,6 @@ DisplayText(
}
#endif
- if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
- /*
- * The widget has been deleted. Don't do anything.
- */
-
- return;
- }
-
interp = textPtr->interp;
Tcl_Preserve(interp);
@@ -5268,7 +5276,7 @@ TkTextRelayoutWindow(
/*
* Invalidate cached scrollbar positions, so that scrollbars sliders will
- * be udpated.
+ * be updated.
*/
dInfoPtr->xScrollFirst = dInfoPtr->xScrollLast = -1;
@@ -6520,7 +6528,7 @@ GetXView(
Tcl_DStringAppend(&buf, textPtr->xScrollCmd, -1);
Tcl_DStringAppend(&buf, buf1, -1);
Tcl_DStringAppend(&buf, buf2, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -6805,7 +6813,7 @@ GetYView(
Tcl_DStringAppend(&buf, textPtr->yScrollCmd, -1);
Tcl_DStringAppend(&buf, buf1, -1);
Tcl_DStringAppend(&buf, buf2, -1);
- code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
@@ -7534,14 +7542,14 @@ TkTextDLineInfo(
static void
ElideBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
- int baseline, /* Location of line's baseline, in pixels
+ TCL_UNUSED(int), /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. X-coord is in same
@@ -7551,10 +7559,6 @@ ElideBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
- (void)textPtr;
- (void)index;
- (void)lineHeight;
- (void)baseline;
*xPtr = chunkPtr->x;
*yPtr = y;
@@ -7567,13 +7571,10 @@ ElideBboxProc(
static int
ElideMeasureProc(
- TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
- int x) /* X-coordinate, in same coordinate system as
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */
+ TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
- (void)chunkPtr;
- (void)x;
-
return 0 /*chunkPtr->numBytes - 1*/;
}
@@ -7600,8 +7601,8 @@ ElideMeasureProc(
int
TkTextCharLayoutProc(
- TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Index of first character to lay out
+ TCL_UNUSED(TkText *), /* Text widget being layed out. */
+ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out
* (corresponds to segPtr and offset). */
TkTextSegment *segPtr, /* Segment being layed out. */
TkSizeT byteOffset, /* Byte offset within segment of first
@@ -7627,14 +7628,12 @@ TkTextCharLayoutProc(
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
const char *line;
int lineOffset;
BaseCharInfo *bciPtr;
Tcl_DString *baseString;
#endif
- (void)textPtr;
- (void)indexPtr;
/*
* Figure out how many characters will fit in the space we've got. Include
@@ -7654,7 +7653,7 @@ TkTextCharLayoutProc(
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
bciPtr = ckalloc(sizeof(BaseCharInfo));
@@ -7691,7 +7690,7 @@ TkTextCharLayoutProc(
int ch;
int chLen = TkUtfToUniChar(p, &ch);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
&nextX);
@@ -7735,7 +7734,7 @@ TkTextCharLayoutProc(
bytesThatFit++;
}
if (bytesThatFit == 0) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
chunkPtr->clientData = NULL;
if (chunkPtr == baseCharChunkPtr) {
baseCharChunkPtr = NULL;
@@ -7768,7 +7767,7 @@ TkTextCharLayoutProc(
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, bytesThatFit);
@@ -7779,7 +7778,7 @@ TkTextCharLayoutProc(
ciPtr->numBytes--;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
* Final update for the current base chunk data.
*/
@@ -7884,7 +7883,7 @@ CharChunkMeasureChars(
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (chars == NULL) {
chars = ciPtr->chars;
charsLen = ciPtr->numBytes;
@@ -7957,18 +7956,18 @@ CharChunkMeasureChars(
static void
CharDisplayProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst. */
- int height, /* Total height of line. */
+ TCL_UNUSED(int), /* Total height of line. */
int baseline, /* Offset of baseline from y. */
Display *display, /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
@@ -7976,12 +7975,9 @@ CharDisplayProc(
TextStyle *stylePtr;
StyleValues *sValuePtr;
int numBytes, offsetBytes, offsetX;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
BaseCharInfo *bciPtr;
#endif /* TK_DRAW_IN_CONTEXT */
- (void)textPtr;
- (void)height;
- (void)screenY;
if ((x + chunkPtr->width) <= 0) {
/*
@@ -7991,12 +7987,12 @@ CharDisplayProc(
return;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
bciPtr = ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
-#elif TK_LAYOUT_WITH_BASE_CHUNKS
+#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (ciPtr->baseChunkPtr != chunkPtr) {
/*
* Without context drawing only base chunks display their foreground.
@@ -8037,7 +8033,7 @@ CharDisplayProc(
if (!sValuePtr->elide && (numBytes > offsetBytes)
&& (stylePtr->fgGC != NULL)) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
int xDisplacement = x - chunkPtr->x;
@@ -8122,14 +8118,13 @@ CharDisplayProc(
static void
CharUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
- (void)textPtr;
if (ciPtr) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (chunkPtr == ciPtr->baseChunkPtr) {
/*
* Basechunks are undisplayed first, when DLines are freed or
@@ -8212,13 +8207,13 @@ CharMeasureProc(
static void
CharBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
int byteIndex, /* Byte offset of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Height of line, in pixels. */
int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
@@ -8231,8 +8226,6 @@ CharBboxProc(
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
int maxX;
- (void)textPtr;
- (void)lineHeight;
maxX = chunkPtr->width + chunkPtr->x;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex,
@@ -8713,7 +8706,7 @@ MeasureChars(
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
start - source, special - start,
maxX >= 0 ? maxX - curX : -1, flags, &width);
@@ -8794,6 +8787,7 @@ TextGetScrollInfoObj(
VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS
};
int index;
+ double d;
if (Tcl_GetIndexFromObjStruct(interp, objv[2], subcommands,
sizeof(char *), "option", 0, &index) != TCL_OK) {
@@ -8821,20 +8815,31 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
return TKTEXT_SCROLL_PAGES;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
intPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ if (dblPtr) {
+ *dblPtr = (double)*intPtr;
+ }
return TKTEXT_SCROLL_PIXELS;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
return TKTEXT_SCROLL_UNITS;
}
}
@@ -8842,7 +8847,7 @@ TextGetScrollInfoObj(
return TKTEXT_SCROLL_ERROR;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
*----------------------------------------------------------------------
*
@@ -8873,7 +8878,7 @@ FinalizeBaseChunk(
const char *baseChars;
TkTextDispChunk *chunkPtr;
CharInfo *ciPtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int widthAdjust = 0;
int newwidth;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8887,7 +8892,7 @@ FinalizeBaseChunk(
for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
chunkPtr = chunkPtr->nextPtr) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
chunkPtr->x += widthAdjust;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8900,7 +8905,7 @@ FinalizeBaseChunk(
}
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
if (newwidth < chunkPtr->width) {
@@ -8914,7 +8919,7 @@ FinalizeBaseChunk(
ciPtr = addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
addChunkPtr->x += widthAdjust;
CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
&addChunkPtr->width);
@@ -9012,7 +9017,7 @@ IsSameFGStyle(
return 1;
}
-#if !TK_DRAW_IN_CONTEXT
+#if !defined(TK_DRAW_IN_CONTEXT)
if (
#ifdef MAC_OSX_TK
!TkMacOSXCompareColors(style1->fgGC->foreground,
@@ -9028,7 +9033,7 @@ IsSameFGStyle(
sv1 = style1->sValuePtr;
sv2 = style2->sValuePtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
#else
return sv1->tkfont == sv2->tkfont
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 9370b92..3657fa6 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -290,8 +290,12 @@ TkTextImageCmd(
(const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ if (resultObj == NULL) {
+ return TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
+ }
}
default:
Tcl_Panic("unexpected switch fallthrough");
@@ -447,14 +451,12 @@ EmbImageConfigure(
static int
EmbImageDeleteProc(
TkTextSegment *eiPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
Tcl_HashEntry *hPtr;
- (void)linePtr;
- (void)treeGone;
if (eiPtr->body.ei.image != NULL) {
hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable,
@@ -531,17 +533,17 @@ EmbImageCleanupProc(
static int
EmbImageLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
TkTextDispChunk *chunkPtr)
@@ -550,9 +552,6 @@ EmbImageLayoutProc(
* set by the caller. */
{
int width, height;
- (void)indexPtr;
- (void)maxChars;
- (void)wrapMode;
if (offset != 0) {
Tcl_Panic("Non-zero offset in EmbImageLayoutProc");
@@ -622,10 +621,8 @@ EmbImageLayoutProc(
static void
EmbImageCheckProc(
TkTextSegment *eiPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
if (eiPtr->nextPtr == NULL) {
Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
}
@@ -665,16 +662,14 @@ EmbImageDisplayProc(
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
int lineX, imageX, imageY, width, height;
Tk_Image image;
- (void)display;
- (void)screenY;
image = eiPtr->body.ei.image;
if (image == NULL) {
@@ -720,9 +715,9 @@ EmbImageDisplayProc(
static void
EmbImageBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -738,8 +733,6 @@ EmbImageBboxProc(
{
TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
Tk_Image image;
- (void)textPtr;
- (void)index;
image = eiPtr->body.ei.image;
if (image != NULL) {
@@ -830,21 +823,18 @@ TkTextImageIndex(
static void
EmbImageProc(
ClientData clientData, /* Pointer to widget record. */
- int x, int y, /* Upper left pixel (within image) that must
+ TCL_UNUSED(int), /* Upper left pixel (within image) that must
* be redisplayed. */
- int width, int height, /* Dimensions of area to redisplay (may be
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be
* <= 0). */
- int imgWidth, int imgHeight)/* New dimensions of image. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),/* New dimensions of image. */
+ TCL_UNUSED(int))
{
TkTextSegment *eiPtr = (TkTextSegment *)clientData;
TkTextIndex index;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
- (void)imgWidth;
- (void)imgHeight;
index.tree = eiPtr->body.ei.sharedTextPtr->tree;
index.linePtr = eiPtr->body.ei.linePtr;
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 87816f4..d9bf299 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -62,7 +62,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_INDEXEPOCH(objPtr) \
(PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
- ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr))
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch))
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index fe5a892..141e2e5 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -501,16 +501,12 @@ TkTextMarkNameToIndex(
static int
MarkDeleteProc(
- TkTextSegment *segPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
- (void)segPtr;
- (void)linePtr;
- (void)treeGone;
-
return 1;
}
@@ -562,29 +558,22 @@ MarkCleanupProc(
static int
MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- TkSizeT offset, /* Offset within segPtr corresponding to
+ TCL_UNUSED(TkSizeT), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX, /* Chunk must not occupy pixels at this
+ TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
- int noCharsYet, /* Non-zero means no characters have been
+ TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Not used. */
+ TCL_UNUSED(TkWrapMode), /* Not used. */
TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
{
- (void)indexPtr;
- (void)offset;
- (void)maxX;
- (void)maxChars;
- (void)noCharsYet;
- (void)wrapMode;
-
if (segPtr != textPtr->insertMarkPtr) {
return -1;
}
@@ -628,15 +617,15 @@ MarkLayoutProc(
void
TkTextInsertDisplayProc(
TkText *textPtr, /* The current text widget. */
- TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst (x-position is in the chunk itself). */
int height, /* Total height of line. */
- int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(int), /* Offset of baseline from y. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -650,9 +639,6 @@ TkTextInsertDisplayProc(
int halfWidth = textPtr->insertWidth/2;
int rightSideWidth;
int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0;
- (void)chunkPtr;
- (void)baseline;
- (void)display;
if (textPtr->insertCursorType) {
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
@@ -735,12 +721,9 @@ TkTextInsertDisplayProc(
static void
InsertUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
+ TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */
{
- (void)textPtr;
- (void)chunkPtr;
-
return;
}
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 0846e1e..2bd321d 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -357,7 +357,7 @@ TkTextTagCmd(
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv,
- "tagName ?-option? ?value? ?-option value ...?");
+ "tagName ?-option value ...?");
return TCL_ERROR;
}
tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
@@ -1440,7 +1440,7 @@ ChangeTagPriority(
void
TkTextBindProc(
- ClientData clientData, /* Pointer to canvas structure. */
+ ClientData clientData, /* Pointer to text widget structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkText *textPtr = (TkText *)clientData;
@@ -1459,7 +1459,7 @@ TkTextBindProc(
} else if (eventPtr->type == ButtonRelease) {
unsigned long mask;
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
if ((eventPtr->xbutton.state & ALL_BUTTONS) == mask) {
textPtr->flags &= ~BUTTON_DOWN;
repick = 1;
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 5b33a84..89f7f2a 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -22,13 +22,13 @@
static void EmbWinRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void EmbWinLostSlaveProc(ClientData clientData,
+static void EmbWinLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr textGeomType = {
"text", /* name */
EmbWinRequestProc, /* requestProc */
- EmbWinLostSlaveProc, /* lostSlaveProc */
+ EmbWinLostContentProc, /* lostContentProc */
};
/*
@@ -160,7 +160,6 @@ TkTextWindowCmd(
switch ((enum windOptions) optionIndex) {
case WIND_CGET: {
TkTextIndex index;
- TkTextSegment *ewPtr;
Tcl_Obj *objPtr;
TkTextEmbWindowClient *client;
@@ -201,7 +200,6 @@ TkTextWindowCmd(
}
case WIND_CONFIGURE: {
TkTextIndex index;
- TkTextSegment *ewPtr;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?");
@@ -443,7 +441,7 @@ EmbWinConfigure(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s in %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -459,7 +457,7 @@ EmbWinConfigure(
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (ewPtr->body.ew.tkwin == textPtr->tkwin)) {
- goto badMaster;
+ goto badContainer;
}
if (client == NULL) {
@@ -576,12 +574,11 @@ EmbWinStructureProc(
static void
EmbWinRequestProc(
ClientData clientData, /* Pointer to record for window item. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
- (void)tkwin;
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
@@ -594,9 +591,9 @@ EmbWinRequestProc(
/*
*--------------------------------------------------------------
*
- * EmbWinLostSlaveProc --
+ * EmbWinLostContentProc --
*
- * This function is invoked by the Tk geometry manager when a slave
+ * This function is invoked by the Tk geometry manager when a content
* window managed by a text widget is claimed away by another geometry
* manager.
*
@@ -611,7 +608,7 @@ EmbWinRequestProc(
*/
static void
-EmbWinLostSlaveProc(
+EmbWinLostContentProc(
ClientData clientData, /* Pointer to record describing window item. */
Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
@@ -739,15 +736,13 @@ TkTextWinFreeClient(
static int
EmbWinDeleteProc(
TkTextSegment *ewPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
TkTextEmbWindowClient *client;
client = ewPtr->body.ew.clients;
- (void)linePtr;
- (void)treeGone;
while (client != NULL) {
TkTextEmbWindowClient *next = client->next;
@@ -820,17 +815,17 @@ EmbWinCleanupProc(
static int
EmbWinLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
TkTextDispChunk *chunkPtr)
@@ -840,9 +835,6 @@ EmbWinLayoutProc(
{
int width, height;
TkTextEmbWindowClient *client;
- (void)indexPtr;
- (void)maxChars;
- (void)wrapMode;
if (offset != 0) {
Tcl_Panic("Non-zero offset in EmbWinLayoutProc");
@@ -939,12 +931,12 @@ EmbWinLayoutProc(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- goto badMaster;
+ goto badContainer;
}
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s relative to %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -1055,10 +1047,8 @@ EmbWinLayoutProc(
static void
EmbWinCheckProc(
TkTextSegment *ewPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
if (ewPtr->nextPtr == NULL) {
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
}
@@ -1092,13 +1082,13 @@ TkTextEmbWinDisplayProc(
int x, /* X-position in dst at which to draw this
* chunk (differs from the x-position in the
* chunk because of scrolling). */
- int y, /* Top of rectangular bounding box for line:
+ TCL_UNUSED(int), /* Top of rectangular bounding box for line:
* tells where to draw this chunk in dst
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing (unused). */
- Drawable dst, /* Pixmap or window in which to draw
+ TCL_UNUSED(Display *), /* Display to use for drawing (unused). */
+ TCL_UNUSED(Drawable), /* Pixmap or window in which to draw
* (unused). */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -1107,9 +1097,6 @@ TkTextEmbWinDisplayProc(
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
- (void)y;
- (void)display;
- (void)dst;
if (client == NULL) {
return;
@@ -1236,7 +1223,7 @@ static void
EmbWinBboxProc(
TkText *textPtr, /* Information about text widget. */
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -1253,7 +1240,6 @@ EmbWinBboxProc(
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
- (void)index;
if (client == NULL) {
tkwin = NULL;
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index f7b839a..9377cf2 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -664,6 +664,7 @@ Tk_GetScrollInfo(
return TK_SCROLL_MOVETO;
} else if ((c == 's')
&& (strncmp(argv[2], "scroll", length) == 0)) {
+ double d;
if (argc != 5) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"wrong # args: should be \"%s %s %s\"",
@@ -671,9 +672,10 @@ Tk_GetScrollInfo(
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TK_SCROLL_ERROR;
}
- if (Tcl_GetInt(interp, argv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDouble(interp, argv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
length = strlen(argv[4]);
c = argv[4][0];
if ((c == 'p') && (strncmp(argv[4], "pages", length) == 0)) {
@@ -744,13 +746,18 @@ Tk_GetScrollInfoObj(
}
return TK_SCROLL_MOVETO;
} else if (ArgPfxEq("scroll")) {
+ double d;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "scroll number pages|units");
return TK_SCROLL_ERROR;
}
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d >= 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
arg = TkGetStringFromObj(objv[4], &length);
if (ArgPfxEq("pages")) {
@@ -1130,7 +1137,7 @@ TkMakeEnsemble(
dictObj = Tcl_NewObj();
for (i = 0; map[i].name != NULL ; ++i) {
- Tcl_Obj *nameObj, *fqdnObj;
+ Tcl_Obj *fqdnObj;
nameObj = Tcl_NewStringObj(map[i].name, -1);
fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
@@ -1157,7 +1164,7 @@ TkMakeEnsemble(
/*
*----------------------------------------------------------------------
*
- * TkSendVirtualEvent --
+ * Tk_SendVirtualEvent --
*
* Send a virtual event notification to the specified target window.
* Equivalent to:
@@ -1170,7 +1177,7 @@ TkMakeEnsemble(
*/
void
-TkSendVirtualEvent(
+Tk_SendVirtualEvent(
Tk_Window target,
const char *eventName,
Tcl_Obj *detail)
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index b3527e6..eb8e928 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -13,7 +13,7 @@
*/
#include "tkInt.h"
-
+#include "tkPort.h"
#ifdef _WIN32
#include "tkWinInt.h"
#elif !defined(MAC_OSX_TK)
@@ -239,8 +239,6 @@ TkCloseDisplay(
{
TkClipCleanup(dispPtr);
- TkpCancelWarp(dispPtr);
-
if (dispPtr->name != NULL) {
ckfree(dispPtr->name);
}
@@ -1644,7 +1642,7 @@ Tk_MapWindow(
event.xmap.event = winPtr->window;
event.xmap.window = winPtr->window;
event.xmap.override_redirect = winPtr->atts.override_redirect;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
/*
@@ -1806,7 +1804,7 @@ Tk_UnmapWindow(
event.xunmap.event = winPtr->window;
event.xunmap.window = winPtr->window;
event.xunmap.from_configure = False;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
}
@@ -2694,7 +2692,7 @@ Tk_GetNumMainWindows(void)
/*
*----------------------------------------------------------------------
*
- * TkpAlwaysShowSelection --
+ * Tk_AlwaysShowSelection --
*
* Indicates whether text/entry widgets should always display
* their selection, regardless of window focus.
@@ -2712,7 +2710,7 @@ Tk_GetNumMainWindows(void)
*/
int
-TkpAlwaysShowSelection(
+Tk_AlwaysShowSelection(
Tk_Window tkwin) /* Window whose application is to be
* checked. */
{
@@ -2961,7 +2959,7 @@ Tk_SafeInit(
* Current risks:
*
* - No CPU time limit, no memory allocation limits, no color limits.
- * CPU time limits can be imposed by an unsafe master interpreter.
+ * CPU time limits can be imposed by an unsafe parent interpreter.
*
* The actual code called is the same as Tk_Init but Tcl_IsSafe() is
* checked at several places to differentiate the two initialisations.
@@ -3081,24 +3079,24 @@ Initialize(
if (Tcl_IsSafe(interp)) {
/*
* Get the clearance to start Tk and the "argv" parameters from the
- * master.
+ * parent.
*/
/*
- * Step 1 : find the master and construct the interp name (could be a
+ * Step 1 : find the parent and construct the interp name (could be a
* function if new APIs were ok). We could also construct the path
* while walking, but there is no API to get the name of an interp
* either.
*/
- Tcl_Interp *master = interp;
+ Tcl_Interp *parent = interp;
- while (Tcl_IsSafe(master)) {
- master = Tcl_GetMaster(master);
- if (master == NULL) {
+ while (Tcl_IsSafe(parent)) {
+ parent = Tcl_GetParent(parent);
+ if (parent == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no controlling master interpreter", -1));
- Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_MASTER", NULL);
+ "no controlling parent interpreter", -1));
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL);
return TCL_ERROR;
}
}
@@ -3107,35 +3105,35 @@ Initialize(
* Construct the name (rewalk...)
*/
- code = Tcl_GetInterpPath(master, interp);
+ code = Tcl_GetInterpPath(parent, interp);
if (code != TCL_OK) {
Tcl_Panic("Tcl_GetInterpPath broken!");
}
/*
- * Build the command to eval in trusted master.
+ * Build the command to eval in trusted parent.
*/
cmd = Tcl_NewListObj(2, NULL);
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("::safe::TkInit", -1));
- Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(master));
+ Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent));
/*
- * Step 2 : Eval in the master. The argument is the *reversed* interp
- * path of the slave.
+ * Step 2 : Eval in the parent. The argument is the *reversed* interp
+ * path of the child.
*/
Tcl_IncrRefCount(cmd);
- code = Tcl_EvalObjEx(master, cmd, 0);
+ code = Tcl_EvalObjEx(parent, cmd, 0);
Tcl_DecrRefCount(cmd);
- Tcl_TransferResult(master, code, interp);
+ Tcl_TransferResult(parent, code, interp);
if (code != TCL_OK) {
return code;
}
/*
- * Use the master's result as argv. Note: We don't use the Obj
+ * Use the parent's result as argv. Note: We don't use the Obj
* interfaces to avoid dealing with cross interp refcounting and
* changing the code below.
*/
@@ -3339,7 +3337,7 @@ Initialize(
tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
}\n\
}\n\
-tkInit", -1, 0);
+tkInit", -1, TCL_EVAL_GLOBAL);
}
if (code == TCL_OK) {
/*
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
index dcd342c..fc48af9 100644
--- a/generic/ttk/ttkBlink.c
+++ b/generic/ttk/ttkBlink.c
@@ -59,7 +59,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp)
cm->owner = 0;
cm->onTime = DEF_CURSOR_ON_TIME;
cm->offTime = DEF_CURSOR_OFF_TIME;
- Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm);
+ Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm);
}
return cm;
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index 9712c66..e179a7f 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -85,7 +85,7 @@ static const Tk_OptionSpec BaseOptionSpecs[] =
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE,
@@ -823,7 +823,7 @@ static const Tk_OptionSpec MenubuttonOptionSpecs[] =
"", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
"below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE,
- 0,(ClientData)directionStrings,GEOMETRY_CHANGED},
+ 0, (void *)directionStrings, GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
@@ -858,7 +858,7 @@ TTK_BEGIN_LAYOUT(MenubuttonLayout)
TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH,
TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
- TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index dae54e4..035cabc 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -955,7 +955,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
TTK_LAYOUT("TCombobox",
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND,
+ TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
index ec35480..be7d74b 100644
--- a/generic/ttk/ttkClassicTheme.c
+++ b/generic/ttk/ttkClassicTheme.c
@@ -453,7 +453,7 @@ TTK_LAYOUT("TMenubutton",
TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
- TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", 0)))))
/* "classic" entry, includes highlight border */
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index e07617c..946b7fc 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -181,7 +181,7 @@ static const Tk_OptionSpec EntryOptionSpecs[] = {
TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
"none", TCL_INDEX_NONE, offsetof(Entry, entry.validate),
- 0, (ClientData) validateStrings, 0},
+ 0, (void *) validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
NULL, TCL_INDEX_NONE, offsetof(Entry, entry.validateCmd),
TK_OPTION_NULL_OK, 0, 0},
@@ -403,7 +403,7 @@ static void EntryOwnSelection(Entry *entryPtr)
&& (!Tcl_IsSafe(entryPtr->core.interp))
&& !(entryPtr->core.flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection,
- (ClientData) entryPtr);
+ entryPtr);
entryPtr->core.flags |= GOT_SELECTION;
}
}
@@ -600,9 +600,9 @@ EntryValidateChange(
VMODE vmode = entryPtr->entry.validate;
int code, change_ok;
- if ( (entryPtr->entry.validateCmd == NULL)
+ if ((entryPtr->entry.validateCmd == NULL)
|| (entryPtr->core.flags & VALIDATING)
- || !EntryNeedsValidation(vmode, reason) )
+ || !EntryNeedsValidation(vmode, reason))
{
return TCL_OK;
}
@@ -958,7 +958,7 @@ EntryInitialize(Tcl_Interp *dummy, void *recordPtr)
Tk_CreateEventHandler(
entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr);
Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING,
- EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ EntryFetchSelection, entryPtr, XA_STRING);
TtkBlinkCursor(&entryPtr->core);
entryPtr->entry.string = (char *)ckalloc(1);
@@ -1312,21 +1312,32 @@ static void EntryDisplay(void *clientData, Drawable d)
}
/* Use placeholder text width */
leftIndex = 0;
- TkGetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex);
+ (void)TkGetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex);
} else {
foregroundObj = es.foregroundObj;
}
gc = EntryGetGC(entryPtr, foregroundObj, clipRegion);
- Tk_DrawTextLayout(
- Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
- entryPtr->entry.layoutX, entryPtr->entry.layoutY,
- leftIndex, rightIndex);
- XSetClipMask(Tk_Display(tkwin), gc, None);
- Tk_FreeGC(Tk_Display(tkwin), gc);
-
- /* Overwrite the selected portion (if any) in the -selectforeground color:
- */
if (showSelection) {
+
+ /* Draw the selected and unselected portions separately.
+ */
+ if (leftIndex < selFirst) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, selFirst);
+ }
+ if (selLast < rightIndex) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ selLast, rightIndex);
+ }
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+
+ /* Draw the selected portion in the -selectforeground color:
+ */
gc = EntryGetGC(entryPtr, es.selForegroundObj, clipRegion);
Tk_DrawTextLayout(
Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
@@ -1334,6 +1345,16 @@ static void EntryDisplay(void *clientData, Drawable d)
selFirst, selLast);
XSetClipMask(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
+ } else {
+
+ /* Draw the entire visible text
+ */
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, rightIndex);
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
}
/* Drop the region. Note that we have to manually remove the reference to
@@ -1372,7 +1393,7 @@ EntryIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) {
- if (idx + 1 > entryPtr->entry.numChars + 1) {
+ if ((idx != TCL_INDEX_NONE) && (idx > entryPtr->entry.numChars)) {
idx = entryPtr->entry.numChars;
}
*indexPtr = idx;
@@ -1556,7 +1577,7 @@ EntryIndexCommand(
if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -1629,7 +1650,7 @@ static int EntrySelectionRangeCommand(
Tcl_WrongNumArgs(interp, 3, objv, "start end");
return TCL_ERROR;
}
- if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
+ if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
|| EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) {
return TCL_ERROR;
}
@@ -1690,7 +1711,7 @@ static int EntryValidateCommand(
if (code == TCL_ERROR)
return code;
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(code == TCL_OK));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK));
return TCL_OK;
}
@@ -1828,7 +1849,7 @@ static int ComboboxCurrentCommand(
if (objc == 2) {
/* Check if currentIndex still valid:
*/
- if ( currentIndex == TCL_INDEX_NONE
+ if (currentIndex == TCL_INDEX_NONE
|| currentIndex >= (TkSizeT)nValues
|| strcmp(currentValue,Tcl_GetString(values[currentIndex]))
)
@@ -1846,7 +1867,7 @@ static int ComboboxCurrentCommand(
}
}
cbPtr->combobox.currentIndex = currentIndex;
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)currentIndex));
+ Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex));
return TCL_OK;
} else if (objc == 3) {
TkSizeT idx;
@@ -2088,7 +2109,7 @@ TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(ComboboxLayout)
TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_PACK_LEFT|TTK_EXPAND,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 7c43bce..d7563a0 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -88,12 +88,12 @@ static Ttk_Padding FrameMargins(Frame *framePtr)
* The frame doesn't request a size of its own by default,
* but it does have an internal border. See also <<NOTE-SIZE>>
*/
-static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr)
+static int FrameSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
Frame *framePtr = (Frame *)recordPtr;
- (void)widthPtr;
- (void)heightPtr;
-
Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr));
return 0;
}
@@ -340,15 +340,16 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr)
* Like the frame, this doesn't request a size of its own
* but it does have internal padding and a minimum size.
*/
-static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr)
+static int LabelframeSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
Labelframe *lframePtr = (Labelframe *)recordPtr;
WidgetCore *corePtr = &lframePtr->core;
Ttk_Padding margins;
LabelframeStyle style;
int labelWidth, labelHeight;
- (void)widthPtr;
- (void)heightPtr;
LabelframeStyleOptions(lframePtr, &style);
@@ -460,7 +461,7 @@ static void LabelframeDoLayout(void *recordPtr)
Ttk_PlaceLayout(
lframePtr->label.labelLayout, corePtr->state, labelParcel);
}
- /* labelWidget placed in LabelframePlaceSlaves GM hook */
+ /* labelWidget placed in LabelframePlaceContent GM hook */
lframePtr->label.labelParcel = labelParcel;
}
@@ -476,29 +477,28 @@ static void LabelframeDisplay(void *recordPtr, Drawable d)
/* +++ Labelframe geometry manager hooks.
*/
-/* LabelframePlaceSlaves --
+/* LabelframePlaceContent --
* Sets the position and size of the labelwidget.
*/
-static void LabelframePlaceSlaves(void *recordPtr)
+static void LabelframePlaceContent(void *recordPtr)
{
Labelframe *lframe = (Labelframe *)recordPtr;
- if (Ttk_NumberSlaves(lframe->label.mgr) == 1) {
+ if (Ttk_NumberContent(lframe->label.mgr) == 1) {
Ttk_Box b;
LabelframeDoLayout(recordPtr);
b = lframe->label.labelParcel;
- /* ASSERT: slave #0 is lframe->label.labelWidget */
- Ttk_PlaceSlave(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
+ /* ASSERT: content #0 is lframe->label.labelWidget */
+ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
}
}
-static int LabelRequest(void *managerData, TkSizeT index, int width, int height)
+static int LabelRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(TkSizeT),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- (void)managerData;
- (void)index;
- (void)width;
- (void)height;
-
return 1;
}
@@ -507,20 +507,21 @@ static int LabelRequest(void *managerData, TkSizeT index, int width, int height)
*
* <<NOTE-LABELREMOVED>>:
* This routine is also called when the widget voluntarily forgets
- * the slave in LabelframeConfigure.
+ * the window in LabelframeConfigure.
*/
-static void LabelRemoved(void *managerData, TkSizeT slaveIndex)
+static void LabelRemoved(
+ void *managerData,
+ TCL_UNUSED(TkSizeT))
{
Labelframe *lframe = (Labelframe *)managerData;
- (void)slaveIndex;
lframe->label.labelWidget = 0;
}
static Ttk_ManagerSpec LabelframeManagerSpec = {
- { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc },
LabelframeSize,
- LabelframePlaceSlaves,
+ LabelframePlaceContent,
LabelRequest,
LabelRemoved
};
@@ -528,10 +529,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = {
/* LabelframeInitialize --
* Initialization hook.
*/
-static void LabelframeInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void LabelframeInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Labelframe *lframe = (Labelframe *)recordPtr;
- (void)dummy;
lframe->label.mgr = Ttk_CreateManager(
&LabelframeManagerSpec, lframe, lframe->core.tkwin);
@@ -603,15 +605,15 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
/* Update -labelwidget changes, if any:
*/
if (mask & LABELWIDGET_CHANGED) {
- if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) {
- Ttk_ForgetSlave(lframePtr->label.mgr, 0);
+ if (Ttk_NumberContent(lframePtr->label.mgr) == 1) {
+ Ttk_ForgetContent(lframePtr->label.mgr, 0);
/* Restore labelWidget field (see <<NOTE-LABELREMOVED>>)
*/
lframePtr->label.labelWidget = labelWidget;
}
if (labelWidget) {
- Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL);
+ Ttk_InsertContent(lframePtr->label.mgr, 0, labelWidget, NULL);
RaiseLabelWidget(lframePtr);
}
}
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index e6ad27d..d745b74 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -263,7 +263,7 @@ typedef struct { /* ClientData for image elements */
Ttk_Padding border; /* Fixed border region */
Ttk_Padding padding; /* Internal padding */
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
Ttk_ResourceCache cache; /* Resource cache for images */
Ttk_StateMap imageMap; /* State-based lookup table for images */
#endif
@@ -273,7 +273,7 @@ static void FreeImageData(void *clientData)
{
ImageData *imageData = (ImageData *)clientData;
if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); }
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
#endif
ckfree(clientData);
@@ -311,7 +311,7 @@ static void ImageElementDraw(
Ttk_Box src, dst;
(void)elementRecord;
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) {
Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
if (imageObj) {
@@ -383,7 +383,7 @@ Ttk_CreateImageElement(
imageData->minWidth = imageData->minHeight = -1;
imageData->sticky = TTK_FILL_BOTH;
imageData->border = imageData->padding = Ttk_UniformPadding(0);
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
imageData->cache = Ttk_GetResourceCache(interp);
imageData->imageMap = 0;
#endif
@@ -398,7 +398,7 @@ Ttk_CreateImageElement(
goto error;
}
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (!strcmp("-map", Tcl_GetString(objv[i]))) {
imageData->imageMap = objv[i+1];
Tcl_IncrRefCount(imageData->imageMap);
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index f14a2db..4a43253 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -124,28 +124,6 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
# undef SETFLAGS
}
-/* TtkSendVirtualEvent --
- * Send a virtual event notification to the specified target window.
- * Equivalent to "event generate $tgtWindow <<$eventName>>"
- *
- * Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent,
- * so this routine does not reenter the interpreter.
- */
-void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName)
-{
- union {XEvent general; XVirtualEvent virt;} event;
-
- memset(&event, 0, sizeof(event));
- event.general.xany.type = VirtualEvent;
- event.general.xany.serial = NextRequest(Tk_Display(tgtWin));
- event.general.xany.send_event = False;
- event.general.xany.window = Tk_WindowId(tgtWin);
- event.general.xany.display = Tk_Display(tgtWin);
- event.virt.name = Tk_GetUid(eventName);
-
- Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
-}
-
/* TtkEnumerateOptions, TtkGetOptionValue --
* Common factors for data accessor commands.
*/
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index a4dbf96..6d254e8 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -569,13 +569,15 @@ static void LabelCleanup(LabelElement *c)
}
static void LabelElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
LabelElement *label = (LabelElement *)elementRecord;
int textReqWidth = 0;
- (void)dummy;
- (void)paddingPtr;
LabelSetup(label, tkwin, 0);
@@ -628,12 +630,15 @@ static void DrawCompound(
}
static void LabelElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, Ttk_State state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
LabelElement *l = (LabelElement *)elementRecord;
Tk_Anchor anchor = TK_ANCHOR_CENTER;
- (void)dummy;
LabelSetup(l, tkwin, state);
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 5e8c69c..a971d23 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -36,10 +36,10 @@ Ttk_NewBoxObj(Ttk_Box box)
{
Tcl_Obj *result[4];
- result[0] = Tcl_NewIntObj(box.x);
- result[1] = Tcl_NewIntObj(box.y);
- result[2] = Tcl_NewIntObj(box.width);
- result[3] = Tcl_NewIntObj(box.height);
+ result[0] = Tcl_NewWideIntObj(box.x);
+ result[1] = Tcl_NewWideIntObj(box.y);
+ result[2] = Tcl_NewWideIntObj(box.width);
+ result[3] = Tcl_NewWideIntObj(box.height);
return Tcl_NewListObj(4, result);
}
@@ -809,7 +809,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
APPENDSTR("-sticky");
APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK));
- /* @@@ Check again: are these necessary? */
+ /* @@@ Check again: are these necessary? Can't see any effect! */
if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); }
if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); }
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 2795570..0d41d21 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -10,59 +10,59 @@
/*------------------------------------------------------------------------
* +++ The Geometry Propagation Dance.
*
- * When a slave window requests a new size or some other parameter changes,
- * the manager recomputes the required size for the master window and calls
+ * When a content window requests a new size or some other parameter changes,
+ * the manager recomputes the required size for the container window and calls
* Tk_GeometryRequest(). This is scheduled as an idle handler so multiple
* updates can be processed as a single batch.
*
- * If all goes well, the master's manager will process the request
- * (and so on up the chain to the toplevel window), and the master
+ * If all goes well, the container's manager will process the request
+ * (and so on up the chain to the toplevel window), and the container
* window will eventually receive a <Configure> event. At this point
- * it recomputes the size and position of all slaves and places them.
+ * it recomputes the size and position of all content windows and places them.
*
- * If all does not go well, however, the master's request may be ignored
+ * If all does not go well, however, the container's request may be ignored
* (typically because the top-level window has a fixed, user-specified size).
* Tk doesn't provide any notification when this happens; to account for this,
* we also schedule an idle handler to call the layout procedure
* after making a geometry request.
*
- * +++ Slave removal <<NOTE-LOSTSLAVE>>.
+ * +++ Content window removal <<NOTE-LOSTCONTENT>>.
*
- * There are three conditions under which a slave is removed:
+ * There are three conditions under which a content window is removed:
*
* (1) Another GM claims control
* (2) Manager voluntarily relinquishes control
- * (3) Slave is destroyed
+ * (3) Content window is destroyed
*
- * In case (1), Tk calls the manager's lostSlaveProc.
- * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0);
- * in this case Tk does _not_ call the LostSlaveProc (documented behavior).
+ * In case (1), Tk calls the manager's lostContentProc.
+ * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0);
+ * in this case Tk does _not_ call the lostContentProc (documented behavior).
* Tk doesn't handle case (3) either; to account for that we
- * register an event handler on the slave widget to track <Destroy> events.
+ * register an event handler on the content window to track <Destroy> events.
*/
/* ++ Data structures.
*/
typedef struct
{
- Tk_Window slaveWindow;
+ Tk_Window window;
Ttk_Manager *manager;
- void *slaveData;
+ void *data;
unsigned flags;
-} Ttk_Slave;
+} Ttk_Content;
-/* slave->flags bits:
+/* content->flags bits:
*/
-#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */
+#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */
struct TtkManager_
{
Ttk_ManagerSpec *managerSpec;
void *managerData;
- Tk_Window masterWindow;
+ Tk_Window window;
unsigned flags;
- TkSizeT nSlaves;
- Ttk_Slave **slaves;
+ TkSizeT nContent;
+ Ttk_Content **content;
};
/* manager->flags bits:
@@ -87,7 +87,7 @@ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags)
}
/* ++ RecomputeSize --
- * Recomputes the required size of the master window,
+ * Recomputes the required size of the container window,
* makes geometry request.
*/
static void RecomputeSize(Ttk_Manager *mgr)
@@ -95,18 +95,18 @@ static void RecomputeSize(Ttk_Manager *mgr)
int width = 1, height = 1;
if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) {
- Tk_GeometryRequest(mgr->masterWindow, width, height);
+ Tk_GeometryRequest(mgr->window, width, height);
ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED);
}
mgr->flags &= ~MGR_RESIZE_REQUIRED;
}
/* ++ RecomputeLayout --
- * Recompute geometry of all slaves.
+ * Recompute geometry of all content windows.
*/
static void RecomputeLayout(Ttk_Manager *mgr)
{
- mgr->managerSpec->PlaceSlaves(mgr->managerData);
+ mgr->managerSpec->PlaceContent(mgr->managerData);
mgr->flags &= ~MGR_RELAYOUT_REQUIRED;
}
@@ -135,8 +135,8 @@ static void ManagerIdleProc(ClientData clientData)
*/
/* ++ ManagerEventHandler --
- * Recompute slave layout when master widget is resized.
- * Keep the slave's map state in sync with the master's.
+ * Recompute content layout when container widget is resized.
+ * Keep the content's map state in sync with the container's.
*/
static const int ManagerEventMask = StructureNotifyMask;
static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
@@ -150,56 +150,55 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
RecomputeLayout(mgr);
break;
case MapNotify:
- for (i = 0; i < mgr->nSlaves; ++i) {
- Ttk_Slave *slave = mgr->slaves[i];
- if (slave->flags & SLAVE_MAPPED) {
- Tk_MapWindow(slave->slaveWindow);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ if (content->flags & CONTENT_MAPPED) {
+ Tk_MapWindow(content->window);
}
}
break;
case UnmapNotify:
- for (i = 0; i < mgr->nSlaves; ++i) {
- Ttk_Slave *slave = mgr->slaves[i];
- Tk_UnmapWindow(slave->slaveWindow);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ Tk_UnmapWindow(content->window);
}
break;
}
}
-/* ++ SlaveEventHandler --
- * Notifies manager when a slave is destroyed
- * (see <<NOTE-LOSTSLAVE>>).
+/* ++ ContentLostEventHandler --
+ * Notifies manager when a content window is destroyed
+ * (see <<NOTE-LOSTCONTENT>>).
*/
-static const unsigned SlaveEventMask = StructureNotifyMask;
-static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr)
+static void ContentLostEventHandler(void *clientData, XEvent *eventPtr)
{
- Ttk_Slave *slave = (Ttk_Slave *)clientData;
+ Ttk_Content *content = (Ttk_Content *)clientData;
if (eventPtr->type == DestroyNotify) {
- slave->manager->managerSpec->tkGeomMgr.lostSlaveProc(
- slave->manager, slave->slaveWindow);
+ content->manager->managerSpec->tkGeomMgr.lostContentProc(
+ content->manager, content->window);
}
}
/*------------------------------------------------------------------------
- * +++ Slave initialization and cleanup.
+ * +++ Content initialization and cleanup.
*/
-static Ttk_Slave *NewSlave(
- Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData)
+static Ttk_Content *NewContent(
+ Ttk_Manager *mgr, Tk_Window window, void *data)
{
- Ttk_Slave *slave = (Ttk_Slave *)ckalloc(sizeof(*slave));
+ Ttk_Content *content = (Ttk_Content *)ckalloc(sizeof(Ttk_Content));
- slave->slaveWindow = slaveWindow;
- slave->manager = mgr;
- slave->flags = 0;
- slave->slaveData = slaveData;
+ content->window = window;
+ content->manager = mgr;
+ content->flags = 0;
+ content->data = data;
- return slave;
+ return content;
}
-static void DeleteSlave(Ttk_Slave *slave)
+static void DeleteContent(Ttk_Content *content)
{
- ckfree(slave);
+ ckfree(content);
}
/*------------------------------------------------------------------------
@@ -207,19 +206,19 @@ static void DeleteSlave(Ttk_Slave *slave)
*/
Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow)
+ Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr));
mgr->managerSpec = managerSpec;
mgr->managerData = managerData;
- mgr->masterWindow = masterWindow;
- mgr->nSlaves = 0;
- mgr->slaves = NULL;
+ mgr->window = window;
+ mgr->nContent = 0;
+ mgr->content = NULL;
mgr->flags = 0;
Tk_CreateEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
return mgr;
}
@@ -227,13 +226,13 @@ Ttk_Manager *Ttk_CreateManager(
void Ttk_DeleteManager(Ttk_Manager *mgr)
{
Tk_DeleteEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
- while (mgr->nSlaves > 0) {
- Ttk_ForgetSlave(mgr, mgr->nSlaves - 1);
+ while (mgr->nContent > 0) {
+ Ttk_ForgetContent(mgr, mgr->nContent - 1);
}
- if (mgr->slaves) {
- ckfree(mgr->slaves);
+ if (mgr->content) {
+ ckfree(mgr->content);
}
Tcl_CancelIdleCall(ManagerIdleProc, mgr);
@@ -242,67 +241,67 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
}
/*------------------------------------------------------------------------
- * +++ Slave management.
+ * +++ Content window management.
*/
-/* ++ InsertSlave --
- * Adds slave to the list of managed windows.
+/* ++ InsertContent --
+ * Adds content to the list of managed windows.
*/
-static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, TkSizeT index)
+static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, TkSizeT index)
{
- TkSizeT endIndex = mgr->nSlaves++;
- mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
+ TkSizeT endIndex = mgr->nContent++;
+ mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *));
while (endIndex > index) {
- mgr->slaves[endIndex] = mgr->slaves[endIndex - 1];
+ mgr->content[endIndex] = mgr->content[endIndex - 1];
--endIndex;
}
- mgr->slaves[index] = slave;
+ mgr->content[index] = content;
- Tk_ManageGeometry(slave->slaveWindow,
- &mgr->managerSpec->tkGeomMgr, (ClientData)mgr);
+ Tk_ManageGeometry(content->window,
+ &mgr->managerSpec->tkGeomMgr, mgr);
- Tk_CreateEventHandler(slave->slaveWindow,
- SlaveEventMask, SlaveEventHandler, (ClientData)slave);
+ Tk_CreateEventHandler(content->window,
+ StructureNotifyMask, ContentLostEventHandler, content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
-/* RemoveSlave --
- * Unmanage and delete the slave.
+/* RemoveContent --
+ * Unmanage and delete the content window.
*
* NOTES/ASSUMPTIONS:
*
* [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this
- * routine is called from the slave's DestroyNotify event handler.
+ * routine is called from the content window's DestroyNotify event handler.
*/
-static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index)
+static void RemoveContent(Ttk_Manager *mgr, TkSizeT index)
{
- Ttk_Slave *slave = mgr->slaves[index];
+ Ttk_Content *content = mgr->content[index];
TkSizeT i;
/* Notify manager:
*/
- mgr->managerSpec->SlaveRemoved(mgr->managerData, index);
+ mgr->managerSpec->ContentRemoved(mgr->managerData, index);
/* Remove from array:
*/
- --mgr->nSlaves;
- for (i = index ; i < mgr->nSlaves; ++i) {
- mgr->slaves[i] = mgr->slaves[i+1];
+ --mgr->nContent;
+ for (i = index ; i < mgr->nContent; ++i) {
+ mgr->content[i] = mgr->content[i+1];
}
/* Clean up:
*/
Tk_DeleteEventHandler(
- slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave);
+ content->window, StructureNotifyMask, ContentLostEventHandler, content);
/* Note [1] */
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ Tk_UnmapWindow(content->window);
- DeleteSlave(slave);
+ DeleteContent(content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
@@ -311,83 +310,83 @@ static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index)
* +++ Tk_GeomMgr hooks.
*/
-void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow);
- int reqWidth = Tk_ReqWidth(slaveWindow);
- int reqHeight= Tk_ReqHeight(slaveWindow);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
+ int reqWidth = Tk_ReqWidth(window);
+ int reqHeight= Tk_ReqHeight(window);
- if (mgr->managerSpec->SlaveRequest(
- mgr->managerData, slaveIndex, reqWidth, reqHeight))
+ if (mgr->managerSpec->ContentRequest(
+ mgr->managerData, index, reqWidth, reqHeight))
{
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
}
-void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int index = Ttk_SlaveIndex(mgr, slaveWindow);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
/* ASSERT: index >= 0 */
- RemoveSlave(mgr, index);
+ RemoveContent(mgr, index);
}
/*------------------------------------------------------------------------
* +++ Public API.
*/
-/* ++ Ttk_InsertSlave --
- * Add a new slave window at the specified index.
+/* ++ Ttk_InsertContent --
+ * Add a new content window at the specified index.
*/
-void Ttk_InsertSlave(
- Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *slaveData)
+void Ttk_InsertContent(
+ Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *data)
{
- Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData);
- InsertSlave(mgr, slave, index);
+ Ttk_Content *content = NewContent(mgr, tkwin, data);
+ InsertContent(mgr, content, index);
}
-/* ++ Ttk_ForgetSlave --
- * Unmanage the specified slave.
+/* ++ Ttk_ForgetContent --
+ * Unmanage the specified content window.
*/
-void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index)
{
- Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow;
- RemoveSlave(mgr, slaveIndex);
- Tk_ManageGeometry(slaveWindow, NULL, 0);
+ Tk_Window window = mgr->content[index]->window;
+ RemoveContent(mgr, index);
+ Tk_ManageGeometry(window, NULL, 0);
}
-/* ++ Ttk_PlaceSlave --
- * Set the position and size of the specified slave window.
+/* ++ Ttk_PlaceContent --
+ * Set the position and size of the specified content window.
*
* NOTES:
* Contrary to documentation, Tk_MaintainGeometry doesn't always
- * map the slave.
+ * map the content window.
*/
-void Ttk_PlaceSlave(
- Ttk_Manager *mgr, TkSizeT slaveIndex, int x, int y, int width, int height)
+void Ttk_PlaceContent(
+ Ttk_Manager *mgr, TkSizeT index, int x, int y, int width, int height)
{
- Ttk_Slave *slave = mgr->slaves[slaveIndex];
- Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height);
- slave->flags |= SLAVE_MAPPED;
- if (Tk_IsMapped(mgr->masterWindow)) {
- Tk_MapWindow(slave->slaveWindow);
+ Ttk_Content *content = mgr->content[index];
+ Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height);
+ content->flags |= CONTENT_MAPPED;
+ if (Tk_IsMapped(mgr->window)) {
+ Tk_MapWindow(content->window);
}
}
-/* ++ Ttk_UnmapSlave --
- * Unmap the specified slave, but leave it managed.
+/* ++ Ttk_UnmapContent --
+ * Unmap the specified content window, but leave it managed.
*/
-void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void Ttk_UnmapContent(Ttk_Manager *mgr, TkSizeT index)
{
- Ttk_Slave *slave = mgr->slaves[slaveIndex];
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- slave->flags &= ~SLAVE_MAPPED;
+ Ttk_Content *content = mgr->content[index];
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ content->flags &= ~CONTENT_MAPPED;
/* Contrary to documentation, Tk_UnmaintainGeometry doesn't always
- * unmap the slave:
+ * unmap the content window:
*/
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmapWindow(content->window);
}
/* LayoutChanged, SizeChanged --
@@ -405,130 +404,128 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
/* +++ Accessors.
*/
-TkSizeT Ttk_NumberSlaves(Ttk_Manager *mgr)
+TkSizeT Ttk_NumberContent(Ttk_Manager *mgr)
{
- return mgr->nSlaves;
+ return mgr->nContent;
}
-void *Ttk_SlaveData(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void *Ttk_ContentData(Ttk_Manager *mgr, TkSizeT index)
{
- return mgr->slaves[slaveIndex]->slaveData;
+ return mgr->content[index]->data;
}
-Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT slaveIndex)
+Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index)
{
- return mgr->slaves[slaveIndex]->slaveWindow;
+ return mgr->content[index]->window;
}
/*------------------------------------------------------------------------
* +++ Utility routines.
*/
-/* ++ Ttk_SlaveIndex --
- * Returns the index of specified slave window, -1 if not found.
+/* ++ Ttk_ContentIndex --
+ * Returns the index of specified content window, -1 if not found.
*/
-TkSizeT Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
+TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
{
TkSizeT index;
- for (index = 0; index < mgr->nSlaves; ++index)
- if (mgr->slaves[index]->slaveWindow == slaveWindow)
+ for (index = 0; index < mgr->nContent; ++index)
+ if (mgr->content[index]->window == window)
return index;
return TCL_INDEX_NONE;
}
-/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) --
- * Return the index of the slave specified by objPtr.
- * Slaves may be specified as an integer index or
+/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) --
+ * Return the index of the content window specified by objPtr.
+ * Content windows may be specified as an integer index or
* as the name of the managed window.
*
* Returns:
* Standard Tcl completion code. Leaves an error message in case of error.
*/
-int Ttk_GetSlaveIndexFromObj(
+int Ttk_GetContentIndexFromObj(
Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, TkSizeT *indexPtr)
{
const char *string = Tcl_GetString(objPtr);
- TkSizeT slaveIndex = 0;
- TkSizeT idx;
+ TkSizeT index = 0;
Tk_Window tkwin;
/* Try interpreting as an integer first:
*/
- if (TkGetIntForIndex(objPtr, mgr->nSlaves - 1, 1, &idx) == TCL_OK) {
- slaveIndex = idx;
- if ((size_t)slaveIndex > (size_t)mgr->nSlaves) {
+ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) {
+ if (index + 1 > mgr->nContent + 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %d out of bounds", (int)slaveIndex));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
+ "Managed window index %d out of bounds", (int)index));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
- /* Try interpreting as a slave window name;
+ /* Try interpreting as a window name;
*/
if ((*string == '.') &&
- (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) {
- slaveIndex = Ttk_SlaveIndex(mgr, tkwin);
- if (slaveIndex == TCL_INDEX_NONE) {
+ (tkwin = Tk_NameToWindow(interp, string, mgr->window))) {
+ index = Ttk_ContentIndex(mgr, tkwin);
+ if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s is not managed by %s", string,
- Tk_PathName(mgr->masterWindow)));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL);
+ Tk_PathName(mgr->window)));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "MANAGER", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid slave specification %s", string));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL);
+ "Invalid managed window specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "SPEC", NULL);
return TCL_ERROR;
}
-/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) --
- * Change slave order.
+/* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) --
+ * Change content window order.
*/
-void Ttk_ReorderSlave(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
+void Ttk_ReorderContent(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
{
- Ttk_Slave *moved = mgr->slaves[fromIndex];
+ Ttk_Content *moved = mgr->content[fromIndex];
/* Shuffle down: */
while (fromIndex > toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex - 1];
--fromIndex;
}
/* Or, shuffle up: */
while (fromIndex < toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex + 1];
++fromIndex;
}
/* ASSERT: fromIndex == toIndex */
- mgr->slaves[fromIndex] = moved;
+ mgr->content[fromIndex] = moved;
- /* Schedule a relayout. In general, rearranging slaves
+ /* Schedule a relayout. In general, rearranging content
* may also change the size:
*/
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
-/* ++ Ttk_Maintainable(interp, slave, master) --
- * Utility routine. Verifies that 'master' may be used to maintain
- * the geometry of 'slave' via Tk_MaintainGeometry:
+/* ++ Ttk_Maintainable(interp, window, container) --
+ * Utility routine. Verifies that 'container' may be used to maintain
+ * the geometry of 'window' via Tk_MaintainGeometry:
*
- * + 'master' is either 'slave's parent -OR-
- * + 'master is a descendant of 'slave's parent.
- * + 'slave' is not a toplevel window
- * + 'slave' belongs to the same toplevel as 'master'
+ * + 'container' is either 'window's parent -OR-
+ * + 'container is a descendant of 'window's parent.
+ * + 'window' is not a toplevel window
+ * + 'window' belongs to the same toplevel as 'container'
*
* Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
*/
-int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
+int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container)
{
- Tk_Window ancestor = master, parent = Tk_Parent(slave);
+ Tk_Window ancestor = container, parent = Tk_Parent(window);
- if (Tk_IsTopLevel(slave) || slave == master) {
+ if (Tk_IsTopLevel(window) || window == container) {
goto badWindow;
}
@@ -542,8 +539,8 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
return 1;
badWindow:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s",
- Tk_PathName(slave), Tk_PathName(master)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as content of %s",
+ Tk_PathName(window), Tk_PathName(container)));
Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL);
return 0;
}
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
index 838e261..07b0ade 100644
--- a/generic/ttk/ttkManager.h
+++ b/generic/ttk/ttkManager.h
@@ -14,54 +14,60 @@ typedef struct TtkManager_ Ttk_Manager;
/*
* Geometry manager specification record:
*
- * RequestedSize computes the requested size of the master window.
+ * RequestedSize computes the requested size of the container window.
*
- * PlaceSlaves sets the position and size of all managed slaves
- * by calling Ttk_PlaceSlave().
+ * PlaceContent sets the position and size of all managed content windows
+ * by calling Ttk_PlaceContent().
*
- * SlaveRemoved() is called immediately before a slave is removed.
- * NB: the associated slave window may have been destroyed when this
+ * ContentRemoved() is called immediately before a content window is removed.
+ * NB: the associated content window may have been destroyed when this
* routine is called.
*
- * SlaveRequest() is called when a slave requests a size change.
+ * ContentRequest() is called when a content window requests a size change.
* It should return 1 if the request should propagate, 0 otherwise.
*/
typedef struct { /* Manager hooks */
Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */
int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr);
- void (*PlaceSlaves)(void *managerData);
- int (*SlaveRequest)(void *managerData, TkSizeT slaveIndex, int w, int h);
- void (*SlaveRemoved)(void *managerData, TkSizeT slaveIndex);
+ void (*PlaceContent)(void *managerData);
+ int (*ContentRequest)(void *managerData, TkSizeT index, int w, int h);
+ void (*ContentRemoved)(void *managerData, TkSizeT index);
} Ttk_ManagerSpec;
/*
* Default implementations for Tk_GeomMgr hooks:
*/
-MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave);
-MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave);
+#define Ttk_LostSlaveProc Ttk_LostContentProc
+MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window);
+MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window);
/*
* Public API:
*/
MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow);
+ Ttk_ManagerSpec *, void *managerData, Tk_Window window);
MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
-MODULE_SCOPE void Ttk_InsertSlave(
- Ttk_Manager *, TkSizeT position, Tk_Window, void *slaveData);
+#define Ttk_InsertSlave Ttk_InsertContent
+MODULE_SCOPE void Ttk_InsertContent(
+ Ttk_Manager *, TkSizeT position, Tk_Window, void *clientData);
-MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, TkSizeT slaveIndex);
+#define Ttk_ForgetSlave Ttk_ForgetContent
+MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, TkSizeT index);
-MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
- /* Rearrange slave positions */
+#define Ttk_ReorderSlave Ttk_ReorderContent
+MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
+ /* Rearrange content window positions */
-MODULE_SCOPE void Ttk_PlaceSlave(
- Ttk_Manager *, TkSizeT slaveIndex, int x, int y, int width, int height);
- /* Position and map the slave */
+#define Ttk_PlaceSlave Ttk_PlaceContent
+MODULE_SCOPE void Ttk_PlaceContent(
+ Ttk_Manager *, TkSizeT index, int x, int y, int width, int height);
+ /* Position and map the content window */
-MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, TkSizeT slaveIndex);
- /* Unmap the slave */
+#define Ttk_UnmapSlave Ttk_UnmapContent
+MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, TkSizeT index);
+ /* Unmap the content window */
MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
@@ -69,24 +75,29 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
/* Utilities:
*/
-MODULE_SCOPE TkSizeT Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
- /* Returns: index in slave array of specified window, -1 if not found */
+#define Ttk_SlaveIndex Ttk_ContentIndex
+MODULE_SCOPE TkSizeT Ttk_ContentIndex(Ttk_Manager *, Tk_Window);
+ /* Returns: index in content array of specified window, TCL_INDEX_NONE if not found */
-MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
+#define Ttk_GetSlaveIndexFromObj Ttk_GetContentIndexFromObj
+MODULE_SCOPE int Ttk_GetContentIndexFromObj(
Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, TkSizeT *indexPtr);
/* Accessor functions:
*/
-MODULE_SCOPE TkSizeT Ttk_NumberSlaves(Ttk_Manager *);
- /* Returns: number of managed slaves */
+#define Ttk_NumberSlaves Ttk_NumberContent
+MODULE_SCOPE TkSizeT Ttk_NumberContent(Ttk_Manager *);
+ /* Returns: number of managed content windows */
-MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, TkSizeT slaveIndex);
- /* Returns: client data associated with slave */
+#define Ttk_SlaveData Ttk_ContentData
+MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, TkSizeT index);
+ /* Returns: client data associated with content window */
-MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, TkSizeT slaveIndex);
- /* Returns: slave window */
+#define Ttk_SlaveWindow Ttk_ContentWindow
+MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, TkSizeT index);
+ /* Returns: content window */
-MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master);
- /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */
+MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container);
+ /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */
#endif /* _TTKMANAGER */
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 7ad46a4..26eab6b 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -53,31 +53,31 @@ typedef struct
* relevant to the tab.
*
* PaneOptionSpecs includes additional options for child window placement
- * and is used to configure the slave.
+ * and is used to configure the pane.
*/
static const Tk_OptionSpec TabOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-state", "", "",
"normal", TCL_INDEX_NONE, offsetof(Tab,state),
- 0,(ClientData)TabStateStrings,0 },
+ 0, (void *)TabStateStrings, 0 },
{TK_OPTION_STRING, "-text", "text", "Text", "",
- offsetof(Tab,textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,textObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
- offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline", "-1",
- offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
};
static const Tk_OptionSpec PaneOptionSpecs[] =
{
{TK_OPTION_STRING, "-padding", "padding", "Padding", "0",
- offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew",
- offsetof(Tab,stickyObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,stickyObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
WIDGET_INHERIT_OPTIONS(TabOptionSpecs)
};
@@ -98,7 +98,7 @@ typedef struct
TkSizeT activeIndex; /* index of currently active tab */
Ttk_Layout tabLayout; /* Sublayout for tabs */
- Ttk_Box clientArea; /* Where to pack slave widgets */
+ Ttk_Box clientArea; /* Where to pack content windows */
} NotebookPart;
typedef struct
@@ -187,13 +187,13 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
* +++ Tab management.
*/
-static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow)
+static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window)
{
Tk_OptionTable optionTable = nb->notebook.paneOptionTable;
Tab *record = (Tab *)ckalloc(sizeof(Tab));
memset(record, 0, sizeof(Tab));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
@@ -209,7 +209,7 @@ static void DestroyTab(Notebook *nb, Tab *tab)
}
static int ConfigureTab(
- Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Sticky sticky = tab->sticky;
@@ -218,7 +218,7 @@ static int ConfigureTab(
int mask = 0;
if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -230,7 +230,7 @@ static int ConfigureTab(
{
goto error;
}
- if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding)
+ if (Ttk_GetPaddingFromObj(interp, window, tab->paddingObj, &padding)
!= TCL_OK)
{
goto error;
@@ -257,8 +257,8 @@ error:
static TkSizeT IdentifyTab(Notebook *nb, int x, int y)
{
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index);
+ for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index);
if ( tab->state != TAB_STATE_HIDDEN
&& Ttk_BoxContains(tab->parcel, x,y))
{
@@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, TkSizeT index)
static Ttk_State TabState(Notebook *nb, TkSizeT index)
{
Ttk_State state = nb->core.state;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
TkSizeT i = 0;
if (index == nb->notebook.currentIndex) {
@@ -302,8 +302,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
if (index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -312,8 +312,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
}
break;
}
- for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -322,7 +322,7 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
}
break;
}
- if (tab->state == TAB_STATE_DISABLED) {
+ if (itab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;
}
@@ -353,8 +353,8 @@ static void TabrowSize(
int tabrowWidth = 0, tabrowHeight = 0;
TkSizeT i;
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb,i);
Ttk_RebindSublayout(tabLayout, tab);
@@ -378,7 +378,7 @@ static void TabrowSize(
*
* Total height is tab height + client area height + pane internal padding
* Total width is max(client width, tab width) + pane internal padding
- * Client area size determined by max size of slaves,
+ * Client area size determined by max size of content windows,
* overridden by -width and/or -height if nonzero.
*/
@@ -395,18 +395,18 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
NotebookStyleOptions(nb, &nbstyle);
- /* Compute max requested size of all slaves:
+ /* Compute max requested size of all content windows:
*/
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i);
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
- int slaveWidth
- = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding);
- int slaveHeight
- = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
+ int width
+ = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding);
+ int height
+ = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding);
- clientWidth = MAX(clientWidth, slaveWidth);
- clientHeight = MAX(clientHeight, slaveHeight);
+ clientWidth = MAX(clientWidth, width);
+ clientHeight = MAX(clientHeight, height);
}
/* Client width/height overridable by widget options:
@@ -461,7 +461,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
static void SqueezeTabs(
Notebook *nb, int needed, int available)
{
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
if (nTabs > 0) {
int difference = available - needed;
@@ -470,7 +470,7 @@ static void SqueezeTabs(
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,i);
double ad = slack + tab->width * delta;
tab->width += (int)ad;
slack = ad - (int)ad;
@@ -485,11 +485,11 @@ static void PlaceTabs(
Notebook *nb, Ttk_Box tabrowBox, Ttk_PositionSpec tabPlacement)
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb, i);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -513,7 +513,7 @@ static void PlaceTabs(
* Computes notebook layout and places tabs.
*
* Side effects:
- * Sets clientArea, used to place slave panes.
+ * Sets clientArea, used to place panes.
*/
static void NotebookDoLayout(void *recordPtr)
{
@@ -567,32 +567,32 @@ static void NotebookDoLayout(void *recordPtr)
}
/*
- * NotebookPlaceSlave --
+ * NotebookPlaceContent --
* Set the position and size of a child widget
- * based on the current client area and slave options:
+ * based on the current client area and content window options:
*/
-static void NotebookPlaceSlave(Notebook *nb, TkSizeT slaveIndex)
+static void NotebookPlaceContent(Notebook *nb, TkSizeT index)
{
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex);
- Ttk_Box slaveBox =
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index);
+ Ttk_Box box =
Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding),
- Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky);
+ Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky);
- Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex,
- slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height);
+ Ttk_PlaceContent(nb->notebook.mgr, index,
+ box.x, box.y, box.width, box.height);
}
-/* NotebookPlaceSlaves --
+/* NotebookPlaceContents --
* Geometry manager hook.
*/
-static void NotebookPlaceSlaves(void *recordPtr)
+static void NotebookPlaceContents(void *recordPtr)
{
Notebook *nb = (Notebook *)recordPtr;
TkSizeT currentIndex = nb->notebook.currentIndex;
if (currentIndex != TCL_INDEX_NONE) {
NotebookDoLayout(nb);
- NotebookPlaceSlave(nb, currentIndex);
+ NotebookPlaceContent(nb, currentIndex);
}
}
@@ -602,7 +602,7 @@ static void NotebookPlaceSlaves(void *recordPtr)
*/
static void SelectTab(Notebook *nb, TkSizeT index)
{
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
TkSizeT currentIndex = nb->notebook.currentIndex;
if (index == currentIndex) {
@@ -620,18 +620,18 @@ static void SelectTab(Notebook *nb, TkSizeT index)
}
if (currentIndex != TCL_INDEX_NONE) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
- /* Must be set before calling NotebookPlaceSlave(), otherwise it may
- * happen that NotebookPlaceSlaves(), triggered by an interveaning
+ /* Must be set before calling NotebookPlaceContent(), otherwise it may
+ * happen that NotebookPlaceContents(), triggered by an interveaning
* geometry request, will swap to old index. */
nb->notebook.currentIndex = index;
- NotebookPlaceSlave(nb, index);
+ NotebookPlaceContent(nb, index);
TtkRedisplayWidget(&nb->core);
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
/* NextTab --
@@ -641,13 +641,13 @@ static void SelectTab(Notebook *nb, TkSizeT index)
*/
static int NextTab(Notebook *nb, int index)
{
- TkSizeT nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nTabs = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT nextIndex;
/* Scan forward for following usable tab:
*/
for (nextIndex = index + 1; nextIndex + 1 < nTabs + 1; ++nextIndex) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -656,7 +656,7 @@ static int NextTab(Notebook *nb, int index)
/* Not found -- scan backwards.
*/
for (nextIndex = index - 1; nextIndex != TCL_INDEX_NONE; --nextIndex) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -680,10 +680,10 @@ static void SelectNearestTab(Notebook *nb)
TkSizeT nextIndex = NextTab(nb, currentIndex);
if (currentIndex != TCL_INDEX_NONE) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
if (currentIndex != nextIndex) {
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
nb->notebook.currentIndex = nextIndex;
@@ -691,14 +691,14 @@ static void SelectNearestTab(Notebook *nb)
TtkRedisplayWidget(&nb->core);
}
-/* TabRemoved -- GM SlaveRemoved hook.
+/* TabRemoved -- GM TabRemoved hook.
* Select the next tab if the current one is being removed.
- * Adjust currentIndex to account for removed slave.
+ * Adjust currentIndex to account for removed content window.
*/
static void TabRemoved(void *managerData, TkSizeT index)
{
Notebook *nb = (Notebook *)managerData;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -713,13 +713,12 @@ static void TabRemoved(void *managerData, TkSizeT index)
TtkRedisplayWidget(&nb->core);
}
-static int TabRequest(void *managerData, TkSizeT index, int width, int height)
+static int TabRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(TkSizeT),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- (void)managerData;
- (void)index;
- (void)width;
- (void)height;
-
return 1;
}
@@ -728,17 +727,17 @@ static int TabRequest(void *managerData, TkSizeT index, int width, int height)
*/
static int AddTab(
Tcl_Interp *interp, Notebook *nb,
- TkSizeT destIndex, Tk_Window slaveWindow,
+ TkSizeT destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Tab *tab;
- if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) {
return TCL_ERROR;
}
#if 0 /* can't happen */
- if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) {
+ if (Ttk_ContentIndex(nb->notebook.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added",
- Tk_PathName(slaveWindow)));
+ Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL);
return TCL_ERROR;
}
@@ -746,16 +745,16 @@ static int AddTab(
/* Create and insert tab.
*/
- tab = CreateTab(interp, nb, slaveWindow);
+ tab = CreateTab(interp, nb, window);
if (!tab) {
return TCL_ERROR;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc, objv) != TCL_OK) {
DestroyTab(nb, tab);
return TCL_ERROR;
}
- Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab);
+ Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab);
/* Adjust indices and/or autoselect first tab:
*/
@@ -769,9 +768,9 @@ static int AddTab(
}
static Ttk_ManagerSpec NotebookManagerSpec = {
- { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc },
NotebookSize,
- NotebookPlaceSlaves,
+ NotebookPlaceContents,
TabRequest,
TabRemoved
};
@@ -814,7 +813,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
* + positional specifications @x,y,
* + "current",
* + numeric indices [0..nTabs],
- * + slave window names
+ * + content window names
*
* Stores index of specified tab in *index_rtn, -1 if not found.
*
@@ -845,21 +844,21 @@ static int FindTabIndex(
return TCL_OK;
}
- /* ... or integer index or slave window name:
+ /* ... or integer index or content window name:
*/
- if (Ttk_GetSlaveIndexFromObj(
+ if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK)
{
return TCL_OK;
}
- if (*index_rtn == Ttk_NumberSlaves(nb->notebook.mgr)) {
+ if (*index_rtn == Ttk_NumberContent(nb->notebook.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid slave specification %s", string));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL);
+ "Invalid tab specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "SPEC", NULL);
return TCL_ERROR;
}
- /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message.
+ /* Nothing matched; Ttk_GetContentIndexFromObj will have left error message.
*/
return TCL_ERROR;
}
@@ -873,10 +872,10 @@ static int GetTabIndex(
Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, TkSizeT *index_rtn)
{
int status = FindTabIndex(interp, nb, objPtr, index_rtn);
- if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) {
+ if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %s out of bounds", Tcl_GetString(objPtr)));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
+ "tab index %s out of bounds", Tcl_GetString(objPtr)));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL);
return TCL_ERROR;
}
@@ -899,9 +898,8 @@ static int NotebookAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int index = Ttk_NumberSlaves(nb->notebook.mgr);
- Tk_Window slaveWindow;
- int slaveIndex;
+ Tk_Window window;
+ int index;
Tab *tab;
if (objc <= 2 || objc % 2 != 1) {
@@ -909,21 +907,21 @@ static int NotebookAddCommand(
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
- if (!slaveWindow) {
+ window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
+ if (!window) {
return TCL_ERROR;
}
- slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
+ index = Ttk_ContentIndex(nb->notebook.mgr, window);
- if (slaveIndex < 0) { /* New tab */
- return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3);
+ if (index < 0) { /* New tab */
+ return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3);
}
- tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (tab->state == TAB_STATE_HIDDEN) {
tab->state = TAB_STATE_NORMAL;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -940,55 +938,55 @@ static int NotebookInsertCommand(
{
Notebook *nb = (Notebook *)recordPtr;
TkSizeT current = nb->notebook.currentIndex;
- TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT srcIndex, destIndex;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[2], &destIndex)) {
return TCL_ERROR;
}
if (Tcl_GetString(objv[3])[0] == '.') {
- /* Window name -- could be new or existing slave.
+ /* Window name -- could be new or existing content window.
*/
- Tk_Window slaveWindow =
+ Tk_Window window =
Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
- if (srcIndex == TCL_INDEX_NONE) { /* New slave */
- return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4);
+ srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window);
+ if (srcIndex == TCL_INDEX_NONE) { /* New content window */
+ return AddTab(interp, nb, destIndex, window, objc-4,objv+4);
}
- } else if (Ttk_GetSlaveIndexFromObj(
+ } else if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK)
{
return TCL_ERROR;
- } else if (srcIndex + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) {
- srcIndex = Ttk_NumberSlaves(nb->notebook.mgr) - 1;
+ } else if (srcIndex + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
+ srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1;
}
- /* Move existing slave:
+ /* Move existing content window:
*/
if (ConfigureTab(interp, nb,
- (Tab *)Ttk_SlaveData(nb->notebook.mgr, srcIndex),
- Ttk_SlaveWindow(nb->notebook.mgr, srcIndex),
+ (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex),
+ Ttk_ContentWindow(nb->notebook.mgr, srcIndex),
objc-4,objv+4) != TCL_OK)
{
return TCL_ERROR;
}
- if (destIndex + 1 >= nSlaves + 1) {
- destIndex = nSlaves - 1;
+ if (destIndex + 1 >= nContent + 1) {
+ destIndex = nContent - 1;
}
- Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex);
+ Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex);
/* Adjust internal indexes:
*/
@@ -1024,7 +1022,7 @@ static int NotebookForgetCommand(
return TCL_ERROR;
}
- Ttk_ForgetSlave(nb->notebook.mgr, index);
+ Ttk_ForgetContent(nb->notebook.mgr, index);
TtkRedisplayWidget(&nb->core);
return TCL_OK;
@@ -1049,7 +1047,7 @@ static int NotebookHideCommand(
return TCL_ERROR;
}
- tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
tab->state = TAB_STATE_HIDDEN;
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -1079,7 +1077,7 @@ static int NotebookIdentifyCommand(
return TCL_ERROR;
}
- if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
|| Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
|| (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable,
sizeof(char *), "option", 0, &what) != TCL_OK)
@@ -1089,7 +1087,7 @@ static int NotebookIdentifyCommand(
tabIndex = IdentifyTab(nb, x, y);
if (tabIndex != TCL_INDEX_NONE) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex);
Ttk_State state = TabState(nb, tabIndex);
Ttk_Layout tabLayout = nb->notebook.tabLayout;
@@ -1108,9 +1106,8 @@ static int NotebookIdentifyCommand(
}
break;
case IDENTIFY_TAB:
- if (tabIndex != TCL_INDEX_NONE) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(tabIndex));
- }
+ if (tabIndex != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex));
break;
}
return TCL_OK;
@@ -1134,8 +1131,9 @@ static int NotebookIndexCommand(
}
status = FindTabIndex(interp, nb, objv[2], &index);
- if (status == TCL_OK && index != TCL_INDEX_NONE) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ if (status == TCL_OK) {
+ if (index != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
}
return status;
@@ -1152,7 +1150,7 @@ static int NotebookSelectCommand(
if (objc == 2) {
if (nb->notebook.currentIndex != TCL_INDEX_NONE) {
- Tk_Window pane = Ttk_SlaveWindow(
+ Tk_Window pane = Ttk_ContentWindow(
nb->notebook.mgr, nb->notebook.currentIndex);
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1));
}
@@ -1186,8 +1184,8 @@ static int NotebookTabsCommand(
}
result = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(pathName,-1));
}
@@ -1203,7 +1201,7 @@ static int NotebookTabCommand(
Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
TkSizeT index;
- Tk_Window slaveWindow;
+ Tk_Window window;
Tab *tab;
if (objc < 3) {
@@ -1215,18 +1213,18 @@ static int NotebookTabCommand(
return TCL_ERROR;
}
- tab = (Tab *)Ttk_SlaveData(mgr, index);
- slaveWindow = Ttk_SlaveWindow(mgr, index);
+ tab = (Tab *)Ttk_ContentData(mgr, index);
+ window = Ttk_ContentWindow(mgr, index);
if (objc == 3) {
return TtkEnumerateOptions(interp, tab,
- PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow);
+ PaneOptionSpecs, nb->notebook.paneOptionTable, window);
} else if (objc == 4) {
return TtkGetOptionValue(interp, tab, objv[3],
- nb->notebook.paneOptionTable, slaveWindow);
+ nb->notebook.paneOptionTable, window);
} /* else */
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -1346,7 +1344,7 @@ static Ttk_Layout NotebookGetLayout(
static void DisplayTab(Notebook *nb, int index, Drawable d)
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
Ttk_State state = TabState(nb, index);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -1359,7 +1357,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d)
static void NotebookDisplay(void *clientData, Drawable d)
{
Notebook *nb = (Notebook *)clientData;
- TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT index;
/* Draw notebook background (base layout):
@@ -1369,7 +1367,7 @@ static void NotebookDisplay(void *clientData, Drawable d)
/* Draw tabs from left to right, but draw the current tab last
* so it will overwrite its neighbors.
*/
- for (index = 0; index < nSlaves; ++index) {
+ for (index = 0; index < nContent; ++index) {
if (index != nb->notebook.currentIndex) {
DisplayTab(nb, index, d);
}
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index f44c569..ae7bf11 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -28,7 +28,7 @@
* gives the same result as changing the size by X+Y pixels
* in one step).
*
- * The request size is initially set to the slave window's requested size.
+ * The request size is initially set to the content window's requested size.
* When the user drags a sash, each pane's request size is set to its
* actual size. This ensures that panes "stay put" on the next resize.
*
@@ -77,20 +77,20 @@ typedef struct {
static const Tk_OptionSpec PanedOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient),
- 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
{TK_OPTION_INT, "-width", "width", "Width", "0",
- TCL_INDEX_NONE, offsetof(Paned,paned.width),
- 0,0,GEOMETRY_CHANGED },
+ TCL_INDEX_NONE, offsetof(Paned, paned.width),
+ 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_INT, "-height", "height", "Height", "0",
- TCL_INDEX_NONE, offsetof(Paned,paned.height),
- 0,0,GEOMETRY_CHANGED },
+ TCL_INDEX_NONE, offsetof(Paned, paned.height),
+ 0, 0, GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
/*------------------------------------------------------------------------
- * +++ Slave pane record.
+ * +++ Pane record.
*/
typedef struct {
int reqSize; /* Pane request size */
@@ -107,21 +107,21 @@ static const Tk_OptionSpec PaneOptionSpecs[] = {
/* CreatePane --
* Create a new pane record.
*/
-static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow)
+static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window window)
{
Tk_OptionTable optionTable = pw->paned.paneOptionTable;
void *record = ckalloc(sizeof(Pane));
Pane *pane = (Pane *)record;
memset(record, 0, sizeof(Pane));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
pane->reqSize
= pw->paned.orient == TTK_ORIENT_HORIZONTAL
- ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow);
+ ? Tk_ReqWidth(window) : Tk_ReqHeight(window);
return pane;
}
@@ -140,7 +140,7 @@ static void DestroyPane(Paned *pw, Pane *pane)
* Set pane options.
*/
static int ConfigurePane(
- Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Manager *mgr = pw->paned.mgr;
@@ -148,7 +148,7 @@ static int ConfigurePane(
int mask = 0;
if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -188,14 +188,14 @@ error:
static int ShoveUp(Paned *pw, int i, int pos)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, i);
int sashThickness = pw->paned.sashThickness;
if (i == 0) {
if (pos < 0)
pos = 0;
} else {
- Pane *prevPane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i-1);
+ Pane *prevPane = (Pane *)Ttk_ContentData(pw->paned.mgr, i-1);
if (pos < prevPane->sashPos + sashThickness)
pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness;
}
@@ -208,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos)
*/
static int ShoveDown(Paned *pw, TkSizeT i, int pos)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i);
int sashThickness = pw->paned.sashThickness;
- if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) {
- pos = pane->sashPos; /* Sentinel value == master window size */
+ if (i == Ttk_NumberContent(pw->paned.mgr) - 1) {
+ pos = pane->sashPos; /* Sentinel value == container window size */
} else {
- Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1);
+ Pane *nextPane = (Pane *)Ttk_ContentData(pw->paned.mgr,i+1);
if (pos + sashThickness > nextPane->sashPos)
pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness;
}
@@ -230,7 +230,7 @@ static int ShoveDown(Paned *pw, TkSizeT i, int pos)
static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
Paned *pw = (Paned *)recordPtr;
- int nPanes = Ttk_NumberSlaves(pw->paned.mgr);
+ int nPanes = Ttk_NumberContent(pw->paned.mgr);
int nSashes = nPanes - 1;
int sashThickness = pw->paned.sashThickness;
int width = 0, height = 0;
@@ -238,21 +238,21 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (height < Tk_ReqHeight(slaveWindow))
- height = Tk_ReqHeight(slaveWindow);
+ if (height < Tk_ReqHeight(window))
+ height = Tk_ReqHeight(window);
width += pane->reqSize;
}
width += nSashes * sashThickness;
} else {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (width < Tk_ReqWidth(slaveWindow))
- width = Tk_ReqWidth(slaveWindow);
+ if (width < Tk_ReqWidth(window))
+ width = Tk_ReqWidth(window);
height += pane->reqSize;
}
height += nSashes * sashThickness;
@@ -277,8 +277,8 @@ static void AdjustPanes(Paned *pw)
int pos = 0;
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
pane->reqSize = size >= 0 ? size : 0;
pos = pane->sashPos + sashThickness;
@@ -304,7 +304,7 @@ static void AdjustPanes(Paned *pw)
static void PlaceSashes(Paned *pw, int width, int height)
{
Ttk_Manager *mgr = pw->paned.mgr;
- int nPanes = Ttk_NumberSlaves(mgr);
+ int nPanes = Ttk_NumberContent(mgr);
int sashThickness = pw->paned.sashThickness;
int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height;
int reqSize = 0, totalWeight = 0;
@@ -316,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
/* Compute total required size and total available weight:
*/
for (i = 0; i < nPanes; ++i) {
- Pane *pane = (Pane *)Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
reqSize += pane->reqSize;
totalWeight += pane->weight * (pane->reqSize != 0);
}
@@ -340,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
*/
pos = 0;
for (i = 0; i < nPanes; ++i) {
- Pane *pane = (Pane *)Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
int weight = pane->weight * (pane->reqSize != 0);
int size = pane->reqSize + delta * weight;
@@ -364,7 +364,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
}
/* PlacePanes --
- * Places slave panes based on sash positions.
+ * Places panes based on sash positions.
*/
static void PlacePanes(Paned *pw)
{
@@ -374,18 +374,18 @@ static void PlacePanes(Paned *pw)
int pos = 0;
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
if (size > 0) {
if (horizontal) {
- Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height);
+ Ttk_PlaceContent(pw->paned.mgr, index, pos, 0, size, height);
} else {
- Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size);
+ Ttk_PlaceContent(pw->paned.mgr, index, 0, pos, width, size);
}
} else {
- Ttk_UnmapSlave(pw->paned.mgr, index);
+ Ttk_UnmapContent(pw->paned.mgr, index);
}
pos = pane->sashPos + sashThickness;
@@ -396,7 +396,7 @@ static void PlacePanes(Paned *pw)
* +++ Manager specification.
*/
-static void PanedPlaceSlaves(void *managerData)
+static void PanedPlaceContent(void *managerData)
{
Paned *pw = (Paned *)managerData;
PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin));
@@ -406,62 +406,62 @@ static void PanedPlaceSlaves(void *managerData)
static void PaneRemoved(void *managerData, TkSizeT index)
{
Paned *pw = (Paned *)managerData;
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
DestroyPane(pw, pane);
}
static int AddPane(
Tcl_Interp *interp, Paned *pw,
- int destIndex, Tk_Window slaveWindow,
+ int destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Pane *pane;
- if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) {
return TCL_ERROR;
}
- if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) {
+ if (Ttk_ContentIndex(pw->paned.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "%s already added", Tk_PathName(slaveWindow)));
+ "%s already added", Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL);
return TCL_ERROR;
}
- pane = CreatePane(interp, pw, slaveWindow);
+ pane = CreatePane(interp, pw, window);
if (!pane) {
return TCL_ERROR;
}
- if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigurePane(interp, pw, pane, window, objc, objv) != TCL_OK) {
DestroyPane(pw, pane);
return TCL_ERROR;
}
- Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane);
+ Ttk_InsertContent(pw->paned.mgr, destIndex, window, pane);
return TCL_OK;
}
/* PaneRequest --
- * Only update pane request size if slave is currently unmapped.
- * Geometry requests from mapped slaves are not directly honored
+ * Only update pane request size if pane is currently unmapped.
+ * Geometry requests from mapped panes are not directly honored
* in order to avoid unexpected pane resizes (esp. while the
* user is dragging a sash [#1325286]).
*/
static int PaneRequest(void *managerData, TkSizeT index, int width, int height)
{
Paned *pw = (Paned *)managerData;
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
- if (!Tk_IsMapped(slaveWindow)) {
+ if (!Tk_IsMapped(window)) {
pane->reqSize = horizontal ? width : height;
}
return 1;
}
static Ttk_ManagerSpec PanedManagerSpec = {
- { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc },
PanedSize,
- PanedPlaceSlaves,
+ PanedPlaceContent,
PaneRequest,
PaneRemoved
};
@@ -486,7 +486,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
if ( eventPtr->type == LeaveNotify
&& eventPtr->xcrossing.detail == NotifyInferior)
{
- TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild");
+ Tk_SendVirtualEvent(corePtr->tkwin, "EnteredChild", NULL);
}
}
@@ -519,10 +519,12 @@ static void PanedCleanup(void *recordPtr)
/* Post-configuration hook.
*/
-static int PanedPostConfigure(Tcl_Interp *dummy, void *clientData, int mask)
+static int PanedPostConfigure(
+ TCL_UNUSED(Tcl_Interp *),
+ void *clientData,
+ int mask)
{
Paned *pw = (Paned *)clientData;
- (void)dummy;
if (mask & GEOMETRY_CHANGED) {
/* User has changed -width or -height.
@@ -581,7 +583,7 @@ static Ttk_Layout PanedGetLayout(
*/
static Ttk_Layout SashLayout(Paned *pw, int index)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int thickness = pw->paned.sashThickness,
height = Tk_Height(pw->core.tkwin),
width = Tk_Width(pw->core.tkwin),
@@ -604,10 +606,10 @@ static void DrawSash(Paned *pw, int index, Drawable d)
static void PanedDisplay(void *recordPtr, Drawable d)
{
Paned *pw = (Paned *)recordPtr;
- TkSizeT i, nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ TkSizeT i, nContent = Ttk_NumberContent(pw->paned.mgr);
TtkWidgetDisplay(recordPtr, d);
- for (i = 1; i < nSlaves; ++i) {
+ for (i = 1; i < nContent; ++i) {
DrawSash(pw, i - 1, d);
}
}
@@ -622,65 +624,65 @@ static int PanedAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- Tk_Window slaveWindow;
+ Tk_Window window;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[2]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow,
+ return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), window,
objc - 3, objv + 3);
}
-/* $pw insert $index $slave ?-option value ...?
- * Insert new slave, or move existing one.
+/* $pw insert $index $window ?-option value ...?
+ * Insert new content window, or move existing one.
*/
static int PanedInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- TkSizeT nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ TkSizeT nContent = Ttk_NumberContent(pw->paned.mgr);
TkSizeT srcIndex, destIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[3]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp,pw->paned.mgr, objv[2], &destIndex))
{
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow);
- if (srcIndex == TCL_INDEX_NONE) { /* New slave: */
- return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4);
- } /* else -- move existing slave: */
+ srcIndex = Ttk_ContentIndex(pw->paned.mgr, window);
+ if (srcIndex == TCL_INDEX_NONE) { /* New content: */
+ return AddPane(interp, pw, destIndex, window, objc-4, objv+4);
+ } /* else -- move existing content: */
- if (destIndex + 1 >= nSlaves + 1)
- destIndex = nSlaves - 1;
- Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex);
+ if (destIndex + 1 >= nContent + 1)
+ destIndex = nContent - 1;
+ Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex);
return objc == 4 ? TCL_OK :
ConfigurePane(interp, pw,
- (Pane *)Ttk_SlaveData(pw->paned.mgr, destIndex),
- Ttk_SlaveWindow(pw->paned.mgr, destIndex),
+ (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex),
+ Ttk_ContentWindow(pw->paned.mgr, destIndex),
objc-4, objv+4);
}
@@ -697,14 +699,14 @@ static int PanedForgetCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
- } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) {
- paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
- Ttk_ForgetSlave(pw->paned.mgr, paneIndex);
+ Ttk_ForgetContent(pw->paned.mgr, paneIndex);
return TCL_OK;
}
@@ -720,7 +722,7 @@ static int PanedIdentifyCommand(
int what = IDENTIFY_SASH;
Paned *pw = (Paned *)recordPtr;
int sashThickness = pw->paned.sashThickness;
- int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1;
int x, y, pos;
int index;
@@ -739,7 +741,7 @@ static int PanedIdentifyCommand(
pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y;
for (index = 0; index < nSashes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) {
/* Found it. */
switch (what) {
@@ -771,7 +773,7 @@ static int PanedPaneCommand(
{
Paned *pw = (Paned *)recordPtr;
TkSizeT paneIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
Pane *pane;
if (objc < 3) {
@@ -779,26 +781,26 @@ static int PanedPaneCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp,pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
- } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) {
- paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
- pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, paneIndex);
- slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex);
+ window = Ttk_ContentWindow(pw->paned.mgr, paneIndex);
switch (objc) {
case 3:
return TtkEnumerateOptions(interp, pane, PaneOptionSpecs,
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
case 4:
return TtkGetOptionValue(interp, pane, objv[3],
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
default:
- return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3);
+ return ConfigurePane(interp, pw, pane, window, objc-3,objv+3);
}
}
@@ -819,8 +821,8 @@ static int PanedPanesCommand(
}
panes = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1));
}
Tcl_SetObjResult(interp, panes);
@@ -846,14 +848,14 @@ static int PanedSashposCommand(
if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr)) {
+ if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberContent(pw->paned.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"sash index %d out of range", sashIndex));
Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, sashIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex);
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
@@ -930,14 +932,15 @@ static const Ttk_ElementOptionSpec SashElementOptions[] = {
};
static void SashElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ TCL_UNUSED(Tk_Window),
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
SashElement *sash = (SashElement *)elementRecord;
int thickness = DEFAULT_SASH_THICKNESS;
- (void)dummy;
- (void)tkwin;
- (void)paddingPtr;
Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness);
*widthPtr = *heightPtr = thickness;
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 6e5875e..97109dc 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -71,10 +71,10 @@ static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
offsetof(Progressbar,progress.modeObj),
offsetof(Progressbar,progress.mode),
- 0, (ClientData)ProgressbarModeStrings, 0 },
+ 0, (void *)ProgressbarModeStrings, 0 },
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
"horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE,
- 0, (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_INT, "-phase", "phase", "Phase",
"0", offsetof(Progressbar,progress.phaseObj), TCL_INDEX_NONE,
0, 0, 0 },
@@ -137,7 +137,7 @@ static void AnimateProgressProc(ClientData clientData)
if (pb->progress.maxPhase)
phase %= pb->progress.maxPhase;
Tcl_DecrRefCount(pb->progress.phaseObj);
- pb->progress.phaseObj = Tcl_NewIntObj(phase);
+ pb->progress.phaseObj = Tcl_NewWideIntObj(phase);
Tcl_IncrRefCount(pb->progress.phaseObj);
/*
@@ -208,10 +208,11 @@ static void VariableChanged(void *recordPtr, const char *value)
* +++ Widget class methods:
*/
-static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ProgressbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Progressbar *pb = (Progressbar *)recordPtr;
- (void)dummy;
pb->progress.variableTrace = 0;
pb->progress.timer = 0;
@@ -259,12 +260,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook:
*/
static int ProgressbarPostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Progressbar *pb = (Progressbar *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (pb->progress.variableTrace) {
status = Ttk_FireTrace(pb->progress.variableTrace);
@@ -497,21 +498,23 @@ static int ProgressbarStartStopCommand(
}
static int ProgressbarStartCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::start", objc, objv);
+ interp, "::ttk::progressbar::start", objc, objv);
}
static int ProgressbarStopCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::stop", objc, objv);
+ interp, "::ttk::progressbar::stop", objc, objv);
}
static const Ttk_Ensemble ProgressbarCommands[] = {
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index a6bde9a..8c2999f 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -5,6 +5,7 @@
*/
#include "tkInt.h"
+#include "tkInt.h"
#include "ttkTheme.h"
#include "ttkWidget.h"
@@ -57,11 +58,11 @@ static const Tk_OptionSpec ScaleOptionSpecs[] =
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-variable", "variable", "Variable", "",
offsetof(Scale,scale.variableObj), TCL_INDEX_NONE,
- 0,0,0},
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Scale,scale.orientObj),
offsetof(Scale,scale.orient), 0,
- (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
offsetof(Scale,scale.fromObj), TCL_INDEX_NONE, 0, 0, 0},
@@ -75,7 +76,7 @@ static const Tk_OptionSpec ScaleOptionSpecs[] =
{TK_OPTION_STRING, "-state", "state", "State",
"normal", offsetof(Scale,scale.stateObj), TCL_INDEX_NONE,
- 0,0,STATE_CHANGED},
+ 0, 0, STATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -110,10 +111,11 @@ static void ScaleVariableChanged(void *recordPtr, const char *value)
/* ScaleInitialize --
* Scale widget initialization hook.
*/
-static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ScaleInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scale *scalePtr = (Scale *)recordPtr;
- (void)dummy;
TtkTrackElementState(&scalePtr->core);
}
@@ -163,12 +165,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook.
*/
static int ScalePostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Scale *scale = (Scale *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (scale->scale.variableTrace) {
status = Ttk_FireTrace(scale->scale.variableTrace);
@@ -376,8 +378,8 @@ ScaleCoordsCommand(
if (r == TCL_OK) {
Tcl_Obj *point[2];
XPoint pt = ValueToPoint(scalePtr, value);
- point[0] = Tcl_NewIntObj(pt.x);
- point[1] = Tcl_NewIntObj(pt.y);
+ point[0] = Tcl_NewWideIntObj(pt.x);
+ point[1] = Tcl_NewWideIntObj(pt.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, point));
}
return r;
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index b031dc6..69370c9 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -130,12 +130,12 @@ static void UpdateScrollbarBG(ClientData clientData)
int code;
h->flags &= ~SCROLL_UPDATE_PENDING;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
code = UpdateScrollbar(interp, h);
if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) {
Tcl_BackgroundException(interp, code);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/* TtkScrolled --
@@ -167,7 +167,7 @@ void TtkScrolled(ScrollHandle h, int first, int last, int total)
s->total = total;
if (!(h->flags & SCROLL_UPDATE_PENDING)) {
- Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h);
+ Tcl_DoWhenIdle(UpdateScrollbarBG, h);
h->flags |= SCROLL_UPDATE_PENDING;
}
}
@@ -274,7 +274,7 @@ void TtkScrollTo(ScrollHandle h, int newFirst, int updateScrollInfo)
void TtkFreeScrollHandle(ScrollHandle h)
{
if (h->flags & SCROLL_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
+ Tcl_CancelIdleCall(UpdateScrollbarBG, h);
}
ckfree(h);
}
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 1b915cc..4670832 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -34,12 +34,12 @@ typedef struct
static const Tk_OptionSpec ScrollbarOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
- offsetof(Scrollbar,scrollbar.commandObj), TCL_INDEX_NONE, 0,0,0},
+ offsetof(Scrollbar, scrollbar.commandObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
- offsetof(Scrollbar,scrollbar.orientObj),
- offsetof(Scrollbar,scrollbar.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ offsetof(Scrollbar, scrollbar.orientObj),
+ offsetof(Scrollbar, scrollbar.orient),
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -50,10 +50,11 @@ static const Tk_OptionSpec ScrollbarOptionSpecs[] =
*/
static void
-ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+ScrollbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scrollbar *sb = (Scrollbar *)recordPtr;
- (void)dummy;
sb->scrollbar.first = 0.0;
sb->scrollbar.last = 1.0;
@@ -316,16 +317,14 @@ TTK_BEGIN_LAYOUT(VerticalScrollbarLayout)
TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y,
TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP)
TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM)
- TTK_NODE(
- "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH))
+ TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH))
TTK_END_LAYOUT
TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout)
TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT)
TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT)
- TTK_NODE(
- "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH))
+ TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH))
TTK_END_LAYOUT
/*------------------------------------------------------------------------
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index 00605dc..e86ee5c 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -26,7 +26,7 @@ static const Tk_OptionSpec SeparatorOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Separator,separator.orientObj),
offsetof(Separator,separator.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index 422afc3..ba5df57 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -198,12 +198,15 @@ static const Ttk_ElementOptionSpec SquareElementOptions[] =
*/
static void SquareElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ Ttk_Padding *paddingPtr)
{
SquareElement *square = (SquareElement *)elementRecord;
int borderWidth = 0;
- (void)dummy;
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
@@ -216,14 +219,16 @@ static void SquareElementSize(
*/
static void SquareElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ TCL_UNUSED(unsigned int))
{
SquareElement *square = (SquareElement *)elementRecord;
Tk_3DBorder foreground = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
- (void)dummy;
- (void)state;
foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c
index 31cdaa8..dc11b4c 100644
--- a/generic/ttk/ttkStubInit.c
+++ b/generic/ttk/ttkStubInit.c
@@ -3,7 +3,7 @@
* It is compiled and linked in with the ttk package proper.
*/
-#include "tk.h"
+#include "tkInt.h"
#include "ttkTheme.h"
MODULE_SCOPE const TtkStubs ttkStubs;
diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c
index 5675416..faeabe8 100644
--- a/generic/ttk/ttkStubLib.c
+++ b/generic/ttk/ttkStubLib.c
@@ -6,7 +6,7 @@
#undef USE_TCL_STUBS
#define USE_TCL_STUBS
-#include "tk.h"
+#include "tkInt.h"
#define USE_TTK_STUBS 1
#include "ttkTheme.h"
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index a8745d7..eaea800 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -291,13 +291,12 @@ static void FreeElementClass(Ttk_ElementClass *elementClass)
* +++ Themes.
*/
-static int ThemeEnabled(Ttk_Theme theme, void *dummy)
+static int ThemeEnabled(
+ TCL_UNUSED(Ttk_Theme),
+ TCL_UNUSED(void *))
{
- (void)theme;
- (void)dummy;
-
/* Default ThemeEnabledProc -- always return true */
- return 1;
+ return 1;
}
typedef struct Ttk_Theme_
@@ -390,7 +389,7 @@ typedef struct CleanupStruct {
} Cleanup;
/*------------------------------------------------------------------------
- * +++ Master style package data structure.
+ * +++ Style package data structure.
*/
typedef struct
{
@@ -404,18 +403,19 @@ typedef struct
int themeChangePending; /* scheduled ThemeChangedProc call? */
} StylePackageData;
-static void ThemeChangedProc(ClientData); /* Forward */
+static void ThemeChangedProc(void *); /* Forward */
/* Ttk_StylePkgFree --
* Cleanup procedure for StylePackageData.
*/
-static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *dummy)
+static void Ttk_StylePkgFree(
+ ClientData clientData,
+ TCL_UNUSED(Tcl_Interp *))
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
Cleanup *cleanup;
- (void)dummy;
/*
* Cancel any pending ThemeChanged calls:
@@ -517,9 +517,6 @@ static void ThemeChangedProc(ClientData clientData)
Tcl_BackgroundException(pkgPtr->interp, code);
}
pkgPtr->themeChangePending = 0;
-#ifdef MAC_OSX_TK
- XSync(NULL, False);
-#endif
}
/*
@@ -593,7 +590,7 @@ void Ttk_SetThemeEnabledProc(
static Ttk_Theme LookupTheme(
Tcl_Interp *interp, /* where to leave error messages */
- StylePackageData *pkgPtr, /* style package master record */
+ StylePackageData *pkgPtr, /* style package record */
const char *name) /* theme name */
{
Tcl_HashEntry *entryPtr;
@@ -830,13 +827,12 @@ int Ttk_RegisterElementFactory(
* (style element create $name) "from" $theme ?$element?
*/
static int Ttk_CloneElement(
- Tcl_Interp *interp, void *dummy,
+ Tcl_Interp *interp, TCL_UNUSED(void *),
Ttk_Theme theme, const char *elementName,
int objc, Tcl_Obj *const objv[])
{
Ttk_Theme fromTheme;
Ttk_ElementClass *fromElement;
- (void)dummy;
if (objc <= 0 || objc > 2) {
Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?");
@@ -1182,7 +1178,7 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
*/
static int
StyleMapCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1446,11 +1442,12 @@ static int StyleThemeCreateCmd(
* Return list of registered themes.
*/
static int StyleThemeNamesCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ ClientData clientData,
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
- (void)objc;
- (void)objv;
return TtkEnumerateHashTable(interp, &pkgPtr->themeTable);
}
@@ -1462,7 +1459,7 @@ static int StyleThemeNamesCmd(
*/
static int
StyleThemeSettingsCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1620,7 +1617,7 @@ static int StyleLayoutCmd(
*/
static int
StyleThemeUseCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1677,7 +1674,7 @@ static const Ttk_Ensemble StyleEnsemble[] = {
static int
StyleObjCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index 7e02b58..1019ffa 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -26,15 +26,13 @@ static char *
VarTraceProc(
ClientData clientData, /* Widget record pointer */
Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *name1, /* (unused) */
- const char *name2, /* (unused) */
+ TCL_UNUSED(const char *), /* name1 */
+ TCL_UNUSED(const char *), /* name2 */
int flags) /* Information about what happened. */
{
Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData;
const char *name, *value;
Tcl_Obj *valuePtr;
- (void)name1;
- (void)name2;
if (Tcl_InterpDeleted(interp)) {
return NULL;
@@ -53,7 +51,7 @@ VarTraceProc(
*/
if (tracePtr->interp == NULL) {
Tcl_DecrRefCount(tracePtr->varnameObj);
- ckfree((ClientData)tracePtr);
+ ckfree(tracePtr);
return NULL;
}
Tcl_TraceVar2(interp, name, NULL,
@@ -98,7 +96,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
status = Tcl_TraceVar2(interp, Tcl_GetString(varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
if (status != TCL_OK) {
Tcl_DecrRefCount(h->varnameObj);
@@ -139,7 +137,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
*/
while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj),
TCL_GLOBAL_ONLY, VarTraceProc, cd)) != NULL) {
- if (cd == (ClientData) h) {
+ if (cd == h) {
break;
}
}
@@ -154,7 +152,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
}
Tcl_UntraceVar2(h->interp, Tcl_GetString(h->varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
Tcl_DecrRefCount(h->varnameObj);
ckfree(h);
}
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index b484d1c..4ea4c17 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -441,21 +441,21 @@ static const char *const SelectModeStrings[] = { "none", "browse", "extended", N
static const Tk_OptionSpec TreeviewOptionSpecs[] = {
{TK_OPTION_STRING, "-columns", "columns", "Columns",
"", offsetof(Treeview,tree.columnsObj), TCL_INDEX_NONE,
- 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
+ 0, 0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
{TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns",
"#all", offsetof(Treeview,tree.displayColumnsObj), TCL_INDEX_NONE,
- 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
+ 0, 0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-show", "show", "Show",
DEFAULT_SHOW, offsetof(Treeview,tree.showObj), TCL_INDEX_NONE,
- 0,0,SHOW_CHANGED | GEOMETRY_CHANGED },
+ 0, 0,SHOW_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode",
"extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE,
- 0,(ClientData)SelectModeStrings,0 },
+ 0, (void *)SelectModeStrings, 0 },
{TK_OPTION_PIXELS, "-height", "height", "Height",
DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), TCL_INDEX_NONE,
- 0,0,GEOMETRY_CHANGED},
+ 0, 0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Treeview,tree.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
@@ -792,9 +792,8 @@ static int PickupSlack(Treeview *tv, int extra)
{
int newSlack = tv->tree.slack + extra;
- if ( (newSlack < 0 && 0 <= tv->tree.slack)
- || (newSlack > 0 && 0 >= tv->tree.slack))
- {
+ if ((newSlack < 0 && 0 <= tv->tree.slack)
+ || (newSlack > 0 && 0 >= tv->tree.slack)) {
tv->tree.slack = 0;
return newSlack;
} else {
@@ -1101,10 +1100,9 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
TtkScrollbarUpdateRequired(tv->tree.xscrollHandle);
TtkScrollbarUpdateRequired(tv->tree.yscrollHandle);
}
- if ( (mask & SHOW_CHANGED)
- && GetEnumSetFromObj(
- interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK)
- {
+ if ((mask & SHOW_CHANGED)
+ && GetEnumSetFromObj(
+ interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) {
return TCL_ERROR;
}
@@ -1780,7 +1778,7 @@ static void DrawItem(
x+indent, y, colwidth-indent, rowHeight);
if (item->textObj) { displayItem.textObj = item->textObj; }
if (item->imageObj) { displayItem.imageObj = item->imageObj; }
- /* ??? displayItem.anchorObj = 0; <<NOTE-ANCHOR>> */
+ displayItem.anchorObj = tv->tree.column0.anchorObj;
DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d);
x += colwidth;
}
@@ -2109,7 +2107,7 @@ static int TreeviewIndexCommand(
{
Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
- int index = 0;
+ TkSizeT index = 0;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "item");
@@ -2125,7 +2123,7 @@ static int TreeviewIndexCommand(
item = item->prev;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -2201,9 +2199,8 @@ static int TreeviewHorribleIdentify(
/* ASSERT: objc == 4 */
- if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
- || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK
- ) {
+ if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) {
return TCL_ERROR;
}
@@ -2377,7 +2374,7 @@ static int TreeviewItemCommand(
TreeItem *item;
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??...");
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?-option ?value??...");
return TCL_ERROR;
}
if (!(item = FindItem(interp, tv, objv[2]))) {
@@ -2730,7 +2727,7 @@ static int TreeviewDeleteCommand(
ckfree(items);
if (selItemDeleted) {
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
}
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -2750,9 +2747,8 @@ static int TreeviewMoveCommand(
Tcl_WrongNumArgs(interp, 2, objv, "item parent index");
return TCL_ERROR;
}
- if ( (item = FindItem(interp, tv, objv[2])) == 0
- || (parent = FindItem(interp, tv, objv[3])) == 0)
- {
+ if ((item = FindItem(interp, tv, objv[2])) == 0
+ || (parent = FindItem(interp, tv, objv[3])) == 0) {
return TCL_ERROR;
}
@@ -2879,9 +2875,8 @@ static int TreeviewDragCommand(
return TCL_ERROR;
}
- if ( (column = FindColumn(interp, tv, objv[2])) == 0
- || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK)
- {
+ if ((column = FindColumn(interp, tv, objv[2])) == 0
+ || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) {
return TCL_ERROR;
}
@@ -3011,7 +3006,7 @@ static int TreeviewSelectionCommand(
}
ckfree(items);
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -3351,8 +3346,7 @@ 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_GROUP("Treeitem.focus", TTK_PACK_LEFT,
- TTK_NODE("Treeitem.text", TTK_PACK_LEFT))))
+ TTK_NODE("Treeitem.text", TTK_FILL_BOTH)))
TTK_LAYOUT("Cell",
TTK_GROUP("Treedata.padding", TTK_FILL_BOTH,
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index df6e6be..6726e17 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -213,7 +213,7 @@ DestroyWidget(WidgetCore *corePtr)
corePtr->widgetSpec->cleanupProc(corePtr);
Tk_FreeConfigOptions(
- (ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);
+ corePtr, corePtr->optionTable, corePtr->tkwin);
if (corePtr->layout) {
Ttk_FreeLayout(corePtr->layout);
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 6837d89..2eeab4e 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -165,11 +165,6 @@ MODULE_SCOPE void Ttk_UntraceVariable(Ttk_TraceHandle *);
MODULE_SCOPE int Ttk_FireTrace(Ttk_TraceHandle *);
/*
- * Virtual events:
- */
-MODULE_SCOPE void TtkSendVirtualEvent(Tk_Window tgtWin, const char *eventName);
-
-/*
* Helper routines for data accessor commands:
*/
MODULE_SCOPE int TtkEnumerateOptions(
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index d4d9b21..526d791 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -6,10 +6,10 @@
# trace (like save it to a log). This is adapted from work done by
# Donal K. Fellows.
#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
-# Copyright (c) 2007 by ActiveState Software Inc.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
-# Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 1998-2000 by Ajuba Solutions.
+# Copyright © 2007 by ActiveState Software Inc.
+# Copyright © 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
namespace eval ::tk::dialog::error {
namespace import -force ::tk::msgcat::*
@@ -41,7 +41,7 @@ proc ::tk::dialog::error::Details {} {
set w .bgerrorDialog
set caption [option get $w.function text {}]
set command [option get $w.function command {}]
- if { ($caption eq "") || ($command eq "") } {
+ if {($caption eq "") || ($command eq "")} {
grid forget $w.function
}
lappend command [$w.top.info.text get 1.0 end-1c]
@@ -50,7 +50,7 @@ proc ::tk::dialog::error::Details {} {
}
proc ::tk::dialog::error::SaveToLog {text} {
- if { $::tcl_platform(platform) eq "windows" } {
+ if {$::tcl_platform(platform) eq "windows"} {
set allFiles *.*
} else {
set allFiles *
@@ -129,11 +129,11 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
set lines 0
set maxLine 45
foreach line [split $err \n] {
- if { [string length $line] > $maxLine } {
- append displayedErr "[string range $line 0 [expr {$maxLine-3}]]..."
+ if {[string length $line] > $maxLine} {
+ append displayedErr "[string range $line 0 $maxLine-3]..."
break
}
- if { $lines > 4 } {
+ if {$lines > 4} {
append displayedErr "..."
break
} else {
@@ -182,7 +182,7 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
pack $W.text -side left -expand yes -fill both
$W.text insert 0.0 "$err\n$info"
$W.text mark set insert 0.0
- bind $W.text <Button-1> { focus %W }
+ bind $W.text <Button-1> {focus %W}
$W.text configure -state disabled
# 2. Fill the top part with bitmap and message
diff --git a/library/button.tcl b/library/button.tcl
index d824009..4be16b1 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -4,9 +4,9 @@
# checkbutton, and radiobutton widgets and provides procedures
# that help in implementing those bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 2002 ActiveState Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 2002 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -41,10 +41,10 @@ if {[tk windowingsystem] eq "aqua"} {
}
}
if {"win32" eq [tk windowingsystem]} {
- bind Checkbutton <equal> {
+ bind Checkbutton <=> {
tk::CheckRadioInvoke %W select
}
- bind Checkbutton <plus> {
+ bind Checkbutton <+> {
tk::CheckRadioInvoke %W select
}
bind Checkbutton <minus> {
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index 68dd9b0..ef90468 100644
--- a/library/choosedir.tcl
+++ b/library/choosedir.tcl
@@ -2,7 +2,7 @@
#
# Choose directory dialog implementation for Unix/Mac.
#
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1998-2000 by Scriptics Corporation.
# All rights reserved.
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index d67c67f..8bdb7a7 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -3,7 +3,7 @@
# Color selection dialog for platforms that do not support a
# standard color selection dialog.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
+# Copyright © 1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 18df8a6..0a7f65b 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -3,7 +3,7 @@
# Some functions needed for the common dialog boxes. Probably need to go
# in a different file.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
+# Copyright © 1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -29,7 +29,8 @@
# {....}
# }
#
-# flags = currently unused.
+# flags = a list of flags. Currently supported flags are:
+# DONTSETDEFAULTS = skip default values setting
#
# argList = The list of "-option value" pairs.
#
@@ -63,8 +64,10 @@ proc tclParseConfigSpec {w specs flags argList} {
# 2: set the default values
#
- foreach cmdsw [array names cmd] {
- set data($cmdsw) $def($cmdsw)
+ if {"DONTSETDEFAULTS" ni $flags} {
+ foreach cmdsw [array names cmd] {
+ set data($cmdsw) $def($cmdsw)
+ }
}
# 3: parse the argument list
diff --git a/library/console.tcl b/library/console.tcl
index eb8990a..f88cfc1 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -4,9 +4,9 @@
# can be used by non-unix systems that do not have built-in support
# for shells.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
-# Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2007-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.
@@ -131,7 +131,7 @@ proc ::tk::ConsoleInit {} {
default { set preferred {} }
}
foreach {family size} $preferred {
- if {[lsearch -exact $families $family] != -1} {
+ if {$family in $families} {
font configure TkConsoleFont -family $family -size $size
break
}
@@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} {
[list [mc "Tcl Scripts"] .tcl] \
[list [mc "All Files"] *]]]
if {$filename ne ""} {
- set cmd [list source $filename]
+ set cmd [list source -encoding utf-8 $filename]
if {[catch {consoleinterp eval $cmd} result]} {
ConsoleOutput stderr "$result\n"
}
@@ -454,23 +454,16 @@ proc ::tk::ConsoleBind {w} {
<<Console_Transpose>> <Control-t>
<<Console_ClearLine>> <Control-u>
<<Console_SaveCommand>> <Control-z>
- <<Console_FontSizeIncr>> <Control-plus>
+ <<Console_FontSizeIncr>> <Control-+>
<<Console_FontSizeDecr>> <Control-minus>
+ <<Console_FontSizeIncr>> <Command-+>
+ <<Console_FontSizeDecr>> <Command-minus>
} {
event add $ev $key
bind Console $key {}
}
- if {[tk windowingsystem] eq "aqua"} {
- foreach {ev key} {
- <<Console_FontSizeIncr>> <Command-plus>
- <<Console_FontSizeDecr>> <Command-minus>
- } {
- event add $ev $key
- bind Console $key {}
- }
- if {$::tk::console::useFontchooser} {
- bind Console <Command-t> [list ::tk::console::FontchooserToggle]
- }
+ if {$::tk::console::useFontchooser} {
+ bind Console <Command-t> [list ::tk::console::FontchooserToggle]
}
bind Console <<Console_Expand>> {
if {[%W compare insert > promptEnd]} {
@@ -592,12 +585,10 @@ proc ::tk::ConsoleBind {w} {
}
bind Console <F9> {
eval destroy [winfo child .]
- source [file join $tk_library console.tcl]
+ source -encoding utf-8 [file join $tk_library console.tcl]
}
- if {[tk windowingsystem] eq "aqua"} {
- bind Console <Command-q> {
- exit
- }
+ bind Console <Command-q> {
+ exit
}
bind Console <<Cut>> { ::tk::console::Cut %W }
bind Console <<Copy>> { ::tk::console::Copy %W }
@@ -740,9 +731,9 @@ proc ::tk::console::FontchooserToggle {} {
}
proc ::tk::console::FontchooserVisibility {index} {
if {[tk fontchooser configure -visible]} {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
} else {
- .menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
+ .menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
}
}
proc ::tk::console::FontchooserFocus {w isFocusIn} {
diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl
index 9146362..8b56639 100644
--- a/library/demos/bind.tcl
+++ b/library/demos/bind.tcl
@@ -67,12 +67,12 @@ foreach tag {d1 d2 d3 d4 d5 d6} {
$w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
}
# Main widget program sets variable tk_demoDirectory
-$w.text tag bind d1 <Button-1> {source [file join $tk_demoDirectory items.tcl]}
-$w.text tag bind d2 <Button-1> {source [file join $tk_demoDirectory plot.tcl]}
-$w.text tag bind d3 <Button-1> {source [file join $tk_demoDirectory ctext.tcl]}
-$w.text tag bind d4 <Button-1> {source [file join $tk_demoDirectory arrow.tcl]}
-$w.text tag bind d5 <Button-1> {source [file join $tk_demoDirectory ruler.tcl]}
-$w.text tag bind d6 <Button-1> {source [file join $tk_demoDirectory cscroll.tcl]}
+$w.text tag bind d1 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
+$w.text tag bind d2 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
+$w.text tag bind d3 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
+$w.text tag bind d4 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
+$w.text tag bind d5 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
+$w.text tag bind d6 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index c0c30ee..d210c7d 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -56,45 +56,61 @@ for {set i 0} {$i < 20} {incr i} {
$c bind all <Enter> "scrollEnter $c"
$c bind all <Leave> "scrollLeave $c"
$c bind all <Button-1> "scrollButton $c"
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
-if {[tk windowingsystem] eq "aqua"} {
+if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
bind $c <MouseWheel> {
- %W yview scroll [expr {-(%D)}] units
+ %W yview scroll [expr {-%D}] units
}
bind $c <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
+ %W yview scroll [expr {-10*%D}] units
}
bind $c <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D)}] units
+ %W xview scroll [expr {-%D}] units
}
bind $c <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
+ %W xview scroll [expr {-10*%D}] units
}
} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
# We must make sure that positive and negative movements are rounded
# equally to integers, avoiding the problem that
- # (int)1/30 = 0,
+ # (int)1/-30 = -1,
# but
- # (int)-1/30 = -1
+ # (int)-1/-30 = 0
# The following code ensure equal +/- behaviour.
bind $c <MouseWheel> {
if {%D >= 0} {
- %W yview scroll [expr {-%D/30}] units
+ %W yview scroll [expr {%D/-30}] units
} else {
- %W yview scroll [expr {(29-%D)/30}] units
+ %W yview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Option-MouseWheel> {
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-3}] units
+ } else {
+ %W yview scroll [expr {(%D-2)/-3}] units
}
}
bind $c <Shift-MouseWheel> {
if {%D >= 0} {
- %W xview scroll [expr {-%D/30}] units
+ %W xview scroll [expr {%D/-30}] units
} else {
- %W xview scroll [expr {(29-%D)/30}] units
+ %W xview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Shift-Option-MouseWheel> {
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-3}] units
+ } else {
+ %W xview scroll [expr {(%D-2)/-3}] units
}
}
}
-if {[tk windowingsystem] eq "x11"} {
+if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
@@ -119,18 +135,6 @@ if {[tk windowingsystem] eq "x11"} {
%W xview scroll 5 units
}
}
- if {[package vsatisfies [package provide Tk] 8.7]} {
- bind $c <Button-6> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
- }
- bind $c <Button-7> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
- }
- }
}
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 502c9d0..d3fec33 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -50,7 +50,11 @@ $c bind text <Return> "textInsert $c \\n"
$c bind text <Control-h> "textBs $c"
$c bind text <BackSpace> "textBs $c"
$c bind text <Delete> "textDel $c"
-$c bind text <Button-2> "textPaste $c @%x,%y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ $c bind text <Button-3> "textPaste $c @%x,%y"
+} else {
+ $c bind text <Button-2> "textPaste $c @%x,%y"
+}
# Next, create some items that allow the text's anchor position
# to be edited.
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl
index 976e955..66d8c9a 100644
--- a/library/demos/dialog1.tcl
+++ b/library/demos/dialog1.tcl
@@ -2,16 +2,16 @@
#
# This demonstration script creates a dialog box with a local grab.
-interp create slave
-load {} Tk slave
-slave eval {
- wm title . slave
+interp create child
+load {} Tk child
+child eval {
+ wm title . child
wm geometry . +700+30
pack [text .t -width 30 -height 10]
}
after idle {.dialog1.msg configure -wraplength 4i}
-set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \
+set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
info 0 OK Cancel {Show Code}]
switch $i {
@@ -20,6 +20,6 @@ switch $i {
2 {showCode .dialog1}
}
-if {[interp exists slave]} {
- interp delete slave
+if {[interp exists child]} {
+ interp delete child
}
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index d4435c6..acde1b3 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
proc validatePhoneChange {W vmode idx char} {
global phoneNumberMap entry3content
- if {$idx == -1} {return 1}
+ if {$idx < 0} {return 1}
after idle [list $W configure -validate $vmode -invcmd bell]
if {
!($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index b5d3c64..eb2ea7f 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -1359,8 +1359,13 @@ $c bind floor2 <Button-1> "floorDisplay $c 2"
$c bind floor3 <Button-1> "floorDisplay $c 3"
$c bind room <Enter> "newRoom $c"
$c bind room <Leave> {set currentRoom ""}
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+}
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
index 8b34377..446ed34 100644
--- a/library/demos/fontchoose.tcl
+++ b/library/demos/fontchoose.tcl
@@ -55,10 +55,6 @@ grid $f.msg $f.vs -sticky news
grid $f.font - -sticky e
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
-bind $w <Visibility> {
- bind %W <Visibility> {}
- grid propagate %W.f 0
-}
## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w]
@@ -67,3 +63,5 @@ grid $f -sticky news
grid $btns -sticky ew
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
+update idletasks
+grid propagate $f 0
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 1cc52c6..14ddb0b 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -113,9 +113,9 @@ proc DoDisplay {w} {
DoCtrlFrame $w
DoDetailFrame $w
if {[tk windowingsystem] ne "aqua"} {
- ttk::button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2
+ ttk::button $w.show -text "»" -command [list ShowCtrl $w] -width 2
} else {
- button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
+ button $w.show -text "»" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
}
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
update
@@ -204,10 +204,10 @@ proc DoDetailFrame {w} {
proc ShowCtrl {w} {
if {[winfo ismapped $w.ctrl]} {
pack forget $w.ctrl
- $w.show config -text "\u00bb"
+ $w.show config -text "»"
} else {
pack $w.ctrl -side right -fill both -ipady 5
- $w.show config -text "\u00ab"
+ $w.show config -text "»"
}
}
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index 1370560..1297046 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -17,7 +17,7 @@ wm iconname $w "Items"
positionWindow $w
set c $w.frame.c
-label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
+label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -173,10 +173,17 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
$c bind item <Enter> "itemEnter $c"
$c bind item <Leave> "itemLeave $c"
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
-bind $c <Button-3> "itemMark $c %x %y"
-bind $c <B3-Motion> "itemStroke $c %x %y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-2> "itemMark $c %x %y"
+ bind $c <B2-Motion> "itemStroke $c %x %y"
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+ bind $c <Button-3> "itemMark $c %x %y"
+ bind $c <B3-Motion> "itemStroke $c %x %y"
+}
bind $c <<NextChar>> "itemsUnderArea $c"
bind $c <Button-1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
@@ -250,14 +257,14 @@ proc itemsUnderArea {c} {
set area [$c find withtag area]
set items ""
foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
puts stdout "Items enclosed by area: $items"
set items ""
foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
diff --git a/library/demos/ixset b/library/demos/ixset
index b2b3252..85664d9 100644
--- a/library/demos/ixset
+++ b/library/demos/ixset
@@ -54,7 +54,7 @@ proc readsettings {} {
global screencyc ; set screencyc 600
set xfd [open "|xset q" r]
- while {[gets $xfd line] > -1} {
+ while {[gets $xfd line] >= 0} {
switch -- [lindex $line 0] {
auto {
set rpt [lindex $line 1]
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index b5cffa8..09ceff0 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Calculate a Knight's tour of a chessboard.
#
@@ -21,7 +21,7 @@
# If you let it repeat then it will choose random start positions
# for each new tour.
-package require Tk 8.5
+package require Tk
# Return a list of accessible squares from a given square
proc ValidMoves {square} {
@@ -29,7 +29,7 @@ proc ValidMoves {square} {
foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
set col [expr {($square % 8) + [lindex $pair 0]}]
set row [expr {($square / 8) + [lindex $pair 1]}]
- if {$row > -1 && $row < 8 && $col > -1 && $col < 8} {
+ if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
lappend moves [expr {$row * 8 + $col}]
}
}
@@ -41,7 +41,7 @@ proc CheckSquare {square} {
variable visited
set moves 0
foreach test [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $test] == -1} {
+ if {[lsearch -exact -integer $visited $test] < 0} {
incr moves
}
}
@@ -55,7 +55,7 @@ proc Next {square} {
set minimum 9
set nextSquare -1
foreach testSquare [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $testSquare] == -1} {
+ if {[lsearch -exact -integer $visited $testSquare] < 0} {
set count [CheckSquare $testSquare]
if {$count < $minimum} {
set minimum $count
@@ -190,7 +190,7 @@ proc CreateGUI {} {
ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
set square 0
- for {set row 7} {$row != -1} {incr row -1} {
+ for {set row 7} {$row >= 0} {incr row -1} {
for {set col 0} {$col < 8} {incr col} {
if {(($col & 1) ^ ($row & 1))} {
set fill tan3 ; set dfill tan4
@@ -205,10 +205,10 @@ proc CreateGUI {} {
}
if {[tk windowingsystem] ne "x11"} {
catch {eval font create KnightFont -size -24}
- $c create text 0 0 -font KnightFont -text "\u265e" \
+ $c create text 0 0 -font KnightFont -text "♞" \
-anchor nw -tags knight -fill black -activefill "#600000"
} else {
- # On X11 we cannot reliably tell if the \u265e glyph is available
+ # On X11 we cannot reliably tell if the ♞ glyph is available
# so just use a polygon
set pts {
2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index abe70a3..a76bd54 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -63,7 +63,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
foreach i {A B C D E F} {
$m add command -label "Print letter \"$i\"" -underline 14 \
- -accelerator Meta+$i -command "puts $i" -accelerator $modifier+$i
+ -accelerator $modifier+$i -command "puts $i"
bind $w <$modifier-[string tolower $i]> "puts $i"
}
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 9833e8f..04f276b 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -50,8 +50,8 @@ for {set i 90} {$i>=0} {incr i -10} {
$w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
}
-$w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
-$w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
+$w.k create text 0 0 -anchor ne -text "θ" -tags label_theta
+$w.k create text 0 0 -anchor ne -text "δθ" -tags label_dtheta
pack $w.k -in $w.p.l2 -fill both -expand true
# Initialize some variables
diff --git a/library/demos/tclIndex b/library/demos/tclIndex
index 86a72e2..cdb2f2c 100644
--- a/library/demos/tclIndex
+++ b/library/demos/tclIndex
@@ -6,62 +6,62 @@
# element name is the name of a command and the value is
# a script that loads the command.
-set auto_index(arrowSetup) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove1) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove2) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove3) [list source [file join $dir arrow.tcl]]
-set auto_index(textLoadFile) [list source [file join $dir search.tcl]]
-set auto_index(textSearch) [list source [file join $dir search.tcl]]
-set auto_index(textToggle) [list source [file join $dir search.tcl]]
-set auto_index(itemEnter) [list source [file join $dir items.tcl]]
-set auto_index(itemLeave) [list source [file join $dir items.tcl]]
-set auto_index(itemMark) [list source [file join $dir items.tcl]]
-set auto_index(itemStroke) [list source [file join $dir items.tcl]]
-set auto_index(itemsUnderArea) [list source [file join $dir items.tcl]]
-set auto_index(itemStartDrag) [list source [file join $dir items.tcl]]
-set auto_index(itemDrag) [list source [file join $dir items.tcl]]
-set auto_index(butPress) [list source [file join $dir items.tcl]]
-set auto_index(loadDir) [list source [file join $dir image2.tcl]]
-set auto_index(loadImage) [list source [file join $dir image2.tcl]]
-set auto_index(rulerMkTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerNewTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerSelectTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerMoveTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerReleaseTab) [list source [file join $dir ruler.tcl]]
-set auto_index(mkTextConfig) [list source [file join $dir ctext.tcl]]
-set auto_index(textEnter) [list source [file join $dir ctext.tcl]]
-set auto_index(textInsert) [list source [file join $dir ctext.tcl]]
-set auto_index(textPaste) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Press) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Move) [list source [file join $dir ctext.tcl]]
-set auto_index(textBs) [list source [file join $dir ctext.tcl]]
-set auto_index(textDel) [list source [file join $dir ctext.tcl]]
-set auto_index(bitmapRow) [list source [file join $dir bitmap.tcl]]
-set auto_index(scrollEnter) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollLeave) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollButton) [list source [file join $dir cscroll.tcl]]
-set auto_index(textWindOn) [list source [file join $dir twind.tcl]]
-set auto_index(textWindOff) [list source [file join $dir twind.tcl]]
-set auto_index(textWindPlot) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotDown) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotMove) [list source [file join $dir twind.tcl]]
-set auto_index(textWindDel) [list source [file join $dir twind.tcl]]
-set auto_index(embDefBg) [list source [file join $dir twind.tcl]]
-set auto_index(floorDisplay) [list source [file join $dir floor.tcl]]
-set auto_index(newRoom) [list source [file join $dir floor.tcl]]
-set auto_index(roomChanged) [list source [file join $dir floor.tcl]]
-set auto_index(bg1) [list source [file join $dir floor.tcl]]
-set auto_index(bg2) [list source [file join $dir floor.tcl]]
-set auto_index(bg3) [list source [file join $dir floor.tcl]]
-set auto_index(fg1) [list source [file join $dir floor.tcl]]
-set auto_index(fg2) [list source [file join $dir floor.tcl]]
-set auto_index(fg3) [list source [file join $dir floor.tcl]]
-set auto_index(setWidth) [list source [file join $dir hscale.tcl]]
-set auto_index(plotDown) [list source [file join $dir plot.tcl]]
-set auto_index(plotMove) [list source [file join $dir plot.tcl]]
-set auto_index(puzzleSwitch) [list source [file join $dir puzzle.tcl]]
-set auto_index(setHeight) [list source [file join $dir vscale.tcl]]
-set auto_index(showMessageBox) [list source [file join $dir msgbox.tcl]]
-set auto_index(setColor) [list source [file join $dir clrpick.tcl]]
-set auto_index(setColor_helper) [list source [file join $dir clrpick.tcl]]
-set auto_index(fileDialog) [list source [file join $dir filebox.tcl]]
+set auto_index(arrowSetup) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove1) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove2) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove3) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(textLoadFile) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textSearch) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textToggle) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(itemEnter) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemLeave) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemMark) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStroke) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemsUnderArea) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStartDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(butPress) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(loadDir) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(loadImage) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(rulerMkTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerNewTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerSelectTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerMoveTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerReleaseTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(mkTextConfig) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textEnter) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textInsert) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textPaste) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Press) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Move) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textBs) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textDel) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(bitmapRow) [list source -encoding utf-8 [file join $dir bitmap.tcl]]
+set auto_index(scrollEnter) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollLeave) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollButton) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(textWindOn) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindOff) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindPlot) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotDown) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotMove) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindDel) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embDefBg) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(floorDisplay) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(newRoom) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(roomChanged) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(setWidth) [list source -encoding utf-8 [file join $dir hscale.tcl]]
+set auto_index(plotDown) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]]
+set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]]
+set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]]
+set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]]
diff --git a/library/demos/tcolor b/library/demos/tcolor
index 64e1a53..0aa133b 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
-package require Tk 8.4
+package require Tk
wm title . "Color Editor"
# Global variables that control the program:
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
index cb2a495..a53e390 100644
--- a/library/demos/toolbar.tcl
+++ b/library/demos/toolbar.tcl
@@ -17,7 +17,7 @@ positionWindow $w
ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
a toolbar that is styled correctly and which can be torn off. The\
- buttons are configured to be \u201Ctoolbar style\u201D buttons by\
+ buttons are configured to be “toolbar style” buttons by\
telling them that they are to use the Toolbutton style. At the left\
end of the toolbar is a simple marker that the cursor changes to a\
movement icon over; drag that away from the toolbar to tear off the\
diff --git a/library/demos/ttkbut.tcl b/library/demos/ttkbut.tcl
index ab49cf4..f6d94ac 100644
--- a/library/demos/ttkbut.tcl
+++ b/library/demos/ttkbut.tcl
@@ -17,7 +17,7 @@ wm title $w "Simple Ttk Widgets"
wm iconname $w "ttkbut"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the \u201cEnabled\u201d button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the “Enabled” button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
pack $w.msg -side top -fill x
## See Code / Dismiss
diff --git a/library/demos/ttkprogress.tcl b/library/demos/ttkprogress.tcl
index 8a72cf9..29ac508 100644
--- a/library/demos/ttkprogress.tcl
+++ b/library/demos/ttkprogress.tcl
@@ -15,7 +15,7 @@ wm title $w "Progress Bar Demonstration"
wm iconname $w "ttkprogress"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a “determinate” progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an “indeterminate” progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
pack $w.msg -side top -fill x
## See Code / Dismiss buttons
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index ca325a4..1ecc064 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -21,9 +21,7 @@ label $w.msg -font $font -wraplength 4i -anchor w -justify left \
non-Western character sets. However, what you will actually see\
below depends largely on what character sets you have installed,\
and what you see for characters that are not present varies greatly\
- between platforms as well. The strings are written in Tcl using\
- UNICODE characters using the \\uXXXX (or \\UXXXXXX) escape so as to\
- do so in a portable fashion."
+ between platforms as well."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -98,47 +96,29 @@ update
## Add the samples...
if {[usePresentationFormsFor Arabic]} {
# Using presentation forms (pre-layouted)
- addSample $w Arabic \
- "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
- "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+ addSample $w Arabic "ﺔﻴﺑﺮﻌﻟﺍ ﺔﻤﻠﻜﻟﺍ"
} else {
# Using standard text characters
- addSample $w Arabic \
- "\u0627\u0644\u0643\u0644\u0645\u0629 " \
- "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
+ addSample $w Arabic "الكلمة العربية"
}
-addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
-addSample $w "Simpl. Chinese" "\u6C49\u8BED"
-addSample $w French "Langue fran\xE7aise"
-addSample $w Greek \
- "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
- "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
+addSample $w "Trad. Chinese" "中國的漢字"
+addSample $w "Simpl. Chinese" "汉语"
+addSample $w French "Langue française"
+addSample $w Greek "Ελληνική γλώσσα"
if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
- addSample $w Hebrew \
- "\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
+ addSample $w Hebrew "תירבע בתכ"
} else {
# Standard logical order
- addSample $w Hebrew \
- "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
+ addSample $w Hebrew "כתב עברית"
}
-addSample $w Hindi \
- "\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E"
-addSample $w Icelandic "\xCDslenska"
-addSample $w Japanese \
- "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
- "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
-addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
-addSample $w Russian \
- "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
+addSample $w Hindi "हिन्दी भाषा"
+addSample $w Icelandic "Íslenska"
+addSample $w Japanese "日本語のひらがな, 漢字とカタカナ"
+addSample $w Korean "대한민국의 한글"
+addSample $w Russian "Русский язык"
if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} {
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- addSample $w Emoji \
- "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1"
- } else {
- addSample $w Emoji \
- "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
- }
+ addSample $w Emoji "😀💩👍🇳🇱"
}
## We're done processing, so change things back to normal running...
diff --git a/library/demos/widget b/library/demos/widget
index e543846..4f7f715 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -516,7 +516,7 @@ proc invoke index {
.t configure -cursor [::ttk::cursor busy]
update
set demo [string range [lindex $tags $i] 5 end]
- uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
+ uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]]
update
.t configure -cursor $cursor
@@ -624,6 +624,7 @@ proc showCode w {
wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
wm iconname $top $file
set id [open [file join $tk_demoDirectory $file]]
+ fconfigure $id -encoding utf-8 -eofchar \032
$top.f.text delete 1.0 end
$top.f.text insert 1.0 [read $id]
$top.f.text mark set insert 1.0
@@ -722,10 +723,10 @@ proc PrintTextWin32 {filename} {
proc tkAboutDialog {} {
tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
-message [mc "Tk widget demonstration application"] -detail \
-"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}]
-[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}]
-[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}]
-[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]"
+"[mc "Copyright © %s" {1996-1997 Sun Microsystems, Inc.}]
+[mc "Copyright © %s" {1997-2000 Ajuba Solutions, Inc.}]
+[mc "Copyright © %s" {2001-2009 Donal K. Fellows}]
+[mc "Copyright © %s" {2002-2007 Daniel A. Steffen}]"
}
# Local Variables:
diff --git a/library/dialog.tcl b/library/dialog.tcl
index a099d90..ffbd8e4 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -3,8 +3,8 @@
# This file defines the procedure tk_dialog, which creates a dialog
# box containing a bitmap, a message, and one or more buttons.
#
-# Copyright (c) 1992-1993 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1992-1993 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/entry.tcl b/library/entry.tcl
index 7a5ef2b..3652ebe 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk entry widgets and provides
# procedures that help in implementing those bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -58,7 +58,7 @@ bind Entry <<Paste>> {
}
bind Entry <<Clear>> {
# ignore if there is no selection
- catch { %W delete sel.first sel.last }
+ catch {%W delete sel.first sel.last}
}
bind Entry <<PasteSelection>> {
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
@@ -209,9 +209,7 @@ bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
bind Entry <Prior> {# nothing}
bind Entry <Next> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Entry <Command-Key> {# nothing}
-}
+bind Entry <Command-Key> {# nothing}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind Entry <<NextLine>> {# nothing}
bind Entry <<PrevLine>> {# nothing}
@@ -278,7 +276,7 @@ bind Entry <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind Entry <<TkEndIMEMarkedText>> {
- if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
+ if {[catch {dict get $::tk::Priv(IMETextMark) "%W"} mark]} {
bell
} else {
%W selection range $mark insert
@@ -293,28 +291,15 @@ bind Entry <<TkAccentBackspace>> {
# A few additional bindings of my own.
-if {[tk windowingsystem] ne "aqua"} {
- bind Entry <Button-2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
- }
- bind Entry <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
- }
-} else {
- bind Entry <Button-3> {
- if {!$tk_strictMotif} {
+bind Entry <Button-2> {
+ if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
- }
}
- bind Entry <B3-Motion> {
- if {!$tk_strictMotif} {
+}
+bind Entry <B2-Motion> {
+ if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
- }
- }
+ }
}
# ::tk::EntryClosestGap --
@@ -391,10 +376,10 @@ proc ::tk::EntryMouseSelect {w x} {
word {
if {$cur < $anchor} {
set before [tcl_wordBreakBefore [$w get] $cur]
- set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
+ set after [tcl_wordBreakAfter [$w get] $anchor-1]
} elseif {$cur > $anchor} {
set before [tcl_wordBreakBefore [$w get] $anchor]
- set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
+ set after [tcl_wordBreakAfter [$w get] $cur-1]
} else {
if {[$w index @$Priv(pressX)] < $anchor} {
incr anchor -1
@@ -520,7 +505,8 @@ proc ::tk::EntryBackspace w {
} else {
set x [expr {[$w index insert] - 1}]
if {$x >= 0} {
- $w delete [::tk::startOfGlyphCluster [$w get] $x] [::tk::endOfGlyphCluster [$w get] $x]
+ $w delete [::tk::startOfGlyphCluster [$w get] $x] \
+ [::tk::endOfGlyphCluster [$w get] $x]
}
if {[$w index @0] >= [$w index insert]} {
set range [$w xview]
@@ -575,12 +561,12 @@ proc ::tk::EntryTranspose w {
if {$i < [$w index end]} {
incr i
}
- set first [expr {$i-2}]
- if {$first < 0} {
+ if {$i < 2} {
return
}
+ set first [expr {$i-2}]
set data [$w get]
- set new [string index $data [expr {$i-1}]][string index $data $first]
+ set new [string index $data $i-1][string index $data $first]
$w delete $first $i
$w insert insert $new
EntrySeeInsert $w
@@ -685,7 +671,7 @@ proc ::tk::EntryScanMark {w x} {
proc ::tk::EntryScanDrag {w x} {
# Make sure these exist, as some weird situations can trigger the
# motion binding without the initial press. [Bug #220269]
- if {![info exists ::tk::Priv(x)]} { set ::tk::Priv(x) $x }
+ if {![info exists ::tk::Priv(x)]} {set ::tk::Priv(x) $x}
# allow for a delta
if {abs($x-$::tk::Priv(x)) > 2} {
set ::tk::Priv(mouseMoved) 1
@@ -702,19 +688,10 @@ proc ::tk::EntryScanDrag {w x} {
proc ::tk::EntryGetSelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
if {[$w cget -show] ne ""} {
return [string repeat [string index [$w cget -show] 0] \
[string length $entryString]]
}
return $entryString
}
-
-
-
-
-
-
-
-
-
diff --git a/library/focus.tcl b/library/focus.tcl
index 640406e..2cf5ad7 100644
--- a/library/focus.tcl
+++ b/library/focus.tcl
@@ -3,7 +3,7 @@
# This file defines several procedures for managing the input
# focus.
#
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl
index 5395acb..9d49c57 100644
--- a/library/fontchooser.tcl
+++ b/library/fontchooser.tcl
@@ -14,11 +14,11 @@ namespace eval ::tk::fontchooser {
set S(W) .__tk__fontchooser
set S(fonts) [lsort -dictionary [font families]]
set S(styles) [list \
- [::msgcat::mc "Regular"] \
- [::msgcat::mc "Italic"] \
- [::msgcat::mc "Bold"] \
- [::msgcat::mc "Bold Italic"] \
- ]
+ [::msgcat::mc "Regular"] \
+ [::msgcat::mc "Italic"] \
+ [::msgcat::mc "Bold"] \
+ [::msgcat::mc "Bold Italic"] \
+ ]
set S(sizes) {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72}
set S(strike) 0
@@ -36,9 +36,9 @@ proc ::tk::fontchooser::Setup {} {
# Canonical versions of font families, styles, etc. for easier searching
set S(fonts,lcase) {}
- foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]}
+ foreach font $S(fonts) {lappend S(fonts,lcase) [string tolower $font]}
set S(styles,lcase) {}
- foreach style $S(styles) { lappend S(styles,lcase) [string tolower $style]}
+ foreach style $S(styles) {lappend S(styles,lcase) [string tolower $style]}
set S(sizes,lcase) $S(sizes)
::ttk::style layout FontchooserFrame {
@@ -111,7 +111,7 @@ proc ::tk::fontchooser::Configure {args} {
set cache [dict create -parent $S(-parent) -title $S(-title) \
-font $S(-font) -command $S(-command)]
- set r [tclParseConfigSpec [namespace which -variable S] $specs "" $args]
+ set r [tclParseConfigSpec [namespace which -variable S] $specs DONTSETDEFAULTS $args]
if {![winfo exists $S(-parent)]} {
set code [list TK LOOKUP WINDOW $S(-parent)]
set err "bad window path name \"$S(-parent)\""
@@ -121,7 +121,7 @@ proc ::tk::fontchooser::Configure {args} {
if {[string trim $S(-title)] eq ""} {
set S(-title) [::msgcat::mc "Font"]
}
- if {[winfo exists $S(W)] && [lsearch $args -font] != -1} {
+ if {[winfo exists $S(W)] && ("-font" in $args)} {
Init $S(-font)
event generate $S(-parent) <<TkFontchooserFontChanged>>
}
@@ -145,10 +145,13 @@ proc ::tk::fontchooser::Create {} {
wm title $S(W) $S(-title)
wm transient $S(W) [winfo toplevel $S(-parent)]
+ set scaling [tk scaling]
+ set sizeWidth [expr {int([string length [::msgcat::mc "&Size:"]] * $scaling)}]
+
set outer [::ttk::frame $S(W).outer -padding {10 10}]
::tk::AmpWidget ::ttk::label $S(W).font -text [::msgcat::mc "&Font:"]
::tk::AmpWidget ::ttk::label $S(W).style -text [::msgcat::mc "Font st&yle:"]
- ::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"]
+ ::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"] -width $sizeWidth
ttk::entry $S(W).efont -width 18 \
-textvariable [namespace which -variable S](font)
ttk::entry $S(W).estyle -width 10 \
@@ -199,7 +202,7 @@ proc ::tk::fontchooser::Create {} {
set minsize(sizes) \
[expr {[font measure TkDefaultFont "-99"] + $scroll_width}]
set min [expr {$minsize(gap) * 4}]
- foreach {what width} [array get minsize] { incr min $width }
+ foreach {what width} [array get minsize] {incr min $width}
wm minsize $S(W) $min 260
bind $S(W) <Return> [namespace code [list Done 1]]
@@ -277,7 +280,7 @@ proc ::tk::fontchooser::Create {} {
# Arguments:
# ok true if user pressed OK
#
-proc ::tk::::fontchooser::Done {ok} {
+proc ::tk::fontchooser::Done {ok} {
variable S
if {! $ok} {
@@ -327,13 +330,13 @@ proc ::tk::fontchooser::Init {{defaultFont ""}} {
set S(size) $F(-size)
set S(strike) $F(-overstrike)
set S(under) $F(-underline)
- set S(style) "Regular"
+ set S(style) [::msgcat::mc "Regular"]
if {$F(-weight) eq "bold" && $F(-slant) eq "italic"} {
- set S(style) "Bold Italic"
+ set S(style) [::msgcat::mc "Bold Italic"]
} elseif {$F(-weight) eq "bold"} {
- set S(style) "Bold"
+ set S(style) [::msgcat::mc "Bold"]
} elseif {$F(-slant) eq "italic"} {
- set S(style) "Italic"
+ set S(style) [::msgcat::mc "Italic"]
}
set S(first) 0
@@ -381,7 +384,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} {
$S(W).l${var}s selection clear 0 end
set n [lsearch -exact $S(${var}s,lcase) $value]
$S(W).l${var}s selection set $n
- if {$n != -1} {
+ if {$n >= 0} {
set S($var) [lindex $S(${var}s) $n]
$S(W).e$var icursor end
$S(W).e$var selection clear
@@ -396,7 +399,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} {
}
$S(W).l${var}s see $n
}
- if {!$bad} { Update }
+ if {!$bad} {Update}
$S(W).ok configure -state $nstate
}
@@ -408,11 +411,11 @@ proc ::tk::fontchooser::Update {} {
variable S
set S(result) [list $S(font) $S(size)]
- if {$S(style) eq "Bold"} { lappend S(result) bold }
- if {$S(style) eq "Italic"} { lappend S(result) italic }
- if {$S(style) eq "Bold Italic"} { lappend S(result) bold italic}
- if {$S(strike)} { lappend S(result) overstrike}
- if {$S(under)} { lappend S(result) underline}
+ if {$S(style) eq [::msgcat::mc "Bold"]} {lappend S(result) bold}
+ if {$S(style) eq [::msgcat::mc "Italic"]} {lappend S(result) italic}
+ if {$S(style) eq [::msgcat::mc "Bold Italic"]} {lappend S(result) bold italic}
+ if {$S(strike)} {lappend S(result) overstrike}
+ if {$S(under)} {lappend S(result) underline}
$S(sample) configure -font $S(result)
}
diff --git a/library/iconlist.tcl b/library/iconlist.tcl
index 35b40b6..0dddebc 100644
--- a/library/iconlist.tcl
+++ b/library/iconlist.tcl
@@ -3,8 +3,8 @@
# Implements the icon-list megawidget used in the "Tk" standard file
# selection dialog boxes.
#
-# Copyright (c) 1994-1998 Sun Microsystems, Inc.
-# Copyright (c) 2009 Donal K. Fellows
+# Copyright © 1994-1998 Sun Microsystems, Inc.
+# Copyright © 2009 Donal K. Fellows
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -26,7 +26,7 @@
# <path> selection includes <item>
# <path> selection set <first> ?<last>?
-package require Tk 8.6
+package require Tk
::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget {
variable w canvas sbar accel accelCB fill font index \
@@ -446,18 +446,9 @@ package require Tk 8.6
bind $canvas <Control-B1-Motion> {;}
bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}]
- if {[tk windowingsystem] eq "aqua"} {
- bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel [expr {40 * (%D)}]}]
- bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel [expr {400 * (%D)}]}]
- } else {
- bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %D}]
- }
- if {[tk windowingsystem] eq "x11"} {
- bind $canvas <Shift-Button-4> [namespace code {my MouseWheel 120}]
- bind $canvas <Shift-Button-5> [namespace code {my MouseWheel -120}]
- bind $canvas <Button-6> [namespace code {my MouseWheel 120}]
- bind $canvas <Button-7> [namespace code {my MouseWheel -120}]
- }
+ bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %D}]
+ bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel %D -12}]
+
bind $canvas <<PrevLine>> [namespace code {my UpDown -1}]
bind $canvas <<NextLine>> [namespace code {my UpDown 1}]
@@ -505,21 +496,11 @@ package require Tk 8.6
# ----------------------------------------------------------------------
# Event handlers
- method MouseWheel {amount} {
+ method MouseWheel {amount {factor -120.0}} {
if {$noScroll || $::tk_strictMotif} {
return
}
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/120 = 0,
- # but
- # (int)-1/120 = -1
- # The following code ensure equal +/- behaviour.
- if {$amount > 0} {
- $canvas xview scroll [expr {(-119-$amount) / 120}] units
- } else {
- $canvas xview scroll [expr {-($amount / 120)}] units
- }
+ $canvas xview scroll [expr {$amount/$factor}] units
}
method Btn1 {x y} {
focus $canvas
@@ -705,7 +686,7 @@ package require Tk 8.6
}
}
- if {$theIndex > -1} {
+ if {$theIndex >= 0} {
$w selection clear 0 end
$w selection set $theIndex
$w selection anchor $theIndex
diff --git a/library/icons.tcl b/library/icons.tcl
index e53a1bd..d98e461 100644
--- a/library/icons.tcl
+++ b/library/icons.tcl
@@ -8,7 +8,7 @@
#
# See http://tango.freedesktop.org/Tango_Desktop_Project
#
-# Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
namespace eval ::tk::icons {}
diff --git a/library/listbox.tcl b/library/listbox.tcl
index b653199..9038890 100644
--- a/library/listbox.tcl
+++ b/library/listbox.tcl
@@ -3,9 +3,9 @@
# This file defines the default bindings for Tk listbox widgets
# and provides procedures that help in implementing those bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -176,81 +176,17 @@ bind Listbox <B2-Motion> {
%W scan dragto %x %y
}
-# The MouseWheel will typically only fire on Windows and Mac OS X.
-# However, someone could use the "event generate" command to produce
-# one on other platforms.
-
-if {[tk windowingsystem] eq "aqua"} {
- bind Listbox <MouseWheel> {
- %W yview scroll [expr {-(%D)}] units
- }
- bind Listbox <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
- }
- bind Listbox <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D)}] units
- }
- bind Listbox <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
- }
-} else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/30 = 0,
- # but
- # (int)-1/30 = -1
- # The following code ensure equal +/- behaviour.
- bind Listbox <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {-%D/30}] units
- } else {
- %W yview scroll [expr {(29-%D)/30}] units
- }
- }
- bind Listbox <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {-%D/30}] units
- } else {
- %W xview scroll [expr {(29-%D)/30}] units
- }
- }
+bind Listbox <MouseWheel> {
+ tk::MouseWheel %W y %D -30.0
}
-
-if {[tk windowingsystem] eq "x11"} {
- # Support for mousewheels on Linux/Unix commonly comes through mapping
- # the wheel to the extended buttons. If you have a mousewheel, find
- # Linux configuration info at:
- # http://linuxreviews.org/howtos/xfree/mouse/
- bind Listbox <Button-4> {
- if {!$tk_strictMotif} {
- %W yview scroll -5 units
- }
- }
- bind Listbox <Shift-Button-4> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
- }
- bind Listbox <Button-5> {
- if {!$tk_strictMotif} {
- %W yview scroll 5 units
- }
- }
- bind Listbox <Shift-Button-5> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
- }
- bind Listbox <Button-6> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
- }
- bind Listbox <Button-7> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
- }
+bind Listbox <Option-MouseWheel> {
+ tk::MouseWheel %W y %D -3.0
+}
+bind Listbox <Shift-MouseWheel> {
+ tk::MouseWheel %W x %D -30.0
+}
+bind Listbox <Shift-Option-MouseWheel> {
+ tk::MouseWheel %W x %D -3.0
}
# ::tk::ListboxBeginSelect --
@@ -327,13 +263,13 @@ proc ::tk::ListboxMotion {w el} {
set Priv(listboxSelection) [$w curselection]
}
while {($i < $el) && ($i < $anchor)} {
- if {[lsearch $Priv(listboxSelection) $i] >= 0} {
+ if {$i in $Priv(listboxSelection)} {
$w selection set $i
}
incr i
}
while {($i > $el) && ($i > $anchor)} {
- if {[lsearch $Priv(listboxSelection) $i] >= 0} {
+ if {$i in $Priv(listboxSelection)} {
$w selection set $i
}
incr i -1
@@ -533,7 +469,7 @@ proc ::tk::ListboxCancel w {
}
$w selection clear $first $last
while {$first <= $last} {
- if {[lsearch $Priv(listboxSelection) $first] >= 0} {
+ if {$first in $Priv(listboxSelection)} {
$w selection set $first
}
incr first
diff --git a/library/megawidget.tcl b/library/megawidget.tcl
index aeb1263..c09d0da 100644
--- a/library/megawidget.tcl
+++ b/library/megawidget.tcl
@@ -4,13 +4,13 @@
# the ::tk::IconList megawdget, which is itself only designed for use in
# the Unix file dialogs.
#
-# Copyright (c) 2009-2010 Donal K. Fellows
+# Copyright © 2009-2010 Donal K. Fellows
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-package require Tk 8.6
+package require Tk
::oo::class create ::tk::Megawidget {
superclass ::oo::class
diff --git a/library/menu.tcl b/library/menu.tcl
index f1207dc..6728131 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,10 +4,10 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 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.
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 646c143..b401ad1 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -3,7 +3,7 @@
# Implements messageboxes for platforms that do not have native
# messagebox support.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/msgs/da.msg b/library/msgs/da.msg
index c302c79..282f919 100644
--- a/library/msgs/da.msg
+++ b/library/msgs/da.msg
@@ -3,11 +3,11 @@ namespace eval ::tk {
::msgcat::mcset da "&About..." "&Om..."
::msgcat::mcset da "All Files" "Alle filer"
::msgcat::mcset da "Application Error" "Programfejl"
- ::msgcat::mcset da "&Blue" "&Bl\u00E5"
+ ::msgcat::mcset da "&Blue" "&Blå"
::msgcat::mcset da "Cancel" "Annuller"
::msgcat::mcset da "&Cancel" "&Annuller"
::msgcat::mcset da "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ikke skifte til katalog \"%1\$s\".\nIngen rettigheder."
- ::msgcat::mcset da "Choose Directory" "V\u00E6lg katalog"
+ ::msgcat::mcset da "Choose Directory" "Vælg katalog"
::msgcat::mcset da "Cl&ear" "&Ryd"
::msgcat::mcset da "&Clear Console" "&Ryd konsolen"
::msgcat::mcset da "Color" "Farve"
@@ -31,8 +31,8 @@ namespace eval ::tk {
::msgcat::mcset da "Fi&les:" "Fi&ler:"
::msgcat::mcset da "&Filter"
::msgcat::mcset da "Fil&ter:"
- ::msgcat::mcset da "&Green" "&Gr\u00F8n"
- ::msgcat::mcset da "&Help" "&Hj\u00E6lp"
+ ::msgcat::mcset da "&Green" "&Grøn"
+ ::msgcat::mcset da "&Help" "&Hjælp"
::msgcat::mcset da "Hi" "Hej"
::msgcat::mcset da "&Hide Console" "Skjul &konsol"
::msgcat::mcset da "&Ignore" "&Ignorer"
@@ -42,37 +42,37 @@ namespace eval ::tk {
::msgcat::mcset da "&OK" "&O.K."
::msgcat::mcset da "OK" "O.K."
::msgcat::mcset da "Ok"
- ::msgcat::mcset da "Open" "\u00C5bn"
- ::msgcat::mcset da "&Open" "&\u00C5bn"
- ::msgcat::mcset da "Open Multiple Files" "\u00C5bn flere filer"
- ::msgcat::mcset da "P&aste" "&Inds\u00E6t"
+ ::msgcat::mcset da "Open" "Åbn"
+ ::msgcat::mcset da "&Open" "&Åbn"
+ ::msgcat::mcset da "Open Multiple Files" "Åbn flere filer"
+ ::msgcat::mcset da "P&aste" "&Indsæt"
::msgcat::mcset da "&Quit" "&Afslut"
- ::msgcat::mcset da "&Red" "&R\u00F8d"
+ ::msgcat::mcset da "&Red" "&Rød"
::msgcat::mcset da "Replace existing file?" "Erstat eksisterende fil?"
::msgcat::mcset da "&Retry" "&Gentag"
::msgcat::mcset da "&Save" "&Gem"
::msgcat::mcset da "Save As" "Gem som"
::msgcat::mcset da "Save To Log" "Gem i log"
- ::msgcat::mcset da "Select Log File" "V\u00E6lg logfil"
- ::msgcat::mcset da "Select a file to source" "V\u00E6lg k\u00F8rbar fil"
+ ::msgcat::mcset da "Select Log File" "Vælg logfil"
+ ::msgcat::mcset da "Select a file to source" "Vælg kørbar fil"
::msgcat::mcset da "&Selection:" "&Udvalg:"
::msgcat::mcset da "Show &Hidden Directories" "Vis &skjulte kataloger"
::msgcat::mcset da "Show &Hidden Files and Directories" "Vis &skjulte filer og kataloger"
::msgcat::mcset da "Skip Messages" "Overspring beskeder"
- ::msgcat::mcset da "&Source..." "&K\u00F8r..."
+ ::msgcat::mcset da "&Source..." "&Kør..."
::msgcat::mcset da "Tcl Scripts" "Tcl-Skripter"
::msgcat::mcset da "Tcl for Windows" "Tcl for Windows"
::msgcat::mcset da "Text Files" "Tekstfiler"
::msgcat::mcset da "&Yes" "&Ja"
::msgcat::mcset da "abort" "afbryd"
- ::msgcat::mcset da "blue" "bl\u00E5"
+ ::msgcat::mcset da "blue" "blå"
::msgcat::mcset da "cancel" "afbryd"
::msgcat::mcset da "extension"
::msgcat::mcset da "extensions"
- ::msgcat::mcset da "green" "gr\u00F8n"
+ ::msgcat::mcset da "green" "grøn"
::msgcat::mcset da "ignore" "ignorer"
::msgcat::mcset da "ok"
- ::msgcat::mcset da "red" "r\u00F8d"
+ ::msgcat::mcset da "red" "rød"
::msgcat::mcset da "retry" "gentag"
::msgcat::mcset da "yes" "ja"
}
diff --git a/library/msgs/de.msg b/library/msgs/de.msg
index 6dee507..2cf25d2 100644
--- a/library/msgs/de.msg
+++ b/library/msgs/de.msg
@@ -52,7 +52,7 @@ namespace eval ::tk {
::msgcat::mcset de "Ok"
::msgcat::mcset de "Open" "Öffnen"
::msgcat::mcset de "&Open" "Ö&ffnen"
- ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen"
+ ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien Öffnen"
::msgcat::mcset de "P&aste" "E&infügen"
::msgcat::mcset de "&Quit" "&Beenden"
::msgcat::mcset de "&Red" "&Rot"
diff --git a/library/obsolete.tcl b/library/obsolete.tcl
index e66c48d..a31884d 100644
--- a/library/obsolete.tcl
+++ b/library/obsolete.tcl
@@ -3,8 +3,8 @@
# This file contains obsolete procedures that people really shouldn't
# be using anymore, but which are kept around for backward compatibility.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/optMenu.tcl b/library/optMenu.tcl
index 7cfdaa0..4beb3c7 100644
--- a/library/optMenu.tcl
+++ b/library/optMenu.tcl
@@ -3,8 +3,8 @@
# This file defines the procedure tk_optionMenu, which creates
# an option button and its associated menu.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/palette.tcl b/library/palette.tcl
index 42c6a90..e658067 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -3,7 +3,7 @@
# This file contains procedures that change the color palette used
# by Tk.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1995-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/library/safetk.tcl b/library/safetk.tcl
index 9f8e25d..0eb1220 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -2,7 +2,7 @@
#
# Support procs to use Tk in safe interpreters.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
+# Copyright © 1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,9 +14,9 @@
# Note: It is now ok to let untrusted code being executed
# between the creation of the interp and the actual loading
# of Tk in that interp because the C side Tk_Init will
-# now look up the master interp and ask its safe::TkInit
+# now look up the parent interp and ask its safe::TkInit
# for the actual parameters to use for it's initialization (if allowed),
-# not relying on the slave state.
+# not relying on the child state.
#
# We use opt (optional arguments parsing)
@@ -29,31 +29,31 @@ namespace eval ::safe {
}
#
-# tkInterpInit : prepare the slave interpreter for tk loading
+# tkInterpInit : prepare the child interpreter for tk loading
# most of the real job is done by loadTk
-# returns the slave name (tkInterpInit does)
+# returns the child name (tkInterpInit does)
#
-proc ::safe::tkInterpInit {slave argv} {
+proc ::safe::tkInterpInit {child argv} {
global env tk_library
# We have to make sure that the tk_library variable is normalized.
set tk_library [file normalize $tk_library]
# Clear Tk's access for that interp (path).
- allowTk $slave $argv
+ allowTk $child $argv
# Ensure tk_library and subdirs (eg, ttk) are on the access path
- ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]]
+ ::interp eval $child [list set tk_library [::safe::interpAddToAccessPath $child $tk_library]]
foreach subdir [::safe::AddSubDirs [list $tk_library]] {
- ::safe::interpAddToAccessPath $slave $subdir
+ ::safe::interpAddToAccessPath $child $subdir
}
- return $slave
+ return $child
}
# tkInterpLoadTk:
# Do additional configuration as needed (calling tkInterpInit)
-# and actually load Tk into the slave.
+# and actually load Tk into the child.
#
# Either contained in the specified windowId (-use) or
# creating a decorated toplevel for it.
@@ -62,37 +62,37 @@ proc ::safe::tkInterpInit {slave argv} {
proc ::safe::loadTk {} {}
::tcl::OptProc ::safe::loadTk {
- {slave -interp "name of the slave interpreter"}
+ {child -interp "name of the child interpreter"}
{-use -windowId {} "window Id to use (new toplevel otherwise)"}
{-display -displayName {} "display name to use (current one otherwise)"}
} {
set displayGiven [::tcl::OptProcArgGiven "-display"]
if {!$displayGiven} {
# Try to get the current display from "."
- # (which might not exist if the master is tk-less)
+ # (which might not exist if the parent is tk-less)
if {[catch {set display [winfo screen .]}]} {
if {[info exists ::env(DISPLAY)]} {
set display $::env(DISPLAY)
} else {
- Log $slave "no winfo screen . nor env(DISPLAY)" WARNING
+ Log $child "no winfo screen . nor env(DISPLAY)" WARNING
set display ":0.0"
}
}
}
# Get state for access to the cleanupHook.
- namespace upvar ::safe S$slave state
+ namespace upvar ::safe S$child state
if {![::tcl::OptProcArgGiven "-use"]} {
# create a decorated toplevel
- lassign [tkTopLevel $slave $display] w use
+ lassign [tkTopLevel $child $display] w use
- # set our delete hook (slave arg is added by interpDelete)
- # to clean up both window related code and tkInit(slave)
+ # set our delete hook (child arg is added by interpDelete)
+ # to clean up both window related code and tkInit(child)
set state(cleanupHook) [list tkDelete {} $w]
} else {
- # set our delete hook (slave arg is added by interpDelete)
- # to clean up tkInit(slave)
+ # set our delete hook (child arg is added by interpDelete)
+ # to clean up tkInit(child)
set state(cleanupHook) [list disallowTk]
# Let's be nice and also accept tk window names instead of ids
@@ -122,12 +122,12 @@ proc ::safe::loadTk {} {}
}
}
- # Prepares the slave for tk with those parameters
- tkInterpInit $slave [list "-use" $use "-display" $display]
+ # Prepares the child for tk with those parameters
+ tkInterpInit $child [list "-use" $use "-display" $display]
- load {} Tk $slave
+ load {} Tk $child
- return $slave
+ return $child
}
proc ::safe::TkInit {interpPath} {
@@ -149,7 +149,7 @@ proc ::safe::TkInit {interpPath} {
# safe::TkInit.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
# argv arguments passed to safe::TkInterpInit
#
# Results:
@@ -168,7 +168,7 @@ proc ::safe::allowTk {interpPath argv} {
# in safe::TkInit.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
#
# Results:
# none.
@@ -188,43 +188,43 @@ proc ::safe::disallowTk {interpPath} {
# Clean up the window associated with the interp being deleted.
#
# Arguments:
-# interpPath slave interpreter handle
+# interpPath child interpreter handle
#
# Results:
# none.
-proc ::safe::tkDelete {W window slave} {
+proc ::safe::tkDelete {W window child} {
# we are going to be called for each widget... skip untill it's
# top level
- Log $slave "Called tkDelete $W $window" NOTICE
- if {[::interp exists $slave]} {
- if {[catch {::safe::interpDelete $slave} msg]} {
- Log $slave "Deletion error : $msg"
+ Log $child "Called tkDelete $W $window" NOTICE
+ if {[::interp exists $child]} {
+ if {[catch {::safe::interpDelete $child} msg]} {
+ Log $child "Deletion error : $msg"
}
}
if {[winfo exists $window]} {
- Log $slave "Destroy toplevel $window" NOTICE
+ Log $child "Destroy toplevel $window" NOTICE
destroy $window
}
- # clean up tkInit(slave)
- disallowTk $slave
+ # clean up tkInit(child)
+ disallowTk $child
return
}
-proc ::safe::tkTopLevel {slave display} {
+proc ::safe::tkTopLevel {child display} {
variable tkSafeId
incr tkSafeId
set w ".safe$tkSafeId"
if {[catch {toplevel $w -screen $display -class SafeTk} msg]} {
return -code error -errorcode {TK TOPLEVEL SAFE} \
- "Unable to create toplevel for safe slave \"$slave\" ($msg)"
+ "Unable to create toplevel for \"$child\" ($msg)"
}
- Log $slave "New toplevel $w" NOTICE
+ Log $child "New toplevel $w" NOTICE
- set msg "Untrusted Tcl applet ($slave)"
+ set msg "Untrusted Tcl applet ($child)"
wm title $w $msg
# Control frame (we must create a style for it)
@@ -236,7 +236,7 @@ proc ::safe::tkTopLevel {slave display} {
# We will destroy the interp when the window is destroyed
bindtags $wc [concat Safe$wc [bindtags $wc]]
- bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $slave]
+ bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $child]
ttk::label $wc.l -text $msg -anchor w
@@ -247,7 +247,7 @@ proc ::safe::tkTopLevel {slave display} {
# but still have the default background instead of red one from the parent
ttk::frame $wc.fb -borderwidth 0
ttk::button $wc.fb.b -text "Delete" \
- -command [list ::safe::tkDelete $w $w $slave]
+ -command [list ::safe::tkDelete $w $w $child]
pack $wc.fb.b -side right -fill both
pack $wc.fb -side right -fill both -expand 1
pack $wc.l -side left -fill both -expand 1 -ipady 2
diff --git a/library/scale.tcl b/library/scale.tcl
index cc0de20..0da5472 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk scale widgets and provides
# procedures that help in implementing the bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -60,14 +60,6 @@ bind Scale <ButtonRelease-2> {
tk::ScaleEndDrag %W
tk::ScaleActivate %W %x %y
}
-if {[tk windowingsystem] eq "win32"} {
- # On Windows do the same with button 3, as that is the right mouse button
- bind Scale <Button-3> [bind Scale <Button-2>]
- bind Scale <B3-Motion> [bind Scale <B2-Motion>]
- bind Scale <B3-Leave> [bind Scale <B2-Leave>]
- bind Scale <B3-Enter> [bind Scale <B2-Enter>]
- bind Scale <ButtonRelease-3> [bind Scale <ButtonRelease-2>]
-}
bind Scale <Control-Button-1> {
tk::ScaleControlPress %W %x %y
}
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index 8106b3d..effae11 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -3,8 +3,8 @@
# This file defines the default bindings for Tk scrollbar widgets.
# It also provides procedures that help in implementing the bindings.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -129,34 +129,11 @@ bind Scrollbar <<LineEnd>> {
}
}
-if {[tk windowingsystem] eq "aqua"} {
- bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W hv [expr {-(%D)}]
- }
- bind Scrollbar <Option-MouseWheel> {
- tk::ScrollByUnits %W hv [expr {-10 * (%D)}]
- }
-} else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/30 = 0,
- # but
- # (int)-1/30 = -1
- # The following code ensure equal +/- behaviour.
- bind Scrollbar <MouseWheel> {
- if {%D >= 0} {
- tk::ScrollByUnits %W hv [expr {-%D/30}]
- } else {
- tk::ScrollByUnits %W hv [expr {(29-%D)/30}]
- }
- }
+bind Scrollbar <MouseWheel> {
+ tk::ScrollByUnits %W hv %D -30.0
}
-
-if {[tk windowingsystem] eq "x11"} {
- bind Scrollbar <Button-4> {tk::ScrollByUnits %W hv -5}
- bind Scrollbar <Button-5> {tk::ScrollByUnits %W hv 5}
- bind Scrollbar <Button-6> {tk::ScrollByUnits %W hv -5}
- bind Scrollbar <Button-7> {tk::ScrollByUnits %W hv 5}
+bind Scrollbar <Option-MouseWheel> {
+ tk::ScrollByUnits %W hv %D -3.0
}
# tk::ScrollButtonDown --
@@ -329,7 +306,7 @@ proc ::tk::ScrollEndDrag {w x y} {
# horizontal, "v" for vertical, "hv" for both.
# amount - How many units to scroll: typically 1 or -1.
-proc ::tk::ScrollByUnits {w orient amount} {
+proc ::tk::ScrollByUnits {w orient amount {factor 1.0}} {
set cmd [$w cget -command]
if {$cmd eq "" || ([string first \
[string index [$w cget -orient] 0] $orient] < 0)} {
@@ -337,9 +314,9 @@ proc ::tk::ScrollByUnits {w orient amount} {
}
set info [$w get]
if {[llength $info] == 2} {
- uplevel #0 $cmd scroll $amount units
+ uplevel #0 $cmd scroll [expr {$amount/$factor}] units
} else {
- uplevel #0 $cmd [expr {[lindex $info 2] + $amount}]
+ uplevel #0 $cmd [expr {[lindex $info 2] + [expr {$amount/$factor}]}]
}
}
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index 15330e9..6d740bc 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -4,10 +4,10 @@
# procedures that help in implementing those bindings. The spinbox builds
# off the entry widget, so it can reuse Entry bindings and procedures.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1999-2000 Jeffrey Hobbs
-# Copyright (c) 2000 Ajuba Solutions
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1999-2000 Jeffrey Hobbs
+# Copyright © 2000 Ajuba Solutions
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -218,9 +218,7 @@ bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}
bind Spinbox <Prior> {# nothing}
bind Spinbox <Next> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Spinbox <Command-Key> {# nothing}
-}
+bind Spinbox <Command-Key> {# nothing}
# On Windows, paste is done using Shift-Insert. Shift-Insert already
# generates the <<Paste>> event, so we don't need to do anything here.
@@ -280,27 +278,14 @@ bind Spinbox <Meta-Delete> {
# A few additional bindings of my own.
-if {[tk windowingsystem] ne "aqua"} {
- bind Spinbox <Button-2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
- }
- bind Spinbox <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
- }
-} else {
- bind Spinbox <Button-3> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
- }
+bind Spinbox <Button-2> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
}
- bind Spinbox <B3-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
- }
+}
+bind Spinbox <B2-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
}
}
@@ -483,10 +468,10 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} {
word {
if {$cur < [$w index anchor]} {
set before [tcl_wordBreakBefore [$w get] $cur]
- set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
+ set after [tcl_wordBreakAfter [$w get] $anchor-1]
} else {
set before [tcl_wordBreakBefore [$w get] $anchor]
- set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
+ set after [tcl_wordBreakAfter [$w get] $cur-1]
}
if {$before < 0} {
set before 0
@@ -589,5 +574,5 @@ proc ::tk::spinbox::AutoScan {w} {
proc ::tk::spinbox::GetSelection {w} {
return [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
}
diff --git a/library/tclIndex b/library/tclIndex
index 919fa8a..06006cd 100644
--- a/library/tclIndex
+++ b/library/tclIndex
@@ -199,6 +199,7 @@ set auto_index(::tk::RestoreFocusGrab) [list source [file join $dir tk.tcl]]
set auto_index(::tk::ScreenChanged) [list source [file join $dir tk.tcl]]
set auto_index(::tk::EventMotifBindings) [list source [file join $dir tk.tcl]]
set auto_index(::tk::CancelRepeat) [list source [file join $dir tk.tcl]]
+set auto_index(::tk::MouseWheel) [list source [file join $dir tk.tcl]]
set auto_index(::tk::TabToWindow) [list source [file join $dir tk.tcl]]
set auto_index(::tk::dialog::file::) [list source [file join $dir tkfbox.tcl]]
set auto_index(::tk::dialog::file::Config) [list source [file join $dir tkfbox.tcl]]
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index c2d2d6b..f69a988 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -2,8 +2,8 @@
#
# This file contains procedures that implement tear-off menus.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -39,7 +39,7 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
# Shift by height of tearoff entry minus height of window titlebar
catch {incr y [expr {[$w yposition 1] - 16}]}
# Avoid the native menu bar which sits on top of everything.
- if {$y < 22} { set y 22 }
+ if {$y < 22} {set y 22}
}
}
@@ -153,11 +153,11 @@ proc ::tk::MenuDup {src dst type} {
# Copy tags to x, replacing each substring of src with dst.
- while {[set index [string first $src $tags]] != -1} {
+ while {[set index [string first $src $tags]] >= 0} {
if {$index > 0} {
- append x [string range $tags 0 [expr {$index - 1}]]$dst
+ append x [string range $tags 0 $index-1]$dst
}
- set tags [string range $tags [expr {$index + $srcLen}] end]
+ set tags [string range $tags $index+$srcLen end]
}
append x $tags
@@ -170,12 +170,12 @@ proc ::tk::MenuDup {src dst type} {
# Copy script to x, replacing each substring of event with dst.
- while {[set index [string first $event $script]] != -1} {
+ while {[set index [string first $event $script]] >= 0} {
if {$index > 0} {
- append x [string range $script 0 [expr {$index - 1}]]
+ append x [string range $script 0 $index-1]
}
append x $dst
- set script [string range $script [expr {$index + $eventLen}] end]
+ set script [string range $script $index+$eventLen end]
}
append x $script
diff --git a/library/text.tcl b/library/text.tcl
index 1c84b40..5db9453 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -3,9 +3,9 @@
# This file defines the default bindings for Tk text widgets and provides
# procedures that help in implementing the bindings.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -306,9 +306,7 @@ bind Text <Meta-Key> {# nothing}
bind Text <Control-Key> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}
-if {[tk windowingsystem] eq "aqua"} {
- bind Text <Command-Key> {# nothing}
-}
+bind Text <Command-Key> {# nothing}
# Additional emacs-like bindings:
@@ -429,107 +427,29 @@ bind Text <Control-h> {
%W see insert
}
}
-if {[tk windowingsystem] ne "aqua"} {
- bind Text <Button-2> {
- if {!$tk_strictMotif} {
- tk::TextScanMark %W %x %y
- }
- }
- bind Text <B2-Motion> {
- if {!$tk_strictMotif} {
- tk::TextScanDrag %W %x %y
- }
- }
-} else {
- bind Text <Button-3> {
- if {!$tk_strictMotif} {
- tk::TextScanMark %W %x %y
- }
+bind Text <Button-2> {
+ if {!$tk_strictMotif} {
+ tk::TextScanMark %W %x %y
}
- bind Text <B3-Motion> {
- if {!$tk_strictMotif} {
- tk::TextScanDrag %W %x %y
- }
+}
+bind Text <B2-Motion> {
+ if {!$tk_strictMotif} {
+ tk::TextScanDrag %W %x %y
}
}
set ::tk::Priv(prevPos) {}
-# The MouseWheel will typically only fire on Windows and MacOS X.
-# However, someone could use the "event generate" command to produce one
-# on other platforms. We must be careful not to round -ve values of %D
-# down to zero.
-
-if {[tk windowingsystem] eq "aqua"} {
- bind Text <MouseWheel> {
- %W yview scroll [expr {-15 * (%D)}] pixels
- }
- bind Text <Option-MouseWheel> {
- %W yview scroll [expr {-150 * (%D)}] pixels
- }
- bind Text <Shift-MouseWheel> {
- %W xview scroll [expr {-15 * (%D)}] pixels
- }
- bind Text <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-150 * (%D)}] pixels
- }
-} else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/3 = 0,
- # but
- # (int)-1/3 = -1
- # The following code ensure equal +/- behaviour.
- bind Text <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {-%D/3}] pixels
- } else {
- %W yview scroll [expr {(2-%D)/3}] pixels
- }
- }
- bind Text <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {-%D/3}] pixels
- } else {
- %W xview scroll [expr {(2-%D)/3}] pixels
- }
- }
+bind Text <MouseWheel> {
+ tk::MouseWheel %W y %D -3.0 pixels
}
-
-if {[tk windowingsystem] eq "x11"} {
- # Support for mousewheels on Linux/Unix commonly comes through mapping
- # the wheel to the extended buttons. If you have a mousewheel, find
- # Linux configuration info at:
- # http://linuxreviews.org/howtos/xfree/mouse/
- bind Text <Button-4> {
- if {!$tk_strictMotif} {
- %W yview scroll -50 pixels
- }
- }
- bind Text <Button-5> {
- if {!$tk_strictMotif} {
- %W yview scroll 50 pixels
- }
- }
- bind Text <Shift-Button-4> {
- if {!$tk_strictMotif} {
- %W xview scroll -50 pixels
- }
- }
- bind Text <Shift-Button-5> {
- if {!$tk_strictMotif} {
- %W xview scroll 50 pixels
- }
- }
- bind Text <Button-6> {
- if {!$tk_strictMotif} {
- %W xview scroll -50 pixels
- }
- }
- bind Text <Button-7> {
- if {!$tk_strictMotif} {
- %W xview scroll 50 pixels
- }
- }
+bind Text <Option-MouseWheel> {
+ tk::MouseWheel %W y %D -0.3 pixels
+}
+bind Text <Shift-MouseWheel> {
+ tk::MouseWheel %W x %D -3.0 pixels
+}
+bind Text <Shift-Option-MouseWheel> {
+ tk::MouseWheel %W x %D -0.3 pixels
}
# ::tk::TextClosestGap --
@@ -581,12 +501,7 @@ proc ::tk::TextButton1 {w x y} {
} else {
$w mark gravity $anchorname left
}
- # Allow focus in any case on Windows, because that will let the
- # selection be displayed even for state disabled text widgets.
- if {[tk windowingsystem] eq "win32" \
- || [$w cget -state] eq "normal"} {
- focus $w
- }
+ focus $w
if {[$w cget -autoseparators]} {
$w edit separator
}
diff --git a/library/tk.tcl b/library/tk.tcl
index 66b8a87..b1b7629 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -3,9 +3,9 @@
# Initialization script normally executed in the interpreter for each Tk-based
# application. Arranges class bindings for widgets.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -366,15 +366,16 @@ if {![llength [info command tk_chooseDirectory]]} {
# Define the set of common virtual events.
#----------------------------------------------------------------------
+event add <<ContextMenu>> <Button-3>
+event add <<PasteSelection>> <ButtonRelease-2>
+
switch -exact -- [tk windowingsystem] {
"x11" {
event add <<Cut>> <Control-x> <F20> <Control-Lock-X>
event add <<Copy>> <Control-c> <F16> <Control-Lock-C>
event add <<Paste>> <Control-v> <F18> <Control-Lock-V>
- event add <<PasteSelection>> <ButtonRelease-2>
event add <<Undo>> <Control-z> <Control-Lock-Z>
event add <<Redo>> <Control-Z> <Control-Lock-z>
- event add <<ContextMenu>> <Button-3>
# On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent
# XQuartz as the X server, they are 1,2,3; other X servers may differ.
@@ -422,10 +423,8 @@ switch -exact -- [tk windowingsystem] {
event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X>
event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C>
event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V>
- event add <<PasteSelection>> <ButtonRelease-2>
event add <<Undo>> <Control-z> <Control-Lock-Z>
event add <<Redo>> <Control-y> <Control-Lock-Y>
- event add <<ContextMenu>> <Button-3>
event add <<SelectAll>> <Control-slash> <Control-a> <Control-Lock-A>
event add <<SelectNone>> <Control-backslash>
@@ -455,9 +454,7 @@ switch -exact -- [tk windowingsystem] {
event add <<Cut>> <Command-x> <F2> <Command-Lock-X>
event add <<Copy>> <Command-c> <F3> <Command-Lock-C>
event add <<Paste>> <Command-v> <F4> <Command-Lock-V>
- event add <<PasteSelection>> <ButtonRelease-3>
event add <<Clear>> <Clear>
- event add <<ContextMenu>> <Button-2>
# Official bindings
# See http://support.apple.com/kb/HT1343
@@ -496,7 +493,7 @@ switch -exact -- [tk windowingsystem] {
if {$::tk_library ne ""} {
proc ::tk::SourceLibFile {file} {
- namespace eval :: [list source [file join $::tk_library $file.tcl]]
+ namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]]
}
namespace eval ::tk {
SourceLibFile icons
@@ -536,6 +533,13 @@ proc ::tk::CancelRepeat {} {
set Priv(afterId) {}
}
+## ::tk::MouseWheel $w $dir $amount $factor $units
+
+proc ::tk::MouseWheel {w dir amount {factor -120.0} {units units}} {
+ $w ${dir}view scroll [expr {$amount/$factor}] $units
+}
+
+
# ::tk::TabToWindow --
# This procedure moves the focus to the given widget.
# It sends a <<TraverseOut>> virtual event to the previous focus window,
@@ -627,8 +631,8 @@ proc ::tk::FindAltKeyTarget {path char} {
[string index [$path cget -text] [$path cget -underline]]]} {
return $path
}
- set subwins [concat [grid slaves $path] [pack slaves $path] \
- [place slaves $path]]
+ set subwins [concat [grid content $path] [pack content $path] \
+ [place content $path]]
if {$class eq "Canvas"} {
foreach item [$path find all] {
if {[$path type $item] eq "window"} {
@@ -687,9 +691,11 @@ if {[tk windowingsystem] eq "aqua"} {
if {[tk windowingsystem] eq "aqua"} {
#stub procedures to respond to "do script" Apple Events
proc ::tk::mac::DoScriptFile {file} {
- source $file
+ uplevel #0 $file
+ source -encoding utf-8 $file
}
proc ::tk::mac::DoScriptText {script} {
+ uplevel #0 $script
eval $script
}
}
@@ -731,7 +737,7 @@ set ::tk::Priv(IMETextMark) [dict create]
# Run the Ttk themed widget set initialization
if {$::ttk::library ne ""} {
- uplevel \#0 [list source $::ttk::library/ttk.tcl]
+ uplevel \#0 [list source -encoding utf-8 $::ttk::library/ttk.tcl]
}
# Local Variables:
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index cf89287..af40a12 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -10,7 +10,7 @@
# "Directory" option menu. The user can select files by clicking on the
# file icons or by entering a filename in the "Filename:" entry.
#
-# Copyright (c) 1994-1998 Sun Microsystems, Inc.
+# Copyright © 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.
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index e8c24a1..14460a2 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -42,7 +42,7 @@ ttk::copyBindings TButton TRadiobutton
bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 }
bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 }
-# bind TCheckbutton <plus> { %W select }
+# bind TCheckbutton <+> { %W select }
# bind TCheckbutton <minus> { %W deselect }
# activate --
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 9af8c59..58df760 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -182,11 +182,15 @@ proc ttk::combobox::SelectEntry {cb index} {
## Scroll -- Mousewheel binding
#
-proc ttk::combobox::Scroll {cb dir} {
+proc ttk::combobox::Scroll {cb dir {factor 1.0}} {
$cb instate disabled { return }
set max [llength [$cb cget -values]]
set current [$cb current]
- incr current $dir
+ set d [expr {round($dir/factor)}]
+ if {$d == 0 && $dir != 0} {
+ if {$dir > 0} {set d 1} else {set d -1}
+ }
+ incr current $d
if {$max != 0 && $current == $current % $max} {
SelectEntry $cb $current
}
@@ -197,7 +201,7 @@ proc ttk::combobox::Scroll {cb dir} {
# and unpost the listbox.
#
proc ttk::combobox::LBSelected {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
LBSelect $lb
Unpost $cb
focus $cb
@@ -207,14 +211,14 @@ proc ttk::combobox::LBSelected {lb} {
# Unpost the listbox.
#
proc ttk::combobox::LBCancel {lb} {
- Unpost [LBMaster $lb]
+ Unpost [LBMain $lb]
}
## LBTab -- Tab key binding for combobox listbox.
# Set the selection, and navigate to next/prev widget.
#
proc ttk::combobox::LBTab {lb dir} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
switch -- $dir {
next { set newFocus [tk_focusNext $cb] }
prev { set newFocus [tk_focusPrev $cb] }
@@ -357,6 +361,9 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
set w [winfo width $cb]
set h [winfo height $cb]
set style [$cb cget -style]
+ if { $style eq {} } {
+ set style TCombobox
+ }
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
incr $var $delta
@@ -411,10 +418,10 @@ proc ttk::combobox::Unpost {cb} {
grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190]
}
-## LBMaster $lb --
+## LBMain $lb --
# Return the combobox main widget that owns the listbox.
#
-proc ttk::combobox::LBMaster {lb} {
+proc ttk::combobox::LBMain {lb} {
winfo parent [winfo parent [winfo parent $lb]]
}
@@ -422,7 +429,7 @@ proc ttk::combobox::LBMaster {lb} {
# Transfer listbox selection to combobox value.
#
proc ttk::combobox::LBSelect {lb} {
- set cb [LBMaster $lb]
+ set cb [LBMain $lb]
set selection [$lb curselection]
if {[llength $selection] == 1} {
SelectEntry $cb [lindex $selection 0]
@@ -439,7 +446,7 @@ proc ttk::combobox::LBSelect {lb} {
#
proc ttk::combobox::LBCleanup {lb} {
variable Values
- unset Values([LBMaster $lb])
+ unset Values([LBMain $lb])
}
#*EOF*
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 6723833..16f6108 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -1,9 +1,9 @@
#
# DERIVED FROM: tk/library/entry.tcl r1.22
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 2004, Joe English
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 2004, Joe English
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -82,20 +82,14 @@ bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
}
-## Button2 (Button3 on Aqua) bindings:
+## Button2 bindings:
# Used for scanning and primary transfer.
-# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
+# Note: ButtonRelease-2
# is mapped to <<PasteSelection>> in tk.tcl.
#
-if {[tk windowingsystem] ne "aqua"} {
- bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
- bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
-} else {
- bind TEntry <Button-3> { ttk::entry::ScanMark %W %x }
- bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x }
- bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x }
-}
+bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
+bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
+bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
## Keyboard navigation bindings:
@@ -179,7 +173,7 @@ bind TEntry <<TkAccentBackspace>> {
#
proc ttk::entry::EntrySelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
if {[$w cget -show] ne ""} {
return [string repeat [string index [$w cget -show] 0] \
[string length $entryString]]
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index d819973..65f2c5e 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -78,7 +78,7 @@ switch -- [tk windowingsystem] {
set F(family) "MS Sans Serif"
}
} else {
- if {[lsearch -exact [font families] Tahoma] != -1} {
+ if {[lsearch -exact [font families] Tahoma] >= 0} {
set F(family) "Tahoma"
} else {
set F(family) "MS Sans Serif"
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index 08b4a15..a245df8 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -224,11 +224,11 @@ proc ttk::menubutton::TransferGrab {mb} {
# FindMenuEntry --
# Hack to support tk_optionMenus.
# Returns the index of the menu entry with a matching -label,
-# -1 if not found.
+# "" if not found.
#
proc ttk::menubutton::FindMenuEntry {menu s} {
set last [$menu index last]
- if {$last eq "none"} {
+ if {$last eq "none" || $last eq ""} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
index c5340a5..a871081 100644
--- a/library/ttk/notebook.tcl
+++ b/library/ttk/notebook.tcl
@@ -112,13 +112,8 @@ proc ttk::notebook::enableTraversal {nb} {
catch {
bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
}
- if {[tk windowingsystem] eq "aqua"} {
- bind $top <Option-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- } else {
- bind $top <Alt-Key> \
- +[list ttk::notebook::MnemonicActivation $top %K]
- }
+ bind $top <Option-Key> \
+ +[list ttk::notebook::MnemonicActivation $top %K]
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
}
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 7537491..8f6cf64 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -19,21 +19,8 @@ bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
# Redirect scrollwheel bindings to the scrollbar widget
#
-# The shift-bindings scroll left/right (not up/down)
-# if a widget has both possibilities
-set eventList [list <MouseWheel>]
-switch [tk windowingsystem] {
- aqua {
- lappend eventList <Option-MouseWheel>
- }
- x11 {
- lappend eventList <Button-4> <Button-5> <Button-6> <Button-7>
- }
-}
-foreach event $eventList {
- bind TScrollbar $event [bind Scrollbar $event]
-}
-unset eventList event
+bind TScrollbar <MouseWheel> [bind Scrollbar <MouseWheel>]
+bind TScrollbar <Option-MouseWheel> [bind Scrollbar <Option-MouseWheel>]
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
@@ -56,7 +43,7 @@ proc ttk::scrollbar::Press {w x y} {
set State(yPress) $y
switch -glob -- [$w identify $x $y] {
- *uparrow -
+ *uparrow -
*leftarrow {
ttk::Repeatedly Scroll $w -1 units
}
@@ -64,6 +51,7 @@ proc ttk::scrollbar::Press {w x y} {
*rightarrow {
ttk::Repeatedly Scroll $w 1 units
}
+ *grip -
*thumb {
set State(first) [lindex [$w get] 0]
}
@@ -109,6 +97,7 @@ proc ttk::scrollbar::Jump {w x y} {
variable State
switch -glob -- [$w identify $x $y] {
+ *grip -
*thumb -
*trough {
set State(first) [$w fraction $x $y]
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 5db1d03..f580a21 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -32,7 +32,7 @@ proc ttk::spinbox::Motion {w x y} {
variable State
ttk::saveCursor $w State(userConfCursor) [ttk::cursor text]
if { [$w identify $x $y] eq "textarea"
- && [$w instate {!readonly !disabled}]
+ && [$w instate {!readonly !disabled}]
} {
ttk::setCursor $w text
} else {
@@ -46,16 +46,16 @@ proc ttk::spinbox::Press {w x y} {
if {[$w instate disabled]} { return }
focus $w
switch -glob -- [$w identify $x $y] {
- *textarea { ttk::entry::Press $w $x }
+ *textarea { ttk::entry::Press $w $x }
*rightarrow -
- *uparrow { ttk::Repeatedly event generate $w <<Increment>> }
+ *uparrow { ttk::Repeatedly event generate $w <<Increment>> }
*leftarrow -
- *downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
+ *downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
*spinbutton {
if {$y * 2 >= [winfo height $w]} {
- set event <<Decrement>>
+ set event <<Decrement>>
} else {
- set event <<Increment>>
+ set event <<Increment>>
}
ttk::Repeatedly event generate $w $event
}
@@ -69,7 +69,7 @@ proc ttk::spinbox::DoubleClick {w x y} {
if {[$w instate disabled]} { return }
switch -glob -- [$w identify $x $y] {
- *textarea { SelectAll $w }
+ *textarea { SelectAll $w }
* { Press $w $x $y }
}
}
@@ -82,11 +82,11 @@ proc ttk::spinbox::Release {w} {
# Mousewheel callback. Turn these into <<Increment>> (-1, up)
# or <<Decrement> (+1, down) events.
#
-proc ttk::spinbox::MouseWheel {w dir} {
+proc ttk::spinbox::MouseWheel {w dir {factor 1}} {
if {[$w instate disabled]} { return }
- if {$dir < 0} {
+ if {($dir < 0) ^ ($factor < 0)} {
event generate $w <<Increment>>
- } else {
+ } elseif {$dir > 0} {
event generate $w <<Decrement>>
}
}
@@ -135,16 +135,31 @@ proc ttk::spinbox::Adjust {w v min max} {
# -from, -to, and -increment.
#
proc ttk::spinbox::Spin {w dir} {
+ variable State
+
if {[$w instate disabled]} { return }
- set nvalues [llength [set values [$w cget -values]]]
- set value [$w get]
- if {$nvalues} {
- set current [lsearch -exact $values $value]
- set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]]
- $w set [lindex $values $index]
+
+ if {![info exists State($w,values.length)]} {
+ set State($w,values.index) -1
+ set State($w,values.last) {}
+ }
+ set State($w,values) [$w cget -values]
+ set State($w,values.length) [llength $State($w,values)]
+
+ if {$State($w,values.length) > 0} {
+ set value [$w get]
+ set current $State($w,values.index)
+ if {$value ne $State($w,values.last)} {
+ set current [lsearch -exact $State($w,values) $value]
+ if {$current < 0} {set current -1}
+ }
+ set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \
+ [expr {$State($w,values.length) - 1}]]
+ set State($w,values.last) [lindex $State($w,values) $State($w,values.index)]
+ $w set $State($w,values.last)
} else {
- if {[catch {
- set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
+ if {[catch {
+ set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
}]} {
set v [$w cget -from]
}
@@ -162,7 +177,7 @@ proc ttk::spinbox::FormatValue {w val} {
if {$fmt eq ""} {
# Try to guess a suitable -format based on -increment.
set delta [expr {abs([$w cget -increment])}]
- if {0 < $delta && $delta < 1} {
+ if {0 < $delta && $delta < 1} {
# NB: This guesses wrong if -increment has more than 1
# significant digit itself, e.g., -increment 0.25
set nsd [expr {int(ceil(-log10($delta)))}]
diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl
index 665222d..73ee3d9 100644
--- a/library/ttk/ttk.tcl
+++ b/library/ttk/ttk.tcl
@@ -12,9 +12,9 @@ namespace eval ::ttk {
}
}
-source [file join $::ttk::library fonts.tcl]
-source [file join $::ttk::library cursors.tcl]
-source [file join $::ttk::library utils.tcl]
+source -encoding utf-8 [file join $::ttk::library fonts.tcl]
+source -encoding utf-8 [file join $::ttk::library cursors.tcl]
+source -encoding utf-8 [file join $::ttk::library utils.tcl]
## ttk::deprecated $old $new --
# Define $old command as a deprecated alias for $new command
@@ -97,18 +97,18 @@ proc ::ttk::setTheme {theme} {
### Load widget bindings.
#
-source [file join $::ttk::library button.tcl]
-source [file join $::ttk::library menubutton.tcl]
-source [file join $::ttk::library scrollbar.tcl]
-source [file join $::ttk::library scale.tcl]
-source [file join $::ttk::library progress.tcl]
-source [file join $::ttk::library notebook.tcl]
-source [file join $::ttk::library panedwindow.tcl]
-source [file join $::ttk::library entry.tcl]
-source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
-source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
-source [file join $::ttk::library treeview.tcl]
-source [file join $::ttk::library sizegrip.tcl]
+source -encoding utf-8 [file join $::ttk::library button.tcl]
+source -encoding utf-8 [file join $::ttk::library menubutton.tcl]
+source -encoding utf-8 [file join $::ttk::library scrollbar.tcl]
+source -encoding utf-8 [file join $::ttk::library scale.tcl]
+source -encoding utf-8 [file join $::ttk::library progress.tcl]
+source -encoding utf-8 [file join $::ttk::library notebook.tcl]
+source -encoding utf-8 [file join $::ttk::library panedwindow.tcl]
+source -encoding utf-8 [file join $::ttk::library entry.tcl]
+source -encoding utf-8 [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
+source -encoding utf-8 [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
+source -encoding utf-8 [file join $::ttk::library treeview.tcl]
+source -encoding utf-8 [file join $::ttk::library sizegrip.tcl]
## Label and Labelframe bindings:
# (not enough to justify their own file...)
@@ -122,7 +122,7 @@ proc ttk::LoadThemes {} {
variable library
# "default" always present:
- uplevel #0 [list source [file join $library defaults.tcl]]
+ uplevel #0 [list source -encoding utf-8 [file join $library defaults.tcl]]
set builtinThemes [style theme names]
foreach {theme scripts} {
@@ -135,7 +135,7 @@ proc ttk::LoadThemes {} {
} {
if {[lsearch -exact $builtinThemes $theme] >= 0} {
foreach script $scripts {
- uplevel #0 [list source [file join $library $script]]
+ uplevel #0 [list source -encoding utf-8 [file join $library $script]]
}
}
}
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index e0ab45b..4b925f4 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -273,21 +273,6 @@ proc ttk::copyBindings {from to} {
#
# Platform inconsistencies:
#
-# On X11, the server typically maps the mouse wheel to Button4 and Button5.
-#
-# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
-#
-# On Windows, %D must be scaled by a factor of 120.
-# In addition, Tk redirects mousewheel events to the window with
-# keyboard focus instead of sending them to the window under the pointer.
-# We do not attempt to fix that here, see also TIP#171.
-#
-# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
-# and Option+MouseWheel for accelerated scrolling.
-#
-# The Shift+MouseWheel behavior is not conventional on Windows or most
-# X11 toolkits, but it's useful.
-#
# MouseWheel scrolling is accelerated on X11, which is conventional
# for Tk and appears to be conventional for other toolkits (although
# Gtk+ and Qt do not appear to use as large a factor).
@@ -300,24 +285,8 @@ proc ttk::copyBindings {from to} {
#
proc ttk::bindMouseWheel {bindtag callback} {
- if {[tk windowingsystem] eq "x11"} {
- bind $bindtag <Button-4> "$callback -1"
- bind $bindtag <Button-5> "$callback +1"
- }
- if {[tk windowingsystem] eq "aqua"} {
- bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
- bind $bindtag <Option-MouseWheel> [append callback { [expr {-10 *(%D)}]} ]
- } else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/120 = 0,
- # but
- # (int)-1/120 = -1
- # The following code ensure equal +/- behaviour.
- bind $bindtag <MouseWheel> [append callback { [
- expr {%D>=0 ? (-%D/120) : ((119-%D)/120)}
- ]}]
- }
+ bind $bindtag <MouseWheel> "$callback %D -120.0"
+ bind $bindtag <Option-MouseWheel> "$callback %D -12.0"
}
## Mousewheel bindings for standard scrollable widgets.
@@ -328,46 +297,13 @@ proc ttk::bindMouseWheel {bindtag callback} {
# standard scrollbar protocol.
#
-if {[tk windowingsystem] eq "x11"} {
- bind TtkScrollable <Button-4> { %W yview scroll -5 units }
- bind TtkScrollable <Button-5> { %W yview scroll 5 units }
- bind TtkScrollable <Shift-Button-4> { %W xview scroll -5 units }
- bind TtkScrollable <Shift-Button-5> { %W xview scroll 5 units }
-}
-if {[tk windowingsystem] eq "aqua"} {
- bind TtkScrollable <MouseWheel> {
- %W yview scroll [expr {-(%D)}] units
- }
- bind TtkScrollable <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D)}] units
- }
- bind TtkScrollable <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
- }
- bind TtkScrollable <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
- }
-} else {
- # We must make sure that positive and negative movements are rounded
- # equally to integers, avoiding the problem that
- # (int)1/120 = 0,
- # but
- # (int)-1/120 = -1
- # The following code ensure equal +/- behaviour.
- bind TtkScrollable <MouseWheel> {
- if {%D >= 0} {
- %W yview scroll [expr {-%D/120}] units
- } else {
- %W yview scroll [expr {(119-%D)/120}] units
- }
- }
- bind TtkScrollable <Shift-MouseWheel> {
- if {%D >= 0} {
- %W xview scroll [expr {-%D/120}] units
- } else {
- %W xview scroll [expr {(119-%D)/120}] units
- }
- }
-}
+bind TtkScrollable <MouseWheel> \
+ { tk::MouseWheel %W y %D }
+bind TtkScrollable <Option-MouseWheel> \
+ { tk::MouseWheel %W y %D -12.0 }
+bind TtkScrollable <Shift-MouseWheel> \
+ { tk::MouseWheel %W x %D }
+bind TtkScrollable <Shift-Option-MouseWheel> \
+ { tk::MouseWheel %W x %D -12.0 }
#*EOF*
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index 165b496..d841962 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -69,9 +69,9 @@ namespace eval ttk::theme::vista {
ttk::style layout TCombobox {
Combobox.border -sticky nswe -border 0 -children {
Combobox.rightdownarrow -side right -sticky ns
- Combobox.padding -expand 1 -sticky nswe -children {
+ Combobox.padding -sticky nswe -children {
Combobox.background -sticky nswe -children {
- Combobox.focus -expand 1 -sticky nswe -children {
+ Combobox.focus -sticky nswe -children {
Combobox.textarea -sticky nswe
}
}
@@ -138,7 +138,7 @@ namespace eval ttk::theme::vista {
Spinbox.background -sticky news -children {
Spinbox.padding -sticky news -children {
Spinbox.innerbg -sticky news -children {
- Spinbox.textarea -expand 1
+ Spinbox.textarea
}
}
Spinbox.uparrow -side top -sticky ens
@@ -203,8 +203,8 @@ namespace eval ttk::theme::vista {
TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
-width 6 -height 12
ttk::style layout Horizontal.TScale {
- Scale.focus -expand 1 -sticky nswe -children {
- Horizontal.Scale.trough -expand 1 -sticky nswe -children {
+ Scale.focus -sticky nswe -children {
+ Horizontal.Scale.trough -sticky nswe -children {
Horizontal.Scale.track -sticky we
Horizontal.Scale.slider -side left -sticky {}
}
@@ -214,8 +214,8 @@ namespace eval ttk::theme::vista {
TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
-width 12 -height 6
ttk::style layout Vertical.TScale {
- Scale.focus -expand 1 -sticky nswe -children {
- Vertical.Scale.trough -expand 1 -sticky nswe -children {
+ Scale.focus -sticky nswe -children {
+ Vertical.Scale.trough -sticky nswe -children {
Vertical.Scale.track -sticky ns
Vertical.Scale.slider -side top -sticky {}
}
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl
index 0aaae38..71f3f1a 100644
--- a/library/xmfbox.tcl
+++ b/library/xmfbox.tcl
@@ -4,8 +4,8 @@
# Unix platform. This implementation is used only if the
# "::tk_strictMotif" flag is set.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Scriptics Corporation
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Scriptics Corporation
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/macosx/Credits.html.in b/macosx/Credits.html.in
new file mode 100644
index 0000000..cc409b1
--- /dev/null
+++ b/macosx/Credits.html.in
@@ -0,0 +1,24 @@
+<!doctype htmL>
+<html>
+<head>
+</head>
+<body style="font-size:120%;font-family:Arial,sans-serif;">
+<p>
+Tcl and Tk are distributed under a modified BSD license:<br>
+<a href="https:www.tcl.tk/software/tcltk/license.html">
+ https:www.tcl.tk/software/tcltk/license.html
+</a>
+</p>
+<ul style="list-style-type:none;">
+<li>&copy; 1987-@TK_YEAR@ Tcl Core Team and Contributers.</li>
+<li>&copy; 2011-@TK_YEAR@ Kevin Walzer/WordTech Communications LLC.</li>
+<li>&copy; 2014-@TK_YEAR@ Marc Culler.</li>
+<li>&copy; 2002-2012 Daniel A. Steffen.</li>
+<li>&copy; 2001-2009 Apple Inc.</li>
+<li>&copy; 2001-2002 Jim Ingham &amp; Ian Reid.</li>
+<li>&copy; 1998-2000 Jim Ingham &amp; Ray Johnson.</li>
+<li>&copy; 1998-2000 Scriptics Inc.</li>
+<li>&copy; 1996-1997 Sun Microsystems Inc.</li>
+</ul>
+</body>
+</html>
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile
index e753c29..2451e5c 100644
--- a/macosx/GNUmakefile
+++ b/macosx/GNUmakefile
@@ -44,6 +44,18 @@ INSTALL_MANPAGES ?=
# set to non-empty value to build TkX11 instead of TkAqua:
TK_X11 ?=
+# Checks and overrides for subframework builds
+ifeq (${SUBFRAMEWORK}_${TK_X11},1_)
+ifeq (${DYLIB_INSTALL_DIR},)
+ @echo "Cannot install subframework with empty DYLIB_INSTALL_DIR !" && false
+endif
+ifeq (${DESTDIR},)
+ @echo "Cannot install subframework with empty DESTDIR !" && false
+endif
+override BUILD_DIR = ${DESTDIR}/build
+override INSTALL_PATH = /Frameworks
+endif
+
#-------------------------------------------------------------------------------------------------------
# meta targets
@@ -211,9 +223,15 @@ install-${PROJECT}: build-${PROJECT}
ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
@echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
endif
+ifeq (${SUBFRAMEWORK}_${DYLIB_INSTALL_DIR},1_)
+ @echo "Cannot install subframework with empty DYLIB_INSTALL_DIR !" && false
+endif
ifeq (${EMBEDDED_BUILD},1)
@rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tk.framework"
endif
+ifeq (${SUBFRAMEWORK},1)
+ @rm -rf "${INSTALL_ROOT}/Frameworks/Tk.framework"
+endif
${DO_MAKE}
ifeq (${EMBEDDED_BUILD}_${TK_X11},1_)
# workaround bug with 'cp -pRH' on Darwin 6 and earlier
@@ -228,8 +246,8 @@ ifeq (${EMBEDDED_BUILD},1)
else
# install wish symbolic link
@ln -fs ${WISH} "${INSTALL_ROOT}${BINDIR}/${wish}"
-endif
-endif
+endif # embedded
+endif # install
ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
# keep copy of debug library around, so that
# Deployment build can be installed on top
@@ -237,8 +255,9 @@ ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
# the debug library
@cd "${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}" && \
ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
-endif
+endif # Development, not embedded
ifeq (${TK_X11},)
+ifeq (${SUBFRAMEWORK},)
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" && \
@@ -272,9 +291,10 @@ else
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
+endif # install not subframework
+endif # embedded
+endif # not subframework
+endif # not X11
clean-${PROJECT}: %-${PROJECT}:
${DO_MAKE}
diff --git a/macosx/README b/macosx/README
index a3f10b6..ac641b1 100644
--- a/macosx/README
+++ b/macosx/README
@@ -272,20 +272,24 @@ appearance. Part of the implementation of the Dark Mode was to make
some of the named NSColors have dynamic values. Apple calls these
"semantic colors" because the name does not specify a specific color,
but rather refers to the context in which the color should be used.
-Tk now provides the following semantic colors as system colors:
-systemTextColor, systemTextBackgroundColor, systemSelectedTextColor,
-systemSelectedTextBackgroundColor, systemControlTextColor,
-systemDisabledControlTextColor, systemLabelColor, systemLinkColor, and
-systemControlAccentColor. All of these except the last three were
-present in OSX 10.0 (and those three are simulated in systems where they
-do not exist). The change in 10.14 was that the RGB color value of
-these colors became dynamic, meaning that the color value can change
-when the application appearance changes. In particular, when a user
-selects Dark Mode in the system preferences these colors change
-appearance. For example systemTextColor is dark in Aqua and light in
-DarkAqua. One additional color, systemSelectedTabTextColor, does not
-exist in macOS but is used by Tk to match the different colors used
-for Notebook tab text in different OS versions.
+In particular, when a user selects Dark Mode in the system preferences
+these colors change appearance. For example systemTextColor is dark in
+Aqua and light in DarkAqua.
+
+Tk now provides colors corresponding to all of the NSColors in Apple's System
+ColorList. The convention for naming these colors is that the Tk name is
+generated by capitalizing the macOS name and adding the prefix "system". The
+System ColorList differs between releases of macOS and some colors, such as
+systemLinkColor and systemControlAccentColor, are simulated on older systems
+which did not provide them. The following colors are available on all
+supported macOS releases, although newer systems will support additional
+colors: systemControlAccentColor, systemControlTextColor,
+systemDisabledControlTextColor, systemLabelColor, systemLinkColor,
+systemPlaceholderTextColor, systemSelectedTextBackgroundColor,
+systemSelectedTextColor, systemSeparatorColor, systemTextBackgroundColor, and
+systemTextColor. One additional color, systemSelectedTabTextColor, does not
+exist in macOS but is used by Tk to match the different colors used for
+Notebook tab titles in different OS versions.
The default background and foreground colors of most of the Tk widgets
have been set to semantic colors, which means that the widgets will change
@@ -455,6 +459,20 @@ make overrides to the tk/macosx GNUmakefile, e.g.
TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin
The Makefile variables TCL_FRAMEWORK_DIR and TCLSH_DIR were added with Tk 8.4.3.
+- To build a Tcl.framework and Tk.framework for use as subframeworks in another
+framework, use the install-embedded target and set SUBFRAMEWORK=1. Set the
+DYLIB_INSTALL_DIR variable to the path which should be the install_name path of
+the shared library and set the DESTDIR variable to the pathname of a staging
+directory where the frameworks will be written. The Tcl framework must be
+built first.
+For example, running the commands:
+ make -C ../tcl8.6/macosx install-embedded SUBFRAMEWORK=1 DESTDIR=/tmp/tcltk \
+ DYLIB_INSTALL_DIR=/Library/Frameworks/Some.framework/Versions/X.Y/Frameworks/Tcl.framework
+ make -C macosx install-embedded SUBFRAMEWORK=1 DESTDIR=/tmp/tcltk \
+ DYLIB_INSTALL_DIR=/Library/Frameworks/Some.framework/Versions/X.Y/Frameworks/Tk.framework
+will produce a Tcl.framework and a Tk.framework usable as subframeworks of
+Some.framework. The frameworks will be found in /tmp/tcltk/Frameworks/
+
5. Details regarding the macOS port of Tk.
-------------------------------------------
@@ -662,15 +680,35 @@ source and destination rectangles for the scrolling. The embedded
windows are redrawn within the DisplayText function by some
conditional code which is only used for macOS.
-6.0 Virtual events on 10.14
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+6.0 Virtual events on macOS 10.14 and later
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The 10.14 release added support for system appearance changes,
+including a "Dark Mode" that renders all window frames and menus in
+dark colors. Tk 8.6.11 provides three virtual events <<LightAqua>>,
+<<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk
+app's appearance when the system appearance changes. These events are
+generated in [NSView effectiveAppearanceChanged], which is called by
+the Apple window manager when the General Preferences is changed
+either by switching between Light Mode and Dark Mode or by changing
+the Accent Color or Highlight Color.
+
+The <<AppearanceChanged>> virtual event has a data string which can be
+accessed with the %d substitution. The format of the data string is
+that it consists of 6 words:
+ "Appearance XXXX Accent YYYY Highlight ZZZZ"
+For example, the following code will print the current appearance
+name, accent color and highlight color when the <<AppearanceChanged>>
+virtual event fires:
+
+bind . <<AppearanceChanged>> {
+ array set data [split %d]
+ puts " Appearance: $data(Appearance)"
+ puts " Accent: $data(Accent)"
+ puts " Highlight: $data(Highlight)\n"
+}
+
-10.14 supports system appearance changes, and has added a "Dark Mode"
-that casts all window frames and menus as black. Tk 8.6.9 has added two
-virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update
-your Tk app's appearance when the system appearance changes. Just bind
-your appearance-updating code to these virtual events and you will see
-it triggered when the system appearance toggles between dark and light.
7.0 Mac Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig
index 6219135..72ef08a 100644
--- a/macosx/Tk-Common.xcconfig
+++ b/macosx/Tk-Common.xcconfig
@@ -23,7 +23,7 @@ GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
GCC_VERSION = 4.2
GCC = gcc-$(GCC_VERSION)
-WARNING_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
+WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
REZ_RESOURCE_MAP_READ_ONLY = YES
APPLICATION_INSTALL_PATH = /Applications/Utilities
BINDIR = $(PREFIX)/bin
diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj
index 9598af9..c1c5b41 100644
--- a/macosx/Tk.xcode/project.pbxproj
+++ b/macosx/Tk.xcode/project.pbxproj
@@ -1408,7 +1408,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -3073,7 +3073,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj
index 121c8a0..ea4ecfc 100644
--- a/macosx/Tk.xcodeproj/project.pbxproj
+++ b/macosx/Tk.xcodeproj/project.pbxproj
@@ -1408,7 +1408,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtInterp.3; sourceTree = "<group>"; };
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtMathFnc.3; sourceTree = "<group>"; };
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtObjCmd.3; sourceTree = "<group>"; };
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtSlave.3; sourceTree = "<group>"; };
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtAlias.3; sourceTree = "<group>"; };
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTimerHdlr.3; sourceTree = "<group>"; };
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = CrtTrace.3; sourceTree = "<group>"; };
F96D3E2508F272A5004A47F5 /* dde.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = dde.n; sourceTree = "<group>"; };
@@ -3072,7 +3072,7 @@
F96D3E1F08F272A5004A47F5 /* CrtInterp.3 */,
F96D3E2008F272A5004A47F5 /* CrtMathFnc.3 */,
F96D3E2108F272A5004A47F5 /* CrtObjCmd.3 */,
- F96D3E2208F272A5004A47F5 /* CrtSlave.3 */,
+ F96D3E2208F272A5004A47F5 /* CrtAlias.3 */,
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
diff --git a/macosx/tkMacOSX.h b/macosx/tkMacOSX.h
index a9e3082..3ab0a34 100644
--- a/macosx/tkMacOSX.h
+++ b/macosx/tkMacOSX.h
@@ -26,7 +26,7 @@
typedef int (Tk_MacOSXEmbedRegisterWinProc) (long winID, Tk_Window window);
typedef void* (Tk_MacOSXEmbedGetGrafPortProc) (Tk_Window window);
typedef int (Tk_MacOSXEmbedMakeContainerExistProc) (Tk_Window window);
-typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, Region rgn);
+typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, void *rgn);
typedef void (Tk_MacOSXEmbedGetOffsetInParentProc) (Tk_Window window, void *ulCorner);
#include "tkPlatDecls.h"
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index a63a1b6..29bb163 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -136,15 +136,13 @@ PixmapFromImage(
Pixmap pixmap;
pixmap = Tk_GetPixmap(display, None, size.width, size.height, 0);
- if (TkMacOSXSetupDrawingContext(pixmap, NULL, 1, &dc)) {
+ if (TkMacOSXSetupDrawingContext(pixmap, NULL, &dc)) {
if (dc.context) {
CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1,
.tx = 0, .ty = size.height};
CGContextConcatCTM(dc.context, t);
[NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:[NSGraphicsContext
- graphicsContextWithGraphicsPort:dc.context
- flipped:NO]];
+ [NSGraphicsContext setCurrentContext:GET_NSCONTEXT(dc.context, NO)];
[image drawAtPoint:NSZeroPoint fromRect:NSZeroRect
operation:NSCompositeCopy fraction:1.0];
[NSGraphicsContext restoreGraphicsState];
@@ -343,7 +341,7 @@ TkpGetNativeAppBitmap(
int
TkMacOSXIconBitmapObjCmd(
- ClientData dummy, /* Unused. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -352,7 +350,6 @@ TkMacOSXIconBitmapObjCmd(
int i = 1, len, isNew, result = TCL_ERROR;
const char *name, *value;
IconBitmap ib, *iconBitmap;
- (void)dummy;
if (objc != 6) {
Tcl_WrongNumArgs(interp, 1, objv, "name width height "
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index aa45895..857ce34 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.c
@@ -194,13 +194,6 @@ TkpDisplayButton(
}
pixmap = (Pixmap) Tk_WindowId(tkwin);
- /*
- * Set up clipping region. Make sure the we are using the port
- * for this button, or we will set the wrong window's clip.
- */
-
- TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
-
if (TkMacOSXComputeButtonDrawParams(butPtr, dpPtr)) {
macButtonPtr->useTkText = 0;
} else {
@@ -399,7 +392,7 @@ TkpComputeButtonGeometry(
width += butPtr->inset*2;
height += butPtr->inset*2;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
width += 12;
}
if (mbPtr->btnkind == kThemePushButton) {
@@ -726,7 +719,7 @@ TkpDestroyButton(
static void
TkMacOSXDrawButton(
MacButton *mbPtr, /* Mac button. */
- GC gc, /* The GC we are drawing into - needed for
+ TCL_UNUSED(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 */
@@ -737,7 +730,6 @@ TkMacOSXDrawButton(
TkMacOSXDrawingContext dc;
DrawParams *dpPtr = &mbPtr->drawParams;
int useNewerHITools = 1;
- (void)gc;
TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo);
@@ -752,7 +744,7 @@ TkMacOSXDrawButton(
ButtonBackgroundDrawCB(&cntrRect, mbPtr, 32, true);
- if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
return;
}
@@ -785,7 +777,7 @@ TkMacOSXDrawButton(
ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo,
(MacButton *) mbPtr, 32, true);
} else {
- if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
return;
}
@@ -813,19 +805,16 @@ TkMacOSXDrawButton(
static void
ButtonBackgroundDrawCB(
- const HIRect *btnbounds,
+ TCL_UNUSED(const HIRect *),
MacButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
MacButton *mbPtr = (MacButton *) ptr;
TkButton *butPtr = (TkButton *) mbPtr;
Tk_Window tkwin = butPtr->tkwin;
Pixmap pixmap;
int usehlborder = 0;
- (void)btnbounds;
- (void)depth;
- (void)isColorDev;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
@@ -868,20 +857,15 @@ ButtonBackgroundDrawCB(
*/
static void
ButtonContentDrawCB (
- const HIRect * btnbounds,
- ThemeButtonKind kind,
- const HIThemeButtonDrawInfo *drawinfo,
+ TCL_UNUSED(const HIRect *),
+ TCL_UNUSED(ThemeButtonKind),
+ TCL_UNUSED(const HIThemeButtonDrawInfo *),
MacButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
TkButton *butPtr = (TkButton *) ptr;
Tk_Window tkwin = butPtr->tkwin;
- (void)btnbounds;
- (void)kind;
- (void)drawinfo;
- (void)depth;
- (void)isColorDev;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
@@ -1063,7 +1047,7 @@ TkMacOSXComputeButtonParams(
* the button periodically.
*/
- if (!mbPtr->defaultPulseHandler && ([NSApp macMinorVersion] <= 9)) {
+ if (!mbPtr->defaultPulseHandler && ([NSApp macOSVersion] <= 100900)) {
mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler(
PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr);
}
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index 7df5bb9..47203e2 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -177,7 +177,7 @@ XSetSelectionOwner(
Display *display, /* X Display. */
Atom selection, /* What selection to own. */
Window owner, /* Window to be the owner. */
- Time time) /* The current time? */
+ TCL_UNUSED(Time)) /* The current time? */
{
TkDisplay *dispPtr = TkGetDisplayList();
(void)time;
@@ -238,13 +238,11 @@ TkMacOSXSelDeadWindow(
void
TkSelUpdateClipboard(
- TkWindow *winPtr, /* Window associated with clipboard. */
- TkClipboardTarget *targetPtr)
+ TCL_UNUSED(TkWindow *), /* Window associated with clipboard. */
+ TCL_UNUSED(TkClipboardTarget *))
/* Info about the content. */
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
- (void)winPtr;
- (void)targetPtr;
changeCount = [pb addTypes:[NSArray arrayWithObject:NSStringPboardType]
owner:NSApp];
@@ -297,9 +295,8 @@ TkSelEventProc(
void
TkSelPropProc(
- XEvent *eventPtr) /* X PropertyChange event. */
+ TCL_UNUSED(XEvent *)) /* X PropertyChange event. */
{
- (void)eventPtr;
}
/*
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 40b537e..acbfa0e 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -1,5 +1,5 @@
/*
- * tkMacOSXColor.c --
+ * TkMacOSXColor.c --
*
* This file maintains a database of color values for the Tk
* toolkit, in order to avoid round-trips to the server to
@@ -9,6 +9,7 @@
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
* Copyright 2001-2009, Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,286 +17,272 @@
#include "tkMacOSXPrivate.h"
#include "tkColor.h"
+#include "tkMacOSXColor.h"
+
+static Tcl_HashTable systemColors;
+static int numSystemColors;
+static int rgbColorIndex;
+static int controlAccentIndex;
+static int selectedTabTextIndex;
+static Bool useFakeAccentColor = NO;
+static SystemColorDatum **systemColorIndex;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+static NSAppearance *lightAqua = nil;
+static NSAppearance *darkAqua = nil;
+#endif
+static NSColorSpace* sRGB = NULL;
+static const CGFloat WINDOWBACKGROUND[4] =
+ {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
-/*
- * The colorType specifies how the color value should be interpreted. For the
- * unique rgbColor entry, the RGB values are generated from the pixel value of
- * an XColor. The ttkBackground and semantic types are dynamic, meaning
- * that they change when dark mode is enabled on OSX 10.13 and later.
- */
+void initColorTable()
+{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ Tcl_InitHashTable(&systemColors, TCL_STRING_KEYS);
+ SystemColorDatum *entry, *oldEntry;
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr;
+ int newPtr, index = 0;
+ NSColorList *systemColorList = [NSColorList colorListNamed:@"System"];
+ NSString *key;
-enum colorType {
- clearColor, /* There should be only one of these. */
- rgbColor, /* There should be only one of these. */
- appearance, /* There should be only one of these. */
- HIBrush, /* The value is a HITheme brush color table index. */
- HIText, /* The value is a HITheme text color table index. */
- HIBackground, /* The value is a HITheme background color table index. */
- ttkBackground, /* The value can be used as a parameter.*/
- semantic, /* The value can be used as a parameter.*/
-};
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ if (@available(macOS 10.14, *)) {
+ darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
+ lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ }
+#endif
-/*
+ /*
+ * Build a hash table for looking up a color by its name.
+ * First add all of the static entries from tkMacOSXColor.h
+ */
- */
+ for (entry = systemColorData; entry->name != NULL; entry++) {
+ hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr);
+ if (entry->type == semantic) {
+ NSString *colorName = [[NSString alloc]
+ initWithCString:entry->macName
+ encoding:NSUTF8StringEncoding];
+ SEL colorSelector = NSSelectorFromString(colorName);
+ if (![NSColor respondsToSelector:colorSelector]) {
+ if ([colorName isEqualToString:@"controlAccentColor"]) {
+ useFakeAccentColor = YES;
+ } else if (![colorName isEqualToString:@"selectedTabTextColor"]) {
+ /* Uncomment to print all unsupported colors: */
+ /* printf("Unsupported color %s\n", colorName.UTF8String); */
+ continue;
+ }
+ }
+ entry->selector = [colorName retain];
+ }
+ if (newPtr == 0) {
+ oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ entry->index = oldEntry->index;
+ [oldEntry->selector release];
+ } else {
+ entry->index = index++;
+ }
+ Tcl_SetHashValue(hPtr, entry);
+ }
-struct SystemColorMapEntry {
- const char *name;
- enum colorType type;
- long value;
-}; /* unsigned char pixelCode; */
+ /*
+ * Add all of the colors in the System ColorList.
+ */
-/*
- * 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 !
- */
+ for (key in [systemColorList allKeys]) {
+ int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ char *name;
+ entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum));
+ bzero(entry, sizeof(SystemColorDatum));
+ name = (char *)ckalloc(length + 1);
+ strcpy(name, key.UTF8String);
+ name[0] = toupper(name[0]);
+ if (!strcmp(name, "WindowBackgroundColor")) {
+
+ /*
+ * Avoid black windows on old systems.
+ */
+
+ continue;
+ }
+ entry->type=semantic;
+ entry->name = name;
+ entry->selector = [key retain];
+ hPtr = Tcl_CreateHashEntry(&systemColors, entry->name, &newPtr);
+ if (newPtr == 0) {
+ oldEntry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ entry->index = oldEntry->index;
+ [oldEntry->selector release];
+ } else {
+ entry->index = index++;
+ }
+ Tcl_SetHashValue(hPtr, entry);
+ }
-#define MIN_PIXELCODE 30
-static const struct SystemColorMapEntry systemColorMap[] = {
- { "Transparent", clearColor, 0 }, /* 30: TRANSPARENT_PIXEL */
- { "Highlight", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 31 */
- { "HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 32 */
- { "HighlightText", HIBrush, kThemeBrushBlack }, /* 33 */
- { "HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 34 */
- { "ButtonText", HIText, kThemeTextColorPushButtonActive }, /* 35 */
- { "PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 36 */
- { "ButtonFace", HIBrush, kThemeBrushButtonFaceActive }, /* 37 */
- { "SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 38 */
- { "ButtonFrame", HIBrush, kThemeBrushButtonFrameActive }, /* 39 */
- { "AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 40 */
- { "WindowBody", HIBrush, kThemeBrushDocumentWindowBackground }, /* 41 */
- { "SheetBackground", HIBrush, kThemeBrushSheetBackground }, /* 42 */
- { "MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 43 */
- { "Black", HIBrush, kThemeBrushBlack }, /* 44 */
- { "MenuActiveText", HIText, kThemeTextColorMenuItemSelected }, /* 45 */
- { "White", HIBrush, kThemeBrushWhite }, /* 46 */
- { "Menu", HIBrush, kThemeBrushMenuBackground }, /* 47 */
- { "DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive }, /* 48 */
- { "MenuDisabled", HIText, kThemeTextColorMenuItemDisabled }, /* 49 */
- { "DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive }, /* 50 */
- { "MenuText", HIText, kThemeTextColorMenuItemActive }, /* 51 */
- { "AppearanceColor", appearance, 0 }, /* 52: APPEARANCE_PIXEL */
- { "AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive }, /* 53 */
- { "AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive }, /* 54 */
- { "ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive }, /* 55 */
- { "ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive }, /* 56 */
- { "UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive }, /* 57 */
- { "UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive }, /* 58 */
- { "ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground }, /* 59 */
- { "ListViewBackground", HIBrush, kThemeBrushListViewBackground }, /* 60 */
- { "IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground }, /* 61 */
- { "ListViewSeparator", HIBrush, kThemeBrushListViewSeparator }, /* 62 */
- { "ChasingArrows", HIBrush, kThemeBrushChasingArrows }, /* 63 */
- { "DragHilite", HIBrush, kThemeBrushDragHilite }, /* 64 */
- { "DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground }, /* 65 */
- { "FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground }, /* 66 */
- { "ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive }, /* 67 */
- { "ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive }, /* 68 */
- { "FocusHighlight", HIBrush, kThemeBrushFocusHighlight }, /* 69 */
- { "PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive }, /* 70 */
- { "PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed }, /* 71 */
- { "PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive }, /* 72 */
- { "AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark }, /* 73 */
- { "IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected }, /* 74 */
- { "StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill }, /* 75 */
- { "ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill }, /* 76 */
- { "ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive }, /* 77 */
- { "ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive }, /* 78 */
- { "ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive }, /* 79 */
- { "ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive }, /* 80 */
- { "ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed }, /* 81 */
- { "ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow }, /* 82 */
- { "ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight }, /* 83 */
- { "ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow }, /* 84 */
- { "ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight }, /* 85 */
- { "ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow }, /* 86 */
- { "ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight }, /* 87 */
- { "ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow }, /* 88 */
- { "ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight }, /* 89 */
- { "ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow }, /* 90 */
- { "ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight }, /* 91 */
- { "ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow }, /* 92 */
- { "ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight }, /* 93 */
- { "BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight }, /* 94 */
- { "BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark }, /* 95 */
- { "BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight }, /* 96 */
- { "BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark }, /* 97 */
- { "NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground }, /* 98 */
- { "MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground }, /* 99 */
- { "SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque }, /* 100 */
- { "DrawerBackground", HIBrush, kThemeBrushDrawerBackground }, /* 101 */
- { "ToolbarBackground", HIBrush, kThemeBrushToolbarBackground }, /* 102 */
- { "SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent }, /* 103 */
- { "MenuBackground", HIBrush, kThemeBrushMenuBackground }, /* 104 */
- { "Pixel", rgbColor, 0 }, /* 105: PIXEL_MAGIC */
- { "MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 106 */
- { "ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground }, /* 107 */
- { "ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground }, /* 108 */
- { "ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider }, /* 109 */
- { "BlackText", HIText, kThemeTextColorBlack }, /* 110 */
- { "DialogActiveText", HIText, kThemeTextColorDialogActive }, /* 111 */
- { "DialogInactiveText", HIText, kThemeTextColorDialogInactive }, /* 112 */
- { "AlertActiveText", HIText, kThemeTextColorAlertActive }, /* 113 */
- { "AlertInactiveText", HIText, kThemeTextColorAlertInactive }, /* 114 */
- { "ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive }, /* 115 */
- { "ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive }, /* 116 */
- { "WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive }, /* 117 */
- { "WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive }, /* 118 */
- { "PlacardActiveText", HIText, kThemeTextColorPlacardActive }, /* 119 */
- { "PlacardInactiveText", HIText, kThemeTextColorPlacardInactive }, /* 120 */
- { "PlacardPressedText", HIText, kThemeTextColorPlacardPressed }, /* 121 */
- { "PushButtonActiveText", HIText, kThemeTextColorPushButtonActive }, /* 122 */
- { "PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive }, /* 123 */
- { "PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed }, /* 124 */
- { "BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive }, /* 125 */
- { "BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive }, /* 126 */
- { "BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed }, /* 127 */
- { "PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive }, /* 128 */
- { "PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive }, /* 129 */
- { "PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed }, /* 130 */
- { "IconLabelText", HIText, kThemeTextColorIconLabel }, /* 131 */
- { "ListViewText", HIText, kThemeTextColorListView }, /* 132 */
- { "DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive }, /* 133 */
- { "DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive }, /* 134 */
- { "MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive }, /* 135 */
- { "MovableModalWindowTitleInactiveText",HIText, kThemeTextColorMovableModalWindowTitleInactive }, /* 136 */
- { "UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive }, /* 137 */
- { "UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive }, /* 138 */
- { "PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive }, /* 139 */
- { "PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive }, /* 140 */
- { "RootMenuActiveText", HIText, kThemeTextColorRootMenuActive }, /* 141 */
- { "RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected }, /* 142 */
- { "RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled }, /* 143 */
- { "MenuItemActiveText", HIText, kThemeTextColorMenuItemActive }, /* 144 */
- { "MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected }, /* 145 */
- { "MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled }, /* 146 */
- { "PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive }, /* 147 */
- { "PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive }, /* 148 */
- { "TabFrontActiveText", HIText, kThemeTextColorTabFrontActive }, /* 149 */
- { "TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive }, /* 150 */
- { "TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed }, /* 151 */
- { "TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive }, /* 152 */
- { "TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive }, /* 153 */
- { "IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected }, /* 154 */
- { "BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive }, /* 155 */
- { "BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive }, /* 156 */
- { "NotificationText", HIText, kThemeTextColorNotification }, /* 157 */
- { "SystemDetailText", HIText, kThemeTextColorSystemDetail }, /* 158 */
- { "WhiteText", HIText, kThemeTextColorWhite }, /* 159 */
- { "TabPaneBackground", HIBackground, kThemeBackgroundTabPane }, /* 160 */
- { "PlacardBackground", HIBackground, kThemeBackgroundPlacard }, /* 161 */
- { "WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader }, /* 162 */
- { "ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader }, /* 163 */
- { "SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox }, /* 164 */
- { "MetalBackground", HIBackground, kThemeBackgroundMetal }, /* 165 */
+ /*
+ * Build an array for looking up a color by its index.
+ */
+
+ numSystemColors = index;
+ systemColorIndex = (SystemColorDatum **)ckalloc(numSystemColors * sizeof(SystemColorDatum *));
+ for (hPtr = Tcl_FirstHashEntry(&systemColors, &search); hPtr != NULL;
+ hPtr = Tcl_NextHashEntry(&search)) {
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ if (entry == NULL) {
+ Tcl_Panic("Unsupported semantic color with no supported backup!");
+ }
+ systemColorIndex[entry->index] = entry;
+ }
/*
- * Colors based on "semantic" NSColors.
+ * Remember the indexes of some special entries.
*/
- { "WindowBackgroundColor", ttkBackground, 0 }, /* 166 */
- { "WindowBackgroundColor1", ttkBackground, 1 }, /* 167 */
- { "WindowBackgroundColor2", ttkBackground, 2 }, /* 168 */
- { "WindowBackgroundColor3", ttkBackground, 3 }, /* 169 */
- { "WindowBackgroundColor4", ttkBackground, 4 }, /* 170 */
- { "WindowBackgroundColor5", ttkBackground, 5 }, /* 171 */
- { "WindowBackgroundColor6", ttkBackground, 6 }, /* 172 */
- { "WindowBackgroundColor7", ttkBackground, 7 }, /* 173 */
- { "TextColor", semantic, 0 }, /* 174 */
- { "SelectedTextColor", semantic, 1 }, /* 175 */
- { "LabelColor", semantic, 2 }, /* 176 */
- { "ControlTextColor", semantic, 3 }, /* 177 */
- { "DisabledControlTextColor", semantic, 4 }, /* 178 */
- { "SelectedTabTextColor", semantic, 5 }, /* 179 */
- { "TextBackgroundColor", semantic, 6 }, /* 180 */
- { "SelectedTextBackgroundColor", semantic, 7 }, /* 181 */
- { "ControlAccentColor", semantic, 8 }, /* 182 */
- /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */
- { "SecondaryLabelColor", ttkBackground, 14 }, /* 183 */
- { "LinkColor", semantic, 9 }, /* 184 */
- { NULL, 0, 0 }
-};
-#define FIRST_SEMANTIC_COLOR 166
-#define MAX_PIXELCODE 184
+ hPtr = Tcl_FindHashEntry(&systemColors, "Pixel");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ rgbColorIndex = entry->index;
+ hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ controlAccentIndex = entry->index;
+ hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ selectedTabTextIndex = entry->index;
+ [pool drain];
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXRGBPixel --
+ *
+ * Return an unsigned long value suitable for use in the pixel
+ * field of an XColor with the specified red, green and blue
+ * intensities. The inputs are cast as unsigned longs but are
+ * expected to have values representable by an unsigned char.
+ *
+ * This is called in the TkpGetPixel macro, used in xcolor.c,
+ * and in ImageGetPixel.
+ *
+ * Results:
+ * An unsigned long that can be used as the pixel field of an XColor.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+MODULE_SCOPE
+unsigned long
+TkMacOSXRGBPixel(
+ unsigned long red,
+ unsigned long green,
+ unsigned long blue)
+{
+ MacPixel p;
+ p.pixel.colortype = rgbColor;
+ p.pixel.value = ((red & 0xff) << 16) |
+ ((green & 0xff) << 8) |
+ (blue & 0xff);
+ return p.ulong;
+}
/*
*----------------------------------------------------------------------
*
- * GetEntryFromPixelCode --
+ * TkMacOSXClearPixel --
*
- * Extract a SystemColorMapEntry from the table.
+ * Return the unsigned long value that appears in the pixel
+ * field of the XColor for systemTransparentColor.
+ *
+ * This is used in tkMacOSXImage.c.
*
* Results:
- * Returns false if the code is out of bounds.
+ * The unsigned long that appears in the pixel field of the XColor
+ * for systemTransparentPixel.
*
* Side effects:
* None.
+ *----------------------------------------------------------------------
+ */
+MODULE_SCOPE
+unsigned long TkMacOSXClearPixel(
+ void)
+{
+ MacPixel p;
+ p.pixel.value = 0;
+ p.pixel.colortype = clearColor;
+ return p.ulong;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetEntryFromPixel --
+ *
+ * Look up a SystemColorDatum which describes the XColor with
+ * the specified value as its pixel field.
+ *
+ * Results:
+ * A pointer to a SystemColorDatum, or NULL if the pixel value is
+ * invalid.
+ *
+ * Side effects:
+ * None
*
*----------------------------------------------------------------------
*/
-static bool
-GetEntryFromPixelCode(
- unsigned char code,
- struct SystemColorMapEntry *entry)
+SystemColorDatum*
+GetEntryFromPixel(
+ unsigned long pixel)
{
- if (code >= MIN_PIXELCODE && code <= MAX_PIXELCODE) {
- *entry = systemColorMap[code - MIN_PIXELCODE];
- return true;
+ MacPixel p;
+ int index = rgbColorIndex;
+
+ p.ulong = pixel;
+ if (p.pixel.colortype != rgbColor) {
+ index = p.pixel.value;
+ }
+ if (index < numSystemColors) {
+ return systemColorIndex[index];
} else {
- return false;
+ return NULL;
}
}
+
/*
*----------------------------------------------------------------------
*
- * SetCGColorComponents --
+ * GetRGBA --
*
- * Set the components of a CGColorRef from an XColor pixel value and a
- * system color map entry. The pixel value is only used in the case where
- * the color is of type rgbColor. In that case the normalized XColor RGB
- * values are copied into the CGColorRef.
+ * Given a SystemColorDatum and a pointer to an array of 4 CGFloats, store
+ * the associated RGBA color values in the array. In the case of the
+ * RGBColor datum, the unsigned long pixel value containing the RGB values
+ * must also be provided as the pixel parameter. Otherwise the pixel
+ * parameter is ignored.
*
* Results:
- * OSStatus
+ * None
*
* Side effects:
- * None.
+ * The array rgba is filled in.
*
*----------------------------------------------------------------------
*/
-static NSColorSpace* sRGB = NULL;
-static CGFloat windowBackground[4] =
- {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
-
-static OSStatus
-SetCGColorComponents(
- struct SystemColorMapEntry entry,
+static void
+GetRGBA(
+ SystemColorDatum *entry,
unsigned long pixel,
- CGColorRef *c)
+ CGFloat *rgba)
{
- OSStatus err = noErr;
NSColor *bgColor, *color = nil;
- CGFloat rgba[4] = {0, 0, 0, 1};
if (!sRGB) {
sRGB = [NSColorSpace sRGBColorSpace];
}
-
- /*
- * This function is called before our autorelease pool is set up,
- * so it needs its own pool.
- */
-
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
- switch (entry.type) {
- case HIBrush:
- err = ChkErr(HIThemeBrushCreateCGColor, entry.value, c);
- return err;
+ switch (entry->type) {
case rgbColor:
rgba[0] = ((pixel >> 16) & 0xff) / 255.0;
rgba[1] = ((pixel >> 8) & 0xff) / 255.0;
@@ -308,9 +295,9 @@ SetCGColorComponents(
* windowBackGroundColor.
*/
- if ([NSApp macMinorVersion] < 14) {
- for (int i=0; i<3; i++) {
- rgba[i] = windowBackground[i];
+ if ([NSApp macOSVersion] < 101400) {
+ for (int i = 0; i < 3; i++) {
+ rgba[i] = WINDOWBACKGROUND[i];
}
} else {
bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB];
@@ -318,104 +305,80 @@ SetCGColorComponents(
}
if (rgba[0] + rgba[1] + rgba[2] < 1.5) {
for (int i=0; i<3; i++) {
- rgba[i] += entry.value*8.0 / 255.0;
+ rgba[i] += entry->value*8.0 / 255.0;
}
} else {
for (int i=0; i<3; i++) {
- rgba[i] -= entry.value*8.0 / 255.0;
+ rgba[i] -= entry->value*8.0 / 255.0;
}
}
break;
case semantic:
- switch (entry.value) {
- case 0:
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- break;
- case 1:
- color = [[NSColor selectedTextColor] colorUsingColorSpace:sRGB];
- break;
- case 2:
- if ([NSApp macMinorVersion] > 9) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
- color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
+ if (entry->index == controlAccentIndex && useFakeAccentColor) {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
+ color = [[NSColor colorForControlTint: [NSColor currentControlTint]]
+ colorUsingColorSpace:sRGB];
#endif
- } else {
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- }
- break;
- case 3:
- color = [[NSColor controlTextColor] colorUsingColorSpace:sRGB];
- break;
- case 4:
- color = [[NSColor disabledControlTextColor]
- colorUsingColorSpace:sRGB];
- break;
- case 5:
- if ([NSApp macMinorVersion] > 6) {
+ } else if (entry->index == selectedTabTextIndex) {
+ int OSVersion = [NSApp macOSVersion];
+ if (OSVersion > 100600 && OSVersion < 110000) {
color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
- } else {
- color = [[NSColor blackColor] colorUsingColorSpace:sRGB];
}
- break;
- case 6:
- color = [[NSColor textBackgroundColor] colorUsingColorSpace:sRGB];
- break;
- case 7:
- color = [[NSColor selectedTextBackgroundColor]
- colorUsingColorSpace:sRGB];
- break;
- case 8:
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- if (@available(macOS 14, *)) {
- color = [[NSColor controlAccentColor] colorUsingColorSpace:sRGB];
-#else
- if(false) {
-#endif
- } else {
- color = [[NSColor
- colorForControlTint:[NSColor currentControlTint]]
- colorUsingColorSpace: sRGB];
- }
- break;
- case 9:
- if ([NSApp macMinorVersion] >= 10) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
- color = [[NSColor linkColor] colorUsingColorSpace:sRGB];
-#endif
- } else {
- color = [[NSColor blueColor] colorUsingColorSpace:sRGB];
- }
- break;
- default:
- if ([NSApp macMinorVersion] >= 10) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
- color = [[NSColor labelColor] colorUsingColorSpace:sRGB];
-#endif
- } else {
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- }
- break;
+ } else {
+ color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB];
}
[color getComponents: rgba];
break;
case clearColor:
- rgba[3] = 0.0;
+ rgba[3] = 0;
+ default:
break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SetCGColorComponents --
+ *
+ * Set the components of a CGColorRef from an XColor pixel value and a
+ * SystemColorDatum. The pixel value is only used in the case where
+ * the color is of type rgbColor. In that case the normalized XColor RGB
+ * values are copied into the CGColorRef. Otherwise the components are
+ * computed from the SystemColorDatum.
+ *
+ * Results:
+ * True if the function succeeds, false otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Bool
+SetCGColorComponents(
+ SystemColorDatum *entry,
+ unsigned long pixel,
+ CGColorRef *c)
+{
+ CGFloat rgba[4] = {0, 0, 0, 1};
/*
- * There are no HITheme functions which convert Text or background colors
- * to CGColors. (GetThemeTextColor has been removed, and it was never
- * possible with backgrounds.) If we get one of these we return black.
+ * This function is called before our autorelease pool is set up,
+ * so it needs its own pool.
*/
- case HIText:
- case HIBackground:
- default:
- break;
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
+ if (entry->type == HIBrush) {
+ OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c);
+ return err == noErr;
}
+ GetRGBA(entry, pixel, rgba);
*c = CGColorCreate(sRGB.CGColorSpace, rgba);
[pool drain];
- return err;
+ return true;
}
/*
@@ -437,27 +400,24 @@ SetCGColorComponents(
MODULE_SCOPE Bool
TkMacOSXInDarkMode(Tk_Window tkwin)
{
- int result = false;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua";
-
- if ([NSApp macMinorVersion] >= 14) {
+ if (@available(macOS 10.14, *)) {
TkWindow *winPtr = (TkWindow*) tkwin;
+ NSAppearanceName name;
NSView *view = nil;
if (winPtr && winPtr->privatePtr) {
- view = TkMacOSXDrawableView(winPtr->privatePtr);
+ view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr);
}
if (view) {
- result = [view.effectiveAppearance.name isEqualToString:darkAqua];
+ name = [[view effectiveAppearance] name];
} else {
- result = [[NSAppearance currentAppearance].name
- isEqualToString:darkAqua];
+ name = [[NSAppearance currentAppearance] name];
}
+ return (name == NSAppearanceNameDarkAqua);
}
#endif
-
- return result;
+ return false;
}
/*
@@ -465,14 +425,13 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
*
* TkSetMacColor --
*
- * Sets the components of a CGColorRef from an XColor pixel value.
- * The high order byte of the pixel value is used as an index into
- * the system color table, and then SetCGColorComponents is called
- * with the table entry and the pixel value.
+ * Sets the components of a CGColorRef from an XColor pixel value. The
+ * pixel value is used to look up the color in the system color table, and
+ * then SetCGColorComponents is called with the table entry and the pixel
+ * value.
*
* Results:
- * Returns false if the high order byte is not a valid index, true
- * otherwise.
+ * Returns false if the color is not found, true otherwise.
*
* Side effects:
* The variable macColor is set to a new CGColorRef, the caller is
@@ -487,13 +446,13 @@ TkSetMacColor(
void *macColor) /* CGColorRef to modify. */
{
CGColorRef *color = (CGColorRef*)macColor;
- OSStatus err = -1;
- struct SystemColorMapEntry entry;
+ SystemColorDatum *entry = GetEntryFromPixel(pixel);
- if (GetEntryFromPixelCode((pixel >> 24) & 0xff, &entry)) {
- err = ChkErr(SetCGColorComponents, entry, pixel, color);
+ if (entry) {
+ return SetCGColorComponents(entry, pixel, color);
+ } else {
+ return false;
}
- return (err == noErr);
}
/*
@@ -506,7 +465,7 @@ TkSetMacColor(
* Results:
* None resp. retained CGColorRef for CopyCachedColor()
*
- * Side effects:M
+ * Side effects:
* None.
*
*----------------------------------------------------------------------
@@ -614,9 +573,10 @@ TkMacOSXCreateCGColor(
* TkMacOSXGetNSColor --
*
* Creates an autoreleased NSColor from a X style pixel value.
+ * The return value is nil if the pixel value is invalid.
*
* Results:
- * Returns nil if not a real pixel, NSColor* otherwise.
+ * A possibly nil pointer to an NSColor.
*
* Side effects:
* None
@@ -650,10 +610,9 @@ TkMacOSXGetNSColor(
*
* 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.
+ * Sets the fill and stroke colors in the given CGContext to the CGColor
+ * which corresponds to the XColor having the specified value for its pixel
+ * field.
*
* Results:
* None.
@@ -672,37 +631,20 @@ TkMacOSXSetColorInContext(
{
OSStatus err = noErr;
CGColorRef cgColor = nil;
- struct SystemColorMapEntry entry;
- CGRect rect;
- int code = (pixel >> 24) & 0xff;
- HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};;
+ SystemColorDatum *entry = GetEntryFromPixel(pixel);
- if (code < FIRST_SEMANTIC_COLOR) {
- cgColor = CopyCachedColor(gc, pixel);
- }
- if (!cgColor && GetEntryFromPixelCode(code, &entry)) {
- switch (entry.type) {
+ if (entry) {
+ switch (entry->type) {
case HIBrush:
- err = ChkErr(HIThemeSetFill, entry.value, NULL, context,
+ err = ChkErr(HIThemeSetFill, entry->value, NULL, context,
kHIThemeOrientationNormal);
if (err == noErr) {
- err = ChkErr(HIThemeSetStroke, entry.value, NULL, context,
+ err = ChkErr(HIThemeSetStroke, entry->value, NULL, context,
kHIThemeOrientationNormal);
}
break;
- case HIText:
- err = ChkErr(HIThemeSetTextFill, entry.value, NULL, context,
- kHIThemeOrientationNormal);
- break;
- case HIBackground:
- info.kind = entry.value;
- rect = CGContextGetClipBoundingBox(context);
- err = ChkErr(HIThemeApplyBackground, &rect, &info,
- context, kHIThemeOrientationNormal);
- break;
default:
- err = ChkErr(SetCGColorComponents, entry, pixel, &cgColor);
- if (err == noErr) {
+ if (SetCGColorComponents(entry, pixel, &cgColor)){
SetCachedColor(gc, pixel, cgColor);
}
break;
@@ -723,15 +665,20 @@ TkMacOSXSetColorInContext(
*
* TkpGetColor --
*
- * Allocate a new TkColor for the color with the given name.
+ * Create a new TkColor for the color with the given name, for use in the
+ * specified window. The colormap field is set to lightColormap if the
+ * window has a LightAqua appearance, or darkColormap if the window has a
+ * DarkAqua appearance. TkColors with different colormaps are managed
+ * separately in the per-display table of TkColors maintained by Tk.
+ *
+ * This function is called by Tk_GetColor.
*
* 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.
+ *
+ * Allocates memory for the TkColor structure.
*
*----------------------------------------------------------------------
*/
@@ -742,31 +689,68 @@ TkpGetColor(
Tk_Uid name) /* Name of color to be allocated (in form
* suitable for passing to XParseColor). */
{
- Display *display = tkwin != None ? Tk_Display(tkwin) : NULL;
- Colormap colormap = tkwin!= None ? Tk_Colormap(tkwin) : None;
+ Display *display = NULL;
TkColor *tkColPtr;
XColor color;
+ Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap;
+ NSView *view = nil;
+ static Bool initialized = NO;
+ static NSColorSpace* sRGB = NULL;
+
+ if (!initialized) {
+ initialized = YES;
+ sRGB = [NSColorSpace sRGBColorSpace];
+ initColorTable();
+ }
+ if (tkwin) {
+ display = Tk_Display(tkwin);
+ Drawable d = Tk_WindowId(tkwin);
+ view = TkMacOSXGetNSViewForDrawable(d);
+ }
/*
- * Check to see if this is a system color. Otherwise, XParseColor
- * will do all the work.
+ * Check to see if this is a system color. If not, just call XParseColor.
*/
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;
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&systemColors, name + 6);
+ MacPixel p;
+
+ if (hPtr != NULL) {
+ SystemColorDatum *entry = (SystemColorDatum *)Tcl_GetHashValue(hPtr);
CGColorRef c;
- unsigned char pixelCode = idx + MIN_PIXELCODE;
- struct SystemColorMapEntry entry = systemColorMap[idx];
- err = ChkErr(SetCGColorComponents, entry, 0, &c);
- if (err == noErr) {
+ p.pixel.colortype = entry->type;
+ p.pixel.value = entry->index;
+ color.pixel = p.ulong;
+ if (entry->type == semantic) {
+ CGFloat rgba[4];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ if (@available(macOS 10.14, *)) {
+ NSAppearance *savedAppearance = [NSAppearance currentAppearance];
+ NSAppearance *windowAppearance = savedAppearance;
+ if (view) {
+ windowAppearance = [view effectiveAppearance];
+ }
+ if ([windowAppearance name] == NSAppearanceNameDarkAqua) {
+ colormap = darkColormap;
+ } else {
+ colormap = lightColormap;
+ }
+ [NSAppearance setCurrentAppearance:windowAppearance];
+ GetRGBA(entry, p.ulong, rgba);
+ [NSAppearance setCurrentAppearance:savedAppearance];
+ } else {
+ GetRGBA(entry, p.ulong, rgba);
+ }
+#else
+ GetRGBA(entry, p.ulong, rgba);
+#endif
+ color.red = rgba[0] * 65535.0;
+ color.green = rgba[1] * 65535.0;
+ color.blue = rgba[2] * 65535.0;
+ goto validXColor;
+ } else if (SetCGColorComponents(entry, 0, &c)) {
const size_t n = CGColorGetNumberOfComponents(c);
const CGFloat *rgba = CGColorGetComponents(c);
@@ -782,25 +766,19 @@ TkpGetColor(
default:
Tcl_Panic("CGColor with %d components", (int) n);
}
- color.pixel = ((((((pixelCode << 8)
- | ((color.red >> 8) & 0xff)) << 8)
- | ((color.green >> 8) & 0xff)) << 8)
- | ((color.blue >> 8) & 0xff));
CGColorRelease(c);
goto validXColor;
}
- CGColorRelease(c);
}
}
-
if (TkParseColor(display, colormap, name, &color) == 0) {
return NULL;
}
validXColor:
tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
+ tkColPtr->colormap = colormap;
tkColPtr->color = color;
-
return tkColPtr;
}
@@ -809,36 +787,35 @@ validXColor:
*
* 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.
+ * Given an pointer to an XColor, construct a TkColor whose red, green and
+ * blue intensities match those of the XColor as closely as possible. For
+ * the Macintosh, this means that the colortype bitfield of the pixel
+ * value will be RGBColor and that the color intensities stored in its
+ * 24-bit value bitfield are computed from the 16-bit red green and blue
+ * values in the XColor by dividing by 256.
*
* 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.
+ * A pointer to a newly allocated TkColor structure.
*
* Side effects:
* May invalidate the colormap cache for the specified window.
- * Allocates a new TkColor structure.
+ * Allocates memory for a TkColor structure.
*
*----------------------------------------------------------------------
*/
TkColor *
TkpGetColorByValue(
- Tk_Window tkwin, /* Window in which color will be used. */
+ TCL_UNUSED(Tk_Window), /* Window in which color will be used. */
XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor));
- (void)tkwin;
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
tkColPtr->color.blue = colorPtr->blue;
- tkColPtr->color.pixel = TkpGetPixel(&tkColPtr->color);
+ tkColPtr->color.pixel = TkpGetPixel(colorPtr);
return tkColPtr;
}
@@ -862,11 +839,9 @@ TkpGetColorByValue(
Status
XAllocColor(
Display *display, /* Display. */
- Colormap map, /* Not used. */
+ TCL_UNUSED(Colormap), /* Not used. */
XColor *colorPtr) /* XColor struct to modify. */
{
- (void)map;
-
display->request++;
colorPtr->pixel = TkpGetPixel(colorPtr);
return 1;
@@ -874,52 +849,39 @@ XAllocColor(
Colormap
XCreateColormap(
- Display *display, /* Display. */
- Window window, /* X window. */
- Visual *visual, /* Not used. */
- int alloc) /* Not used. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Window), /* X window. */
+ TCL_UNUSED(Visual *), /* Not used. */
+ TCL_UNUSED(int)) /* Not used. */
{
- static Colormap index = 1;
- (void)display;
- (void)window;
- (void)visual;
- (void)alloc;
+ static Colormap index = 16;
/*
- * Just return a new value each time.
+ * Just return a new value each time, large enough that it will not
+ * conflict with any value of the macColormap enum.
*/
return index++;
}
int
XFreeColormap(
- Display* display, /* Display. */
- Colormap colormap) /* Colormap. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Colormap)) /* Colormap. */
{
- (void)display;
- (void)colormap;
-
return Success;
}
int
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. */
+ TCL_UNUSED(Display *), /* Display. */
+ TCL_UNUSED(Colormap), /* Colormap. */
+ TCL_UNUSED(unsigned long *), /* Array of pixels. */
+ TCL_UNUSED(int), /* Number of pixels. */
+ TCL_UNUSED(unsigned long)) /* Number of pixel planes. */
{
- (void)display;
- (void)colormap;
- (void)pixels;
- (void)npixels;
- (void)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.
+ * Nothing needs to be done to release colors as there really is no
+ * colormap in the Tk sense.
*/
return Success;
}
diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h
new file mode 100644
index 0000000..7449095
--- /dev/null
+++ b/macosx/tkMacOSXColor.h
@@ -0,0 +1,198 @@
+#ifndef MACOSXCOLOR_H
+#define MACOSXCOLOR_H
+/*
+ * The generic Tk code uses the X11 GC type to describe a graphics context.
+ * (A GC is a pointer to a struct XGCValues). The foreground and background
+ * colors in a GC are unsigned longs. These are meant to be used as indexes
+ * into a table of XColors, where an XColor is declared in Xlib.h as:
+ * typedef struct {
+ * unsigned long pixel;
+ * unsigned short red, green, blue;
+ * char flags;
+ * char pad;
+ * } XColor;
+ *
+ * The xlib function XParseColor creates XColors from strings. It recognizes
+ * literal hexadecimal color specifications such as "#RRGGBB" as well as the
+ * standard X11 color names. When XParseColor creates an XColor it fills in
+ * all of the fields except for the pixel field, and then passes the XColor
+ * to TkpGetPixel to get a value to use for the pixel field. Since TkpGetPixel
+ * is platform specific, each platform is free to choose a value which can
+ * be used to set the foreground or background color in the platform's graphics
+ * context.
+ *
+ * Tk represents a color by a struct TkColor, which extends the XColor struct.
+ * Tk provides a mapping from color names to TkColors which extends the mapping
+ * provided by XParseColor but also allows for platform specific color names.
+ * By convention, these platform specific color names begin with the string
+ * "system". The mapping from names to TkColors is implemented by the function
+ * TkpGetColor defined for the Macintosh in this file. The pixel field in the
+ * XColor contained in a TkColor will be stored in the X11 graphics context.
+ * In X11 the pixel field is used as an index into a colormap. On the Mac
+ * the high order byte of the pixel is used to indicate a color type and
+ * the low 24 bits are either used as an rgb value (if the type is rgbColor)
+ * or as an index into a table of color descriptions.
+ */
+
+enum colorType {
+ rgbColor, /* The 24 bit value is an rgb color. */
+ clearColor, /* The unique rgba color with all channels 0. */
+ HIBrush, /* A HITheme brush color.*/
+ ttkBackground, /* A background color which indicates nesting level.*/
+ semantic, /* A semantic NSColor.*/
+};
+
+typedef struct xpixel_t {
+ unsigned value: 24; /* Either RGB or an index into systemColorData. */
+ unsigned colortype: 8;
+} xpixel;
+
+typedef union MacPixel_t {
+ unsigned long ulong;
+ xpixel pixel;
+} MacPixel;
+
+/*
+ * We maintain two colormaps, one for the LightAqua appearance and one for the
+ * DarkAqua appearance.
+ */
+
+enum macColormap {
+ noColormap,
+ lightColormap,
+ darkColormap,
+};
+
+/*
+ * In TkMacOSXColor.c a Tk hash table is constructed from the static data
+ * below to map system color names to CGColors.
+ */
+
+typedef struct {
+ const char *name;
+ enum colorType type;
+ int value;
+ const char *macName;
+ /* Fields below are filled in after or during construction of the hash table. */
+ int index;
+ NSString *selector;
+} SystemColorDatum;
+
+/*
+ * WARNING: Semantic colors which are not supported on all systems must be
+ * preceded by a backup color with the same name which *is* supported. Systems
+ * which do support the color will replace the backup value when the table is
+ * constructed. Failing to ensure this will result in a Tcl_Panic abort.
+ */
+
+static SystemColorDatum systemColorData[] = {
+{"Pixel", rgbColor, 0, NULL, 0, NULL },
+{"Transparent", clearColor, 0, NULL, 0, NULL },
+
+{"Highlight", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL },
+{"HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL },
+{"HighlightText", HIBrush, kThemeBrushBlack, NULL, 0, NULL },
+{"HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL },
+{"PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor, NULL, 0, NULL },
+{"ButtonFace", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL },
+{"SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor, NULL, 0, NULL },
+{"ButtonFrame", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL },
+{"AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor, NULL, 0, NULL },
+{"WindowBody", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL },
+{"SheetBackground", HIBrush, kThemeBrushSheetBackground, NULL, 0, NULL },
+{"MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL },
+{"Menu", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL },
+{"DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive, NULL, 0, NULL },
+{"DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive, NULL, 0, NULL },
+{"AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive, NULL, 0, NULL },
+{"AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive, NULL, 0, NULL },
+{"ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive, NULL, 0, NULL },
+{"ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive, NULL, 0, NULL },
+{"UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive, NULL, 0, NULL },
+{"UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive, NULL, 0, NULL },
+{"ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground, NULL, 0, NULL },
+{"ListViewBackground", HIBrush, kThemeBrushListViewBackground, NULL, 0, NULL },
+{"IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground, NULL, 0, NULL },
+{"ListViewSeparator", HIBrush, kThemeBrushListViewSeparator, NULL, 0, NULL },
+{"ChasingArrows", HIBrush, kThemeBrushChasingArrows, NULL, 0, NULL },
+{"DragHilite", HIBrush, kThemeBrushDragHilite, NULL, 0, NULL },
+{"DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground, NULL, 0, NULL },
+{"FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground, NULL, 0, NULL },
+{"ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive, NULL, 0, NULL },
+{"ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive, NULL, 0, NULL },
+{"FocusHighlight", HIBrush, kThemeBrushFocusHighlight, NULL, 0, NULL },
+{"PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive, NULL, 0, NULL },
+{"PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed, NULL, 0, NULL },
+{"PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive, NULL, 0, NULL },
+{"AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark, NULL, 0, NULL },
+{"IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected, NULL, 0, NULL },
+{"StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill, NULL, 0, NULL },
+{"ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill, NULL, 0, NULL },
+{"ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive, NULL, 0, NULL },
+{"ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive, NULL, 0, NULL },
+{"ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive, NULL, 0, NULL },
+{"ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive, NULL, 0, NULL },
+{"ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed, NULL, 0, NULL },
+{"ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow, NULL, 0, NULL },
+{"ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight, NULL, 0, NULL },
+{"ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow, NULL, 0, NULL },
+{"ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight, NULL, 0, NULL },
+{"ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow, NULL, 0, NULL },
+{"ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight, NULL, 0, NULL },
+{"ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow, NULL, 0, NULL },
+{"ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight, NULL, 0, NULL },
+{"ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow, NULL, 0, NULL },
+{"ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight, NULL, 0, NULL },
+{"ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow, NULL, 0, NULL },
+{"ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight, NULL, 0, NULL },
+{"BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight, NULL, 0, NULL },
+{"BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark, NULL, 0, NULL },
+{"BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight, NULL, 0, NULL },
+{"BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark, NULL, 0, NULL },
+{"NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground, NULL, 0, NULL },
+{"MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground, NULL, 0, NULL },
+{"SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque, NULL, 0, NULL },
+{"DrawerBackground", HIBrush, kThemeBrushDrawerBackground, NULL, 0, NULL },
+{"ToolbarBackground", HIBrush, kThemeBrushToolbarBackground, NULL, 0, NULL },
+{"SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent, NULL, 0, NULL },
+{"MenuBackground", HIBrush, kThemeBrushMenuBackground, NULL, 0, NULL },
+{"MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected, NULL, 0, NULL },
+{"ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground, NULL, 0, NULL },
+{"ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground, NULL, 0, NULL },
+{"ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider, NULL, 0, NULL },
+
+ /*
+ * Dynamic Colors
+ */
+
+{"WindowBackgroundColor", ttkBackground, 0, NULL, 0, NULL },
+{"WindowBackgroundColor1", ttkBackground, 1, NULL, 0, NULL },
+{"WindowBackgroundColor2", ttkBackground, 2, NULL, 0, NULL },
+{"WindowBackgroundColor3", ttkBackground, 3, NULL, 0, NULL },
+{"WindowBackgroundColor4", ttkBackground, 4, NULL, 0, NULL },
+{"WindowBackgroundColor5", ttkBackground, 5, NULL, 0, NULL },
+{"WindowBackgroundColor6", ttkBackground, 6, NULL, 0, NULL },
+{"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL },
+/* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */
+{"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL },
+/* Color to use for notebook tab labels -- depends on OS version. */
+{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL },
+/* Semantic colors that we simulate on older systems which don't supoort them. */
+{"SelectedMenuItemTextColor", semantic, 0, "selectedMenuItemTextColor", 0, NULL },
+{"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL },
+{"LabelColor", semantic, 0, "blackColor", 0, NULL },
+{"LinkColor", semantic, 0, "blueColor", 0, NULL },
+{"PlaceholderTextColor", semantic, 0, "grayColor", 0, NULL },
+{"SeparatorColor", semantic, 0, "grayColor", 0, NULL },
+{NULL, 0, 0, NULL, 0, NULL }
+};
+
+#endif
+/*
+ * Local Variables:
+ * mode: objc
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index e019ea1..0b6ae2b 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -102,10 +102,18 @@ typedef NSInteger NSModalResponse;
#define NSStringPboardType NSPasteboardTypeString
#define NSOnState NSControlStateValueOn
#define NSOffState NSControlStateValueOff
-// Now we are also changing names of methods!
-#define graphicsContextWithGraphicsPort graphicsContextWithCGContext
#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
+#define NSWindowStyleMaskTexturedBackground 0
+#endif
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+#define GET_NSCONTEXT(context, flip) [NSGraphicsContext \
+ graphicsContextWithGraphicsPort:context flipped:flip]
+#else
+#define GET_NSCONTEXT(context, flip) [NSGraphicsContext \
+ graphicsContextWithCGContext:context flipped:NO]
#endif
+#endif
diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c
index 812f54e..9371889 100644
--- a/macosx/tkMacOSXCursor.c
+++ b/macosx/tkMacOSXCursor.c
@@ -187,15 +187,6 @@ static const struct CursorName cursorNames[] = {
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
@@ -375,14 +366,13 @@ FindCursorByName(
TkCursor *
TkGetCursorByName(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- Tk_Window tkwin, /* Window in which cursor will be used. */
+ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */
Tk_Uid string) /* Description of cursor. See manual entry
* for details on legal syntax. */
{
TkMacOSXCursor *macCursorPtr = NULL;
const char **argv = NULL;
int argc;
- (void)tkwin;
/*
* All cursor names are valid lists of one element (for
@@ -430,24 +420,16 @@ TkGetCursorByName(
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. */
+ TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */
+ TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */
+ TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */
+ TCL_UNUSED(int), /* Dimensions of cursor. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Location of hot-spot in cursor. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(XColor), /* Foreground color for cursor. */
+ TCL_UNUSED(XColor)) /* Background color for cursor. */
{
- (void)tkwin;
- (void)source;
- (void)mask;
- (void)width;
- (void)height;
- (void)xHot;
- (void)yHot;
- (void)fgColor;
- (void)bgColor;
-
return NULL;
}
@@ -498,17 +480,15 @@ TkpFreeCursor(
*----------------------------------------------------------------------
*/
-void
+static void
TkMacOSXInstallCursor(
- int resizeOverride)
+ void)
{
TkMacOSXCursor *macCursorPtr = gCurrentCursor;
static int cursorHidden = 0;
int cursorNone = 0;
- gResizeOverride = resizeOverride;
-
- if (resizeOverride || !macCursorPtr) {
+ if (!macCursorPtr) {
[[NSCursor arrowCursor] set];
} else {
switch (macCursorPtr->type) {
@@ -556,10 +536,6 @@ TkpSetCursor(
{
int cursorChanged = 1;
- if (!gTkOwnsCursor) {
- return;
- }
-
if (cursor == None) {
/*
* This is a little tricky. We can't really tell whether
@@ -578,34 +554,11 @@ TkpSetCursor(
}
if (Tk_MacOSXIsAppInFront() && cursorChanged) {
- TkMacOSXInstallCursor(gResizeOverride);
+ TkMacOSXInstallCursor();
}
}
/*
- *----------------------------------------------------------------------
- *
- * 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;
-}
-
-/*
* Local Variables:
* mode: objc
* c-basic-offset: 4
diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h
index efaaa91..8a6546f 100644
--- a/macosx/tkMacOSXDefault.h
+++ b/macosx/tkMacOSXDefault.h
@@ -45,7 +45,7 @@
#define INACTIVE_SELECT_BG "systemSelectedTextBackgroundColor"
#define TROUGH "#c3c3c3"
#define INDICATOR "#b03060"
-#define DISABLED "#a3a3a3"
+#define DISABLED "systemDisabledControlTextColor"
/*
* Defaults for labels, buttons, checkbuttons, and radiobuttons:
@@ -193,7 +193,7 @@
#define DEF_ENTRY_INSERT_WIDTH "1"
#define DEF_ENTRY_JUSTIFY "left"
#define DEF_ENTRY_PLACEHOLDER ""
-#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3"
+#define DEF_ENTRY_PLACEHOLDERFG "systemPlaceholderTextColor"
#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
@@ -311,24 +311,24 @@
* Defaults for menus overall:
*/
-#define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive"
-#define DEF_MENU_ACTIVE_BG_MONO BLACK
+#define DEF_MENU_ACTIVE_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENU_ACTIVE_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
-#define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText"
-#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_ACTIVE_FG_COLOR NORMAL_FG
+#define DEF_MENU_ACTIVE_FG_MONO NORMAL_FG
#define DEF_MENU_ACTIVE_RELIEF "flat"
-#define DEF_MENU_BG_COLOR "systemMenu"
-#define DEF_MENU_BG_MONO WHITE
+#define DEF_MENU_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENU_BG_MONO NORMAL_BG /*ignored*/
#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_DISABLED_FG_COLOR DISABLED
+#define DEF_MENU_DISABLED_FG_MONO DISABLED
#define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */
-#define DEF_MENU_FG "systemMenuText"
+#define DEF_MENU_FG NORMAL_FG
#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_SELECT_COLOR "systemSelectedMenuItemTextColor"
+#define DEF_MENU_SELECT_MONO "systemSelectedMenuItemTextColor"
#define DEF_MENU_TAKE_FOCUS "0"
#define DEF_MENU_TEAROFF "0"
#define DEF_MENU_TEAROFF_CMD NULL
@@ -340,12 +340,12 @@
*/
#define DEF_MENUBUTTON_ANCHOR "w"
-#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG
-#define DEF_MENUBUTTON_ACTIVE_BG_MONO WHITE
-#define DEF_MENUBUTTON_ACTIVE_FG_COLOR ACTIVE_FG
-#define DEF_MENUBUTTON_ACTIVE_FG_MONO BLACK
-#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
-#define DEF_MENUBUTTON_BG_MONO WHITE
+#define DEF_MENUBUTTON_ACTIVE_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_BG_MONO NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_ACTIVE_FG_COLOR "systemTextColor"
+#define DEF_MENUBUTTON_ACTIVE_FG_MONO "systemTextColor"
+#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG /*ignored*/
+#define DEF_MENUBUTTON_BG_MONO NORMAL_BG /*ignored*/
#define DEF_MENUBUTTON_BITMAP ""
#define DEF_MENUBUTTON_BORDER_WIDTH "0"
#define DEF_MENUBUTTON_CURSOR ""
@@ -357,7 +357,7 @@
#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 NORMAL_BG
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
#define DEF_MENUBUTTON_IMAGE NULL
#define DEF_MENUBUTTON_INDICATOR "1"
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index 898547e..91383d2 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -23,7 +23,7 @@
#define modalOK NSModalResponseOK
#define modalCancel NSModalResponseCancel
#endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090
-#define modalOther -1
+#define modalOther -1 // indicates that the -command option was used.
#define modalError -2
/*
@@ -52,6 +52,10 @@ typedef struct {
* filter. */
} filepanelFilterInfo;
+/*
+ * Only one of these is needed for the application, so they can be static.
+ */
+
static filepanelFilterInfo filterInfo;
static NSOpenPanel *openpanel;
static NSSavePanel *savepanel;
@@ -250,13 +254,13 @@ getFileURL(
} else if (returnCode == modalCancel) {
Tcl_ResetResult(callbackInfo->interp);
}
- if (panel == [NSApp modalWindow]) {
- [NSApp stopModalWithCode:returnCode];
- }
if (callbackInfo->cmdObj) {
Tcl_DecrRefCount(callbackInfo->cmdObj);
+ }
+ if (callbackInfo) {
ckfree(callbackInfo);
}
+ [NSApp stopModalWithCode:returnCode];
}
- (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode
@@ -356,14 +360,42 @@ static NSInteger showOpenSavePanel(
contextInfo:callbackInfo ];
}];
- modalReturnCode = callbackInfo->cmdObj ? modalOther :
- [panel runModal];
+ /*
+ * The sheet has been prepared, so now we have to run it as a modal
+ * window. Using [NSApp runModalForWindow:] on macOS 10.15 or later
+ * generates warnings on stderr. But using [NSOpenPanel runModal] or
+ * [NSSavePanel runModal] on 10.14 or earler does not cause the
+ * completion handler to run when the panel is closed.
+ */
+
+ if ([NSApp macOSVersion] > 101400) {
+ modalReturnCode = [panel runModal];
+ } else {
+ modalReturnCode = [NSApp runModalForWindow:panel];
+ }
} else {
- modalReturnCode = [panel runModal];
- [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode
- contextInfo:callbackInfo];
+
+ /*
+ * For the standalone file dialog, completion handlers do not work
+ * at all on macOS 10.14 and earlier.
+ */
+
+ if ([NSApp macOSVersion] > 101400) {
+ [panel beginWithCompletionHandler:^(NSModalResponse returnCode) {
+ [NSApp tkFilePanelDidEnd:panel
+ returnCode:returnCode
+ contextInfo:callbackInfo ];
+ }];
+ modalReturnCode = [panel runModal];
+ } else {
+ modalReturnCode = [panel runModal];
+ [NSApp tkFilePanelDidEnd:panel
+ returnCode:modalReturnCode
+ contextInfo:callbackInfo ];
+ [panel close];
+ }
}
- return modalReturnCode;
+ return callbackInfo->cmdObj ? modalOther : modalReturnCode;
}
/*
@@ -729,7 +761,7 @@ Tk_GetOpenFileObjCmd(
* panel. Prepend the title to the message in this case.
*/
- if ([NSApp macMinorVersion] > 10) {
+ if ([NSApp macOSVersion] > 101000) {
if (message) {
NSString *fullmessage =
[[NSString alloc] initWithFormat:@"%@\n%@", title, message];
@@ -818,7 +850,7 @@ Tk_GetOpenFileObjCmd(
[openpanel setDirectoryURL:fileURL];
}
if (haveParentOption) {
- parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
+ parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
parentIsKey = parent && [parent isKeyWindow];
} else {
parent = nil;
@@ -870,15 +902,15 @@ Tk_GetOpenFileObjCmd(
selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable
selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex];
} else {
- NSUInteger i;
+ NSUInteger j;
- for (i = 0; i < [filterInfo.fileTypeNames count]; i++) {
- if (filterCompatible(extension, i)) {
- selectedFilterIndex = i;
+ for (j = 0; j < [filterInfo.fileTypeNames count]; j++) {
+ if (filterCompatible(extension, j)) {
+ selectedFilterIndex = j;
break;
}
}
- if (i == selectedFilterIndex) {
+ if (j == selectedFilterIndex) {
selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex];
} else {
selectedFilter = @"";
@@ -917,7 +949,7 @@ Tk_GetSaveFileObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
int confirmOverwrite = 1;
@@ -1104,7 +1136,7 @@ Tk_GetSaveFileObjCmd(
[savepanel setNameFieldStringValue:@""];
}
if (haveParentOption) {
- parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
+ parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
parentIsKey = parent && [parent isKeyWindow];
} else {
parent = nil;
@@ -1159,7 +1191,7 @@ Tk_ChooseDirectoryObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
int index, len, mustexist = 0;
@@ -1246,10 +1278,10 @@ Tk_ChooseDirectoryObjCmd(
if (!directory) {
directory = @"/";
}
- parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
+ parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
[panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]];
if (haveParentOption) {
- parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
+ parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
parentIsKey = parent && [parent isKeyWindow];
} else {
parent = nil;
@@ -1283,64 +1315,9 @@ Tk_ChooseDirectoryObjCmd(
void
TkAboutDlg(void)
{
- NSImage *image;
- NSString *path = [NSApp tkFrameworkImagePath: @"Tk.tiff"];
-
- if (path) {
- image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];
- } else {
- image = [NSApp applicationIconImage];
- }
-
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
-
- [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
- [dateFormatter setDateFormat:@"Y"];
-
- NSString *year = [dateFormatter stringFromDate:[NSDate date]];
-
- [dateFormatter release];
-
- /*
- * This replaces the old about dialog with a standard alert that displays
- * correctly on 10.14.
- */
-
- NSString *version = @"Tcl " TCL_PATCH_LEVEL " & Tk " TCL_PATCH_LEVEL;
- NSString *url = @"www.tcl-lang.org";
- NSTextView *credits = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,300,300)];
- NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
- NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font
- forKey:NSFontAttributeName];
-
- [credits insertText: [[NSAttributedString alloc]
- initWithString:[NSString stringWithFormat: @"\n"
- "Tcl and Tk are distributed under a modified BSD license: "
- "www.tcl.tk/software/tcltk/license.html\n\n"
- "%1$C 1987-%2$@ Tcl Core Team and Contributers.\n\n"
- "%1$C 2011-%2$@ Kevin Walzer/WordTech Communications LLC.\n\n"
- "%1$C 2014-%2$@ Marc Culler.\n\n"
- "%1$C 2002-2012 Daniel A. Steffen.\n\n"
- "%1$C 2001-2009 Apple Inc.\n\n"
- "%1$C 2001-2002 Jim Ingham & Ian Reid\n\n"
- "%1$C 1998-2000 Jim Ingham & Ray Johnson\n\n"
- "%1$C 1998-2000 Scriptics Inc.\n\n"
- "%1$C 1996-1997 Sun Microsystems Inc.", 0xA9, year]
- attributes:textAttributes]
- replacementRange:NSMakeRange(0,0)];
- [credits setDrawsBackground:NO];
- [credits setEditable:NO];
-
- NSAlert *about = [[NSAlert alloc] init];
-
- [[about window] setTitle:@"About Tcl & Tk"];
- [about setMessageText: version];
- [about setInformativeText:url];
- about.accessoryView = credits;
- [about runModal];
- [about release];
+ [NSApp orderFrontStandardAboutPanel:nil];
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -1359,18 +1336,16 @@ TkAboutDlg(void)
int
TkMacOSXStandardAboutPanelObjCmd(
- ClientData dummy, /* Unused. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)dummy;
-
if (objc > 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
- TkAboutDlg();
+ [NSApp orderFrontStandardAboutPanel:nil];
return TCL_OK;
}
@@ -1397,7 +1372,7 @@ Tk_MessageBoxObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
char *str;
int i, result = TCL_ERROR, haveParentOption = 0;
int index, typeIndex, iconIndex, indexDefaultOption = 0;
@@ -1535,7 +1510,7 @@ Tk_MessageBoxObjCmd(
callbackInfo->cmdObj = cmdObj;
callbackInfo->interp = interp;
callbackInfo->typeIndex = typeIndex;
- parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window);
+ parent = TkMacOSXGetNSWindowForDrawable(((TkWindow *)tkwin)->window);
if (haveParentOption && parent && ![parent attachedSheet]) {
parentIsKey = [parent isKeyWindow];
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
@@ -1656,7 +1631,7 @@ enum FontchooserOption {
}
}
-- (NSUInteger) validModesForFontPanel: (NSFontPanel *) fontPanel
+- (NSUInteger) validModesForFontPanel: (NSFontPanel *)fontPanel
{
(void)fontPanel;
@@ -1665,7 +1640,7 @@ enum FontchooserOption {
NSFontPanelStrikethroughEffectModeMask;
}
-- (void) windowDidOrderOffScreen: (NSNotification *) notification
+- (void) windowDidOrderOffScreen: (NSNotification *)notification
{
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
@@ -1689,7 +1664,7 @@ enum FontchooserOption {
* None.
*
* Side effects:
- * Additional events may be place on the Tk event queue.
+ * Additional events may be placed on the Tk event queue.
*
*----------------------------------------------------------------------
*/
@@ -1708,7 +1683,7 @@ FontchooserEvent(
switch (kind) {
case FontchooserClosed:
if (fcdPtr->parent != None) {
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
fontchooserInterp = NULL;
}
break;
@@ -1731,7 +1706,7 @@ FontchooserEvent(
ckfree(tmpv);
}
}
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL);
}
break;
}
@@ -1765,7 +1740,7 @@ FontchooserCget(
case FontchooserParent:
if (fcdPtr->parent != None) {
resObj = Tcl_NewStringObj(
- ((TkWindow *) fcdPtr->parent)->pathName, -1);
+ ((TkWindow *)fcdPtr->parent)->pathName, -1);
} else {
resObj = Tcl_NewStringObj(".", 1);
}
@@ -1940,7 +1915,7 @@ FontchooserConfigureCmd(
[fm setSelectedAttributes:fontPanelFontAttributes
isMultiple:NO];
if ([fp isVisible]) {
- TkSendVirtualEvent(fcdPtr->parent,
+ Tk_SendVirtualEvent(fcdPtr->parent,
"TkFontchooserFontChanged", NULL);
}
break;
@@ -1986,16 +1961,14 @@ static int
FontchooserShowCmd(
ClientData clientData, /* Main window */
Tcl_Interp *interp,
- int objc,
- Tcl_Obj *const objv[])
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
{
FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser",
NULL);
- (void)objc;
- (void)objv;
if (fcdPtr->parent == None) {
- fcdPtr->parent = (Tk_Window) clientData;
+ fcdPtr->parent = (Tk_Window)clientData;
Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask,
FontchooserParentEventHandler, fcdPtr);
}
@@ -2008,7 +1981,7 @@ FontchooserShowCmd(
}
if (![fp isVisible]) {
[fm orderFrontFontPanel:NSApp];
- TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL);
}
fontchooserInterp = interp;
@@ -2034,16 +2007,12 @@ FontchooserShowCmd(
static int
FontchooserHideCmd(
- ClientData dummy, /* Main window */
- Tcl_Interp *interp,
- int objc,
- Tcl_Obj *const objv[])
+ TCL_UNUSED(void *), /* Main window */
+ TCL_UNUSED(Tcl_Interp *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
{
NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO];
- (void)dummy;
- (void)interp;
- (void)objc;
- (void)objv;
if ([fp isVisible]) {
[fp orderOut:NSApp];
@@ -2140,10 +2109,9 @@ DeleteFontchooserData(
MODULE_SCOPE int
TkInitFontchooser(
Tcl_Interp *interp,
- ClientData dummy)
+ TCL_UNUSED(void *))
{
FontchooserData *fcdPtr = (FontchooserData *)ckalloc(sizeof(FontchooserData));
- (void)dummy;
bzero(fcdPtr, sizeof(FontchooserData));
Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData,
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 66027cd..a7314f1 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1,13 +1,13 @@
/*
* tkMacOSXDraw.c --
*
- * This file contains functions that perform drawing to Xlib windows. Most
- * of the functions simply emulate Xlib functions.
+ * This file contains functions that draw to windows. Many of thees
+ * functions emulate Xlib functions.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
+ * Copyright (c) 2001-2009 Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2014 Marc Culler.
+ * Copyright (c) 2014-2020 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -17,7 +17,7 @@
#include "tkMacOSXDebug.h"
#include "tkButton.h"
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
#define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext]
#else
#define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort]
@@ -43,12 +43,15 @@ static int cgAntiAliasLimit = 0;
static int useThemedToplevel = 0;
static int useThemedFrame = 0;
+static unsigned long transparentColor;
/*
* Prototypes for functions used only in this file.
*/
static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr);
+static NSImage *CreateNSImageFromPixmap(Pixmap pixmap, int width, int height);
+
/*
*----------------------------------------------------------------------
@@ -69,11 +72,10 @@ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr);
MODULE_SCOPE int
TkMacOSXInitCGDrawing(
Tcl_Interp *interp,
- int enable,
+ TCL_UNUSED(int),
int limit)
{
static Boolean initialized = FALSE;
- (void)enable;
if (!initialized) {
initialized = TRUE;
@@ -83,7 +85,7 @@ TkMacOSXInitCGDrawing(
}
if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit",
- (char *) &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) {
+ (char *)&cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) {
Tcl_ResetResult(interp);
}
cgAntiAliasLimit = limit;
@@ -93,13 +95,14 @@ TkMacOSXInitCGDrawing(
*/
if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel",
- (char *) &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) {
+ (char *)&useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
}
if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame",
- (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) {
+ (char *)&useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) {
Tcl_ResetResult(interp);
}
+ transparentColor = TkMacOSXClearPixel();
}
return TCL_OK;
}
@@ -107,382 +110,7 @@ TkMacOSXInitCGDrawing(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXBitmapRepFromDrawableRect
- *
- * Extract bitmap data from a MacOSX drawable as an NSBitmapImageRep.
- *
- * This is only used by XGetImage, which is never called. And this
- * implementation does not work correctly. Originally it relied on
- * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was
- * deprecated by Apple in OSX 10.14 and also required the use of other
- * deprecated functions such as [NSView lockFocus]. Apple's suggested
- * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that
- * is what is being used here. However, that method only works when the
- * view has a valid CGContext, and a view is only guaranteed to have a
- * valid context during a call to [NSView drawRect]. To further complicate
- * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is
- * asking the view to draw a subrectangle of itself into a special
- * graphics context which is linked to the BitmapImageRep. But our
- * implementation of [NSView drawRect] does not allow recursive calls. If
- * called recursively it returns immediately without doing any drawing.
- * So the bottom line is that this function either returns a NULL pointer
- * or a black image. To make it useful would require a significant amount
- * of rewriting of the drawRect method. Perhaps the next release of OSX
- * will include some more helpful ways of doing this.
- *
- * Results:
- * Returns an NSBitmapRep representing the image of the given rectangle of
- * the given drawable. This object is retained. The caller is responsible
- * for releasing it.
- *
- * NOTE: The x,y coordinates should be relative to a coordinate system
- * with origin at the top left, as used by XImage and CGImage, not bottom
- * left as used by NSView.
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-
-NSBitmapImageRep *
-TkMacOSXBitmapRepFromDrawableRect(
- Drawable drawable,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
-{
- MacDrawable *mac_drawable = (MacDrawable *) drawable;
- CGContextRef cg_context = NULL;
- CGImageRef cg_image = NULL, sub_cg_image = NULL;
- NSBitmapImageRep *bitmap_rep = NULL;
- NSView *view = NULL;
- if (mac_drawable->flags & TK_IS_PIXMAP) {
- /*
- * This MacDrawable is a bitmap, so its view is NULL.
- */
-
- CGRect image_rect = CGRectMake(x, y, width, height);
-
- cg_context = TkMacOSXGetCGContextForDrawable(drawable);
- cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context);
- sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect);
- if (sub_cg_image) {
- bitmap_rep = [NSBitmapImageRep alloc];
- [bitmap_rep initWithCGImage:sub_cg_image];
- }
- if (cg_image) {
- CGImageRelease(cg_image);
- }
- } else if ((view = TkMacOSXDrawableView(mac_drawable)) != NULL) {
- /*
- * Convert Tk top-left to NSView bottom-left coordinates.
- */
-
- int view_height = [view bounds].size.height;
- NSRect view_rect = NSMakeRect(x + mac_drawable->xOff,
- view_height - height - y - mac_drawable->yOff,
- width, height);
-
- /*
- * Attempt to copy from the view to a bitmapImageRep. If the view does
- * not have a valid CGContext, doing this will silently corrupt memory
- * and make a big mess. So, in that case, we mark the view as needing
- * display and return NULL.
- */
-
- if (view == [NSView focusView]) {
- bitmap_rep = [view bitmapImageRepForCachingDisplayInRect: view_rect];
- [bitmap_rep retain];
- [view cacheDisplayInRect:view_rect toBitmapImageRep:bitmap_rep];
- } else {
- TkMacOSXDbgMsg("No CGContext - cannot copy from screen to bitmap.");
- [view setNeedsDisplay:YES];
- return NULL;
- }
- } else {
- TkMacOSXDbgMsg("Invalid source drawable");
- }
- return bitmap_rep;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * XCopyArea --
- *
- * Copies data from one drawable to another.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Data is moved from a window or bitmap to a second window or bitmap.
- *
- *----------------------------------------------------------------------
- */
-
-int
-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;
- NSBitmapImageRep *bitmap_rep = NULL;
- CGImageRef img = NULL;
- CGRect bounds, srcRect, dstRect;
-
- display->request++;
- if (!width || !height) {
- return BadDrawable;
- }
-
- if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) {
- TkMacOSXDbgMsg("Failed to setup drawing context.");
- return BadDrawable;
- }
-
- if (!dc.context) {
- TkMacOSXDbgMsg("Invalid destination drawable - no context.");
- return BadDrawable;
- }
-
- if (srcDraw->flags & TK_IS_PIXMAP) {
- img = TkMacOSXCreateCGImageWithDrawable(src);
- } else if (TkMacOSXDrawableWindow(src)) {
- bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(src,
- src_x, src_y, width, height);
- if (bitmap_rep) {
- img = [bitmap_rep CGImage];
- }
- } else {
- TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap.");
- }
-
- if (img) {
- bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height);
- srcRect = CGRectMake(src_x, src_y, width, height);
- dstRect = CGRectMake(dest_x, dest_y, width, height);
- TkMacOSXDrawCGImage(dst, gc, dc.context, img,
- gc->foreground, gc->background, bounds, srcRect, dstRect);
- CFRelease(img);
- } else {
- TkMacOSXDbgMsg("Failed to construct CGImage.");
- }
-
- TkMacOSXRestoreDrawingContext(&dc);
- return Success;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * 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.
- *
- *----------------------------------------------------------------------
- */
-
-int
-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;
- MacDrawable *dstDraw = (MacDrawable *) dst;
- CGRect bounds, srcRect, dstRect;
- display->request++;
- if (!width || !height) {
- /* TkMacOSXDbgMsg("Drawing of empty area requested"); */
- return BadDrawable;
- }
- if (plane != 1) {
- Tcl_Panic("Unexpected plane specified for XCopyPlane");
- }
- if (srcDraw->flags & TK_IS_PIXMAP) {
- if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) {
- return BadDrawable;
- }
-
- CGContextRef context = dc.context;
-
- if (context) {
- CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src);
-
- if (img) {
- TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
- unsigned long imageBackground = gc->background;
-
- if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) {
- srcRect = CGRectMake(src_x, src_y, width, height);
- CGImageRef mask = TkMacOSXCreateCGImageWithDrawable(
- clipPtr->value.pixmap);
- CGImageRef submask = CGImageCreateWithImageInRect(
- img, srcRect);
- CGRect rect = CGRectMake(dest_x, dest_y, width, height);
-
- rect = CGRectOffset(rect, dstDraw->xOff, dstDraw->yOff);
- CGContextSaveGState(context);
-
- /*
- * Move the origin of the destination to top left.
- */
-
- CGContextTranslateCTM(context,
- 0, rect.origin.y + CGRectGetMaxY(rect));
- CGContextScaleCTM(context, 1, -1);
-
- /*
- * Fill with the background color, clipping to the mask.
- */
-
- CGContextClipToMask(context, rect, submask);
- TkMacOSXSetColorInContext(gc, gc->background, dc.context);
- CGContextFillRect(context, rect);
-
- /*
- * Fill with the foreground color, clipping to the
- * intersection of img and mask.
- */
-
- CGImageRef subimage = CGImageCreateWithImageInRect(
- img, srcRect);
- CGContextClipToMask(context, rect, subimage);
- TkMacOSXSetColorInContext(gc, gc->foreground, context);
- CGContextFillRect(context, rect);
- CGContextRestoreGState(context);
- CGImageRelease(img);
- CGImageRelease(mask);
- CGImageRelease(submask);
- CGImageRelease(subimage);
- } else {
- bounds = CGRectMake(0, 0,
- srcDraw->size.width, srcDraw->size.height);
- srcRect = CGRectMake(src_x, src_y, width, height);
- dstRect = CGRectMake(dest_x, dest_y, width, height);
- TkMacOSXDrawCGImage(dst, gc, dc.context, img,
- gc->foreground, imageBackground, bounds,
- srcRect, dstRect);
- CGImageRelease(img);
- }
- } else {
- /* no image */
- TkMacOSXDbgMsg("Invalid source drawable");
- }
- } else {
- TkMacOSXDbgMsg("Invalid destination drawable - "
- "could not get a bitmap context.");
- }
- TkMacOSXRestoreDrawingContext(&dc);
- return Success;
- } else {
- /*
- * Source drawable is a Window, not a Pixmap.
- */
-
- return XCopyArea(display, src, dst, gc, src_x, src_y, width, height,
- dest_x, dest_y);
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacOSXCreateCGImageWithDrawable --
- *
- * Create a CGImage from the given Drawable.
- *
- * Results:
- * CGImage, release after use.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-CGImageRef
-TkMacOSXCreateCGImageWithDrawable(
- Drawable drawable)
-{
- CGImageRef img = NULL;
- CGContextRef context = TkMacOSXGetCGContextForDrawable(drawable);
-
- if (context) {
- img = CGBitmapContextCreateImage(context);
- }
- return img;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * CreateNSImageWithPixmap --
- *
- * Create NSImage for Pixmap.
- *
- * Results:
- * NSImage.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static NSImage *
-CreateNSImageWithPixmap(
- Pixmap pixmap,
- int width,
- int height)
-{
- CGImageRef cgImage;
- NSImage *nsImage;
- NSBitmapImageRep *bitmapImageRep;
-
- cgImage = TkMacOSXCreateCGImageWithDrawable(pixmap);
- nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
- bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- [nsImage addRepresentation:bitmapImageRep];
- [bitmapImageRep release];
- CFRelease(cgImage);
-
- return nsImage;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacOSXGetNSImageWithTkImage --
+ * TkMacOSXGetNSImageFromTkImage --
*
* Get autoreleased NSImage for Tk_Image.
*
@@ -496,7 +124,7 @@ CreateNSImageWithPixmap(
*/
NSImage *
-TkMacOSXGetNSImageWithTkImage(
+TkMacOSXGetNSImageFromTkImage(
Display *display,
Tk_Image image,
int width,
@@ -509,7 +137,7 @@ TkMacOSXGetNSImageWithTkImage(
}
pixmap = Tk_GetPixmap(display, None, width, height, 0);
Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0);
- nsImage = CreateNSImageWithPixmap(pixmap, width, height);
+ nsImage = CreateNSImageFromPixmap(pixmap, width, height);
Tk_FreePixmap(display, pixmap);
return [nsImage autorelease];
@@ -518,7 +146,7 @@ TkMacOSXGetNSImageWithTkImage(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetNSImageWithBitmap --
+ * TkMacOSXGetNSImageFromBitmap --
*
* Get autoreleased NSImage for Bitmap.
*
@@ -532,7 +160,7 @@ TkMacOSXGetNSImageWithTkImage(
*/
NSImage *
-TkMacOSXGetNSImageWithBitmap(
+TkMacOSXGetNSImageFromBitmap(
Display *display,
Pixmap bitmap,
GC gc,
@@ -544,11 +172,11 @@ TkMacOSXGetNSImageWithBitmap(
unsigned long origBackground = gc->background;
- gc->background = TRANSPARENT_PIXEL << 24;
+ gc->background = transparentColor;
XSetClipOrigin(display, gc, 0, 0);
XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
gc->background = origBackground;
- nsImage = CreateNSImageWithPixmap(pixmap, width, height);
+ nsImage = CreateNSImageFromPixmap(pixmap, width, height);
Tk_FreePixmap(display, pixmap);
return [nsImage autorelease];
@@ -557,7 +185,48 @@ TkMacOSXGetNSImageWithBitmap(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetCGContextForDrawable --
+ * CreateNSImageFromPixmap --
+ *
+ * Create NSImage for Pixmap.
+ *
+ * Results:
+ * NSImage.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static NSImage *
+CreateNSImageFromPixmap(
+ Pixmap pixmap,
+ int width,
+ int height)
+{
+ CGImageRef cgImage;
+ NSImage *nsImage;
+ NSBitmapImageRep *bitmapImageRep;
+ CGContextRef context = TkMacOSXGetCGContextForDrawable(pixmap);
+
+ if (context) {
+ cgImage = CGBitmapContextCreateImage(context);
+ } else {
+ return NULL;
+ }
+ nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
+ bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ [nsImage addRepresentation:bitmapImageRep];
+ [bitmapImageRep release];
+ CFRelease(cgImage);
+
+ return nsImage;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXGetCGContextForDrawable --
*
* Get CGContext for given Drawable, creating one if necessary.
*
@@ -570,11 +239,11 @@ TkMacOSXGetNSImageWithBitmap(
*----------------------------------------------------------------------
*/
-CGContextRef
-TkMacOSXGetCGContextForDrawable(
+void *
+Tk_MacOSXGetCGContextForDrawable(
Drawable drawable)
{
- MacDrawable *macDraw = (MacDrawable *) drawable;
+ MacDrawable *macDraw = (MacDrawable *)drawable;
if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) {
const size_t bitsPerComponent = 8;
@@ -592,7 +261,7 @@ TkMacOSXGetCGContextForDrawable(
if (macDraw->flags & TK_IS_BW_PIXMAP) {
bitsPerPixel = 8;
- bitmapInfo = (CGBitmapInfo) kCGImageAlphaOnly;
+ bitmapInfo = (CGBitmapInfo)kCGImageAlphaOnly;
} else {
colorspace = CGColorSpaceCreateDeviceRGB();
bitsPerPixel = 32;
@@ -645,7 +314,7 @@ TkMacOSXDrawCGImage(
CGRect srcBounds,
CGRect dstBounds)
{
- MacDrawable *macDraw = (MacDrawable *) d;
+ MacDrawable *macDraw = (MacDrawable *)d;
if (macDraw && context && image) {
CGImageRef subImage = NULL;
@@ -663,17 +332,18 @@ TkMacOSXDrawCGImage(
dstBounds = CGRectOffset(dstBounds, macDraw->xOff, macDraw->yOff);
if (CGImageIsMask(image)) {
if (macDraw->flags & TK_IS_BW_PIXMAP) {
+
/*
* Set fill color to black; background comes from the context,
* or is transparent.
*/
- if (imageBackground != TRANSPARENT_PIXEL << 24) {
+ if (imageBackground != transparentColor) {
CGContextClearRect(context, dstBounds);
}
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
} else {
- if (imageBackground != TRANSPARENT_PIXEL << 24) {
+ if (imageBackground != transparentColor) {
TkMacOSXSetColorInContext(gc, imageBackground, context);
CGContextFillRect(context, dstBounds);
}
@@ -740,7 +410,7 @@ XDrawLines(
int npoints, /* Number of points. */
int mode) /* Line drawing mode. */
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int i, lw = gc->line_width;
@@ -749,7 +419,7 @@ XDrawLines(
}
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -812,12 +482,12 @@ XDrawSegments(
XSegment *segments,
int nsegments)
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int i, lw = gc->line_width;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -861,16 +531,15 @@ XFillPolygon(
GC gc, /* Use this GC. */
XPoint *points, /* Array of points. */
int npoints, /* Number of points. */
- int shape, /* Shape to draw. */
+ TCL_UNUSED(int), /* Shape to draw. */
int mode) /* Drawing mode. */
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int i;
- (void)shape;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -923,7 +592,7 @@ XDrawRectangle(
unsigned int width, /* Width & height of rect. */
unsigned int height)
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int lw = gc->line_width;
@@ -932,7 +601,7 @@ XDrawRectangle(
}
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -975,18 +644,18 @@ XDrawRectangle(
int
XDrawRectangles(
Display *display,
- Drawable drawable,
+ Drawable d,
GC gc,
XRectangle *rectArr,
int nRects)
{
- MacDrawable *macWin = (MacDrawable *) drawable;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
XRectangle * rectPtr;
int i, lw = gc->line_width;
display->request++;
- if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1032,13 +701,13 @@ XFillRectangles(
XRectangle *rectangles, /* Rectangle array. */
int n_rectangles) /* Number of rectangles. */
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
XRectangle * rectPtr;
int i;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1091,7 +760,7 @@ TkMacOSXDrawSolidBorder(
TkMacOSXDrawingContext dc;
CGRect outerRect, innerRect;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return;
}
if (dc.context) {
@@ -1134,7 +803,7 @@ XDrawArc(
int angle1, /* Staring angle of arc. */
int angle2) /* Extent of arc. */
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int lw = gc->line_width;
@@ -1143,7 +812,7 @@ XDrawArc(
}
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1207,13 +876,13 @@ XDrawArcs(
XArc *arcArr,
int nArcs)
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
XArc *arcPtr;
int i, lw = gc->line_width;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1285,7 +954,7 @@ XFillArc(
int angle1, /* Staring angle of arc. */
int angle2) /* Extent of arc. */
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
int lw = gc->line_width;
@@ -1294,7 +963,7 @@ XFillArc(
}
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1361,13 +1030,13 @@ XFillArcs(
XArc *arcArr,
int nArcs)
{
- MacDrawable *macWin = (MacDrawable *) d;
+ MacDrawable *macWin = (MacDrawable *)d;
TkMacOSXDrawingContext dc;
XArc * arcPtr;
int i, lw = gc->line_width;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -1440,20 +1109,19 @@ XFillArcs(
int
TkScrollWindow(
Tk_Window tkwin, /* The window to be scrolled. */
- GC gc, /* GC for window to be scrolled. */
+ TCL_UNUSED(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. */
Region damageRgn) /* Region to accumulate damage in. */
{
Drawable drawable = Tk_WindowId(tkwin);
- MacDrawable *macDraw = (MacDrawable *) drawable;
- TKContentView *view = (TKContentView *) TkMacOSXDrawableView(macDraw);
+ MacDrawable *macDraw = (MacDrawable *)drawable;
+ TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(macDraw);
CGRect srcRect, dstRect;
HIShapeRef dmgRgn = NULL, extraRgn = NULL;
NSRect bounds, visRect, scrollSrc, scrollDst;
int result = 0;
- (void)gc;
if (view) {
/*
@@ -1537,12 +1205,9 @@ TkScrollWindow(
void
TkMacOSXSetUpGraphicsPort(
- GC gc, /* GC to apply to current port. */
- void *destPort)
+ TCL_UNUSED(GC), /* GC to apply to current port. */
+ TCL_UNUSED(void *))
{
- (void)gc;
- (void)destPort;
-
Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!");
}
@@ -1552,15 +1217,17 @@ TkMacOSXSetUpGraphicsPort(
*
* TkMacOSXSetUpDrawingContext --
*
- * Set up a drawing context for the given drawable and GC.
+ * Set up a drawing context for the given drawable from an X 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
+ * Boolean indicating whether it is ok to draw; if false, the drawing
+ * context was not setup, so do not attempt to draw and do not call
* TkMacOSXRestoreDrawingContext().
*
* Side effects:
- * None.
+ * May modify or create the drawable's graphics context. May expand the
+ * drawable's dirty rectangle. When the result is true The dcPtr
+ * parameter is set to reference the new or updated drawing context.
*
*----------------------------------------------------------------------
*/
@@ -1569,27 +1236,28 @@ Bool
TkMacOSXSetupDrawingContext(
Drawable d,
GC gc,
- int useCG, /* advisory only ! */
TkMacOSXDrawingContext *dcPtr)
{
- MacDrawable *macDraw = (MacDrawable *) d;
+ MacDrawable *macDraw = (MacDrawable *)d;
Bool canDraw = true;
- NSWindow *win = NULL;
+ TKContentView *view = nil;
TkMacOSXDrawingContext dc = {};
- CGRect clipBounds;
- (void)useCG;
/*
- * If the drawable is not a pixmap and it has an associated NSWindow then
- * we know we are drawing to a window.
+ * If the drawable is not a pixmap, get the associated NSView.
*/
if (!(macDraw->flags & TK_IS_PIXMAP)) {
- win = TkMacOSXDrawableWindow(d);
+ view = (TKContentView *)TkMacOSXGetNSViewForDrawable(d);
+ if (!view) {
+ Tcl_Panic("TkMacOSXSetupDrawingContext(): "
+ "no NSView to draw into !");
+ }
}
/*
- * Check that we have a non-empty clipping region.
+ * Intersect the drawable's clipping region with the region stored in the
+ * X GC. If the resulting region is empty, don't do any drawing.
*/
dc.clipRgn = TkMacOSXGetClipRgn(d);
@@ -1600,165 +1268,158 @@ TkMacOSXSetupDrawingContext(
}
/*
- * If we already have a CGContext, use it. Otherwise, if we are drawing to
- * a window then we can get one from the window.
+ * If the drawable already has a CGContext, use it. Otherwise, we must be
+ * drawing to a window and we use the current context of its ContentView.
*/
dc.context = TkMacOSXGetCGContextForDrawable(d);
if (dc.context) {
- dc.portBounds = clipBounds = CGContextGetClipBoundingBox(dc.context);
- } else if (win) {
- NSView *view = TkMacOSXDrawableView(macDraw);
+ dc.portBounds = CGContextGetClipBoundingBox(dc.context);
+ } else {
+ NSRect drawingBounds, currentBounds;
- if (!view) {
- Tcl_Panic("TkMacOSXSetupDrawingContext(): "
- "no NSView to draw into !");
+ dc.view = view;
+ dc.context = GET_CGCONTEXT;
+ dc.portBounds = NSRectToCGRect([view bounds]);
+ if (dc.clipRgn) {
+ CGRect clipBounds;
+ CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0,
+ .ty = [view bounds].size.height};
+ HIShapeGetBounds(dc.clipRgn, &clipBounds);
+ clipBounds = CGRectApplyAffineTransform(clipBounds, t);
+ drawingBounds = NSRectFromCGRect(clipBounds);
+ } else {
+ drawingBounds = [view bounds];
}
/*
- * We can only draw into the view when the current CGContext is valid
- * and belongs to the view. Validity can only be guaranteed inside of
- * a view's drawRect or setFrame methods. The isDrawing attribute
- * tells us whether we are being called from one of those methods.
- *
- * If the CGContext is not valid then we mark our view as needing
- * display in the bounding rectangle of the clipping region and
- * return failure. That rectangle should get drawn in a later call
- * to drawRect.
- *
- * As an exception to the above, if mouse buttons are pressed at the
- * moment when we fail to obtain a valid context we schedule the entire
- * view for a redraw rather than just the clipping region. The purpose
- * of this is to make sure that scrollbars get updated correctly.
+ * We can only draw into the NSView which is the current focusView.
+ * When the current [NSView focusView] is nil, the CGContext for
+ * [NSGraphicsContext currentContext] is nil. Otherwise the current
+ * CGContext draws into the current focusView. An NSView is guaranteed
+ * to be the focusView when its drawRect or setFrame methods are
+ * running. Prior to OSX 10.14 it was also possible to call the
+ * lockFocus method to force an NSView to become the current focusView.
+ * But that method was deprecated in 10.14 and so is no longer used by
+ * Tk. Instead, if the view is not the current focusView then we add
+ * the drawing bounds to its dirty rectangle and return false. The
+ * part of the view inside the drawing bounds will get redrawn during
+ * the next call to its drawRect method.
*/
- if (![NSApp isDrawing] || view != [NSView focusView]) {
- NSRect bounds = [view bounds];
- NSRect dirtyNS = bounds;
- if ([NSEvent pressedMouseButtons]) {
- [view setNeedsDisplay:YES];
- } else {
- CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0,
- .ty = dirtyNS.size.height};
- if (dc.clipRgn) {
- CGRect dirtyCG = NSRectToCGRect(dirtyNS);
- HIShapeGetBounds(dc.clipRgn, &dirtyCG);
- dirtyNS = NSRectToCGRect(CGRectApplyAffineTransform(dirtyCG, t));
- }
- [view setNeedsDisplayInRect:dirtyNS];
- }
+ if (view != [NSView focusView]) {
+ [view addTkDirtyRect:drawingBounds];
canDraw = false;
goto end;
}
- dc.view = view;
- dc.context = GET_CGCONTEXT;
- dc.portBounds = NSRectToCGRect([view bounds]);
- if (dc.clipRgn) {
- clipBounds = CGContextGetClipBoundingBox(dc.context);
+ /*
+ * Drawing will also fail when the view is the current focusView but
+ * the clipping rectangle set by drawRect does not contain the clipping
+ * region of our drawing context. (See bug [2a61eca3a8].) If part of
+ * the drawing bounds will be clipped then we draw whatever we can, but
+ * we also add the drawing bounds to the view's dirty rectangle so it
+ * will get redrawn in the next call to its drawRect method.
+ */
+
+ currentBounds = CGContextGetClipBoundingBox(dc.context);
+ if (!NSContainsRect(currentBounds, drawingBounds)) {
+ [view addTkDirtyRect:drawingBounds];
}
- } else {
- Tcl_Panic("TkMacOSXSetupDrawingContext(): "
- "no context to draw into !");
}
/*
- * Configure the drawing context.
+ * Finish configuring the drawing context.
*/
- if (dc.context) {
- CGAffineTransform t = {
- .a = 1, .b = 0,
- .c = 0, .d = -1,
- .tx = 0,
- .ty = dc.portBounds.size.height
- };
+ CGAffineTransform t = {
+ .a = 1, .b = 0,
+ .c = 0, .d = -1,
+ .tx = 0,
+ .ty = dc.portBounds.size.height
+ };
+
+ dc.portBounds.origin.x += macDraw->xOff;
+ dc.portBounds.origin.y += macDraw->yOff;
+ CGContextSaveGState(dc.context);
+ CGContextSetTextDrawingMode(dc.context, kCGTextFill);
+ CGContextConcatCTM(dc.context, t);
+ if (dc.clipRgn) {
- dc.portBounds.origin.x += macDraw->xOff;
- dc.portBounds.origin.y += macDraw->yOff;
- CGContextSaveGState(dc.context);
- CGContextSetTextDrawingMode(dc.context, kCGTextFill);
- CGContextConcatCTM(dc.context, t);
- 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.1);
- CGContextEOFillPath(dc.context);
- CGContextRestoreGState(dc.context);
+ CGContextSaveGState(dc.context);
+ ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
+ CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1);
+ CGContextEOFillPath(dc.context);
+ CGContextRestoreGState(dc.context);
#endif /* TK_MAC_DEBUG_DRAWING */
- CGRect r;
- if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect(
- *HIShapeGetBounds(dc.clipRgn, &r),
- CGRectApplyAffineTransform(clipBounds, t))) {
- ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
- CGContextEOClip(dc.context);
- }
+ CGRect r;
+ CGRect b = CGRectApplyAffineTransform(
+ CGContextGetClipBoundingBox(dc.context), t);
+ if (!HIShapeIsRectangular(dc.clipRgn) ||
+ !CGRectContainsRect(*HIShapeGetBounds(dc.clipRgn, &r), b)) {
+ 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, gc->foreground, dc.context);
- if (win) {
- CGContextSetPatternPhase(dc.context, CGSizeMake(
- dc.portBounds.size.width, dc.portBounds.size.height));
- }
- if (gc->function != GXcopy) {
- TkMacOSXDbgMsg("Logical functions other than GXcopy are "
- "not supported for CG drawing!");
- }
+ }
+ 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 = !notAA(gc->line_width);
+ double w = gc->line_width;
+
+ TkMacOSXSetColorInContext(gc, gc->foreground, dc.context);
+ if (view) {
+ CGContextSetPatternPhase(dc.context, CGSizeMake(
+ dc.portBounds.size.width, dc.portBounds.size.height));
+ }
+ if (gc->function != GXcopy) {
+ TkMacOSXDbgMsg("Logical functions other than GXcopy are "
+ "not supported for CG drawing!");
+ }
+ if (!shouldAntialias) {
/*
- * When should we antialias?
+ * Make non-antialiased CG drawing look more like X11.
*/
- 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;
- CGFloat dashOffset = gc->dash_offset;
- CGFloat 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]);
+ 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;
+ CGFloat dashOffset = gc->dash_offset;
+ dashOffset -= (gc->line_width % 2) ? 0.5 : 0.0;
+ CGFloat 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]);
}
}
end:
+
#ifdef TK_MAC_DEBUG_DRAWING
if (!canDraw && win != NULL) {
TkWindow *winPtr = TkMacOSXGetTkWindow(win);
@@ -1769,6 +1430,7 @@ end:
}
}
#endif
+
if (!canDraw && dc.clipRgn) {
CFRelease(dc.clipRgn);
dc.clipRgn = NULL;
@@ -1830,7 +1492,7 @@ HIShapeRef
TkMacOSXGetClipRgn(
Drawable drawable) /* Drawable. */
{
- MacDrawable *macDraw = (MacDrawable *) drawable;
+ MacDrawable *macDraw = (MacDrawable *)drawable;
HIShapeRef clipRgn = NULL;
if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
@@ -1838,7 +1500,7 @@ TkMacOSXGetClipRgn(
#ifdef TK_MAC_DEBUG_DRAWING
TkMacOSXDbgMsg("%s", macDraw->winPtr->pathName);
- NSView *view = TkMacOSXDrawableView(macDraw);
+ NSView *view = TkMacOSXGetNSViewForDrawable(macDraw);
CGContextRef context = GET_CGCONTEXT;
CGContextSaveGState(context);
@@ -1862,30 +1524,6 @@ TkMacOSXGetClipRgn(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXSetUpClippingRgn --
- *
- * Set up the clipping region so that drawing only occurs on the specified
- * X subwindow.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXSetUpClippingRgn(
- Drawable drawable) /* Drawable to update. */
-{
- (void)drawable;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpClipDrawableToRect --
*
* Clip all drawing into the drawable d to the given rectangle. If width
@@ -1902,13 +1540,12 @@ TkMacOSXSetUpClippingRgn(
void
TkpClipDrawableToRect(
- Display *display,
+ TCL_UNUSED(Display *),
Drawable d,
int x, int y,
int width, int height)
{
- MacDrawable *macDraw = (MacDrawable *) d;
- (void)display;
+ MacDrawable *macDraw = (MacDrawable *)d;
if (macDraw->drawRgn) {
CFRelease(macDraw->drawRgn);
@@ -1955,10 +1592,10 @@ ClipToGC(
HIShapeRef *clipRgnPtr) /* must point to initialized variable */
{
if (gc && gc->clip_mask &&
- ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) {
- Region 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;
+ ((TkpClipMask *)gc->clip_mask)->type == TKP_CLIP_REGION) {
+ Region 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;
XOffsetRegion(gcClip, xOffset, yOffset);
@@ -1994,12 +1631,9 @@ ClipToGC(
void *
TkMacOSXMakeStippleMap(
- Drawable drawable, /* Window to apply stipple. */
- Drawable stipple) /* The stipple pattern. */
+ TCL_UNUSED(Drawable), /* Window to apply stipple. */
+ TCL_UNUSED(Drawable)) /* The stipple pattern. */
{
- (void)drawable;
- (void)stipple;
-
return NULL;
}
diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c
index 5afb408..f275815 100644
--- a/macosx/tkMacOSXEmbed.c
+++ b/macosx/tkMacOSXEmbed.c
@@ -43,11 +43,6 @@ typedef struct 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:
@@ -66,42 +61,6 @@ 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 = (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).
@@ -447,7 +406,7 @@ TkMacOSXContainerId(
for (containerPtr = firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
if (containerPtr->embeddedPtr == winPtr) {
- return (MacDrawable *) containerPtr->parent;
+ return (MacDrawable *)containerPtr->parent;
}
}
Tcl_Panic("TkMacOSXContainerId couldn't find window");
@@ -859,7 +818,7 @@ ContainerEventProc(
* Here we are following unix, by destroying the container.
*/
- Tk_DestroyWindow((Tk_Window) winPtr);
+ Tk_DestroyWindow((Tk_Window)winPtr);
}
Tk_DeleteErrorHandler(errHandler);
}
@@ -908,8 +867,8 @@ EmbedStructureProc(
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),
+ 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);
}
@@ -1054,10 +1013,8 @@ EmbedGeometryRequest(
* 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. */
- }
+ Tk_GeometryRequest((Tk_Window)winPtr, width, height);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {}
if ((winPtr->changes.width != width)
|| (winPtr->changes.height != height)) {
EmbedSendConfigure(containerPtr);
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 7915f6f..75cd198 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -92,7 +92,7 @@ TkpDrawEntryBorderAndFocus(
GC bgGC;
Tk_Window tkwin = entryPtr->tkwin;
int oldWidth = 0;
- MacDrawable *macDraw = (MacDrawable *) d;
+ MacDrawable *macDraw = (MacDrawable *)d;
const HIThemeFrameDrawInfo info = {
.version = 0,
.kind = kHIThemeFrameTextFieldSquare,
@@ -155,7 +155,7 @@ TkpDrawEntryBorderAndFocus(
bounds.origin.y = macDraw->yOff + MAC_OSX_FOCUS_WIDTH;
bounds.size.width = Tk_Width(tkwin) - 2*MAC_OSX_FOCUS_WIDTH;
bounds.size.height = Tk_Height(tkwin) - 2*MAC_OSX_FOCUS_WIDTH;
- if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) {
/*
* No graphics context is available. If the widget is a Spinbox, we
@@ -208,7 +208,7 @@ TkpDrawSpinboxButtons(
TkMacOSXDrawingContext dc;
XRectangle rects[1];
GC bgGC;
- MacDrawable *macDraw = (MacDrawable *) d;
+ MacDrawable *macDraw = (MacDrawable *)d;
HIThemeButtonDrawInfo info = {
.version = 0,
.adornment = kThemeAdornmentNone,
@@ -265,7 +265,7 @@ TkpDrawSpinboxButtons(
rects[0].height = Tk_Height(tkwin);
XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1);
- if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(d, NULL, &dc)) {
return 0;
}
ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index af68eb6..66ca964 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -104,47 +104,26 @@ enum {
return processedEvent;
}
@end
-
#pragma mark -
-
-/*
- *----------------------------------------------------------------------
- *
- * XSync --
- *
- * This routine is a stub called XSync, which is called during the Tk
- * update command. The language specification does not require that the
- * update command be synchronous but many of the tests implicitly assume
- * that it is. It is definitely asynchronous on macOS since many idle
- * tasks are run inside of the drawRect method of a window's contentView,
- * which will not be called until after this function returns.
- *
- * Results:
- * None.
- *
- * Side effects: Processes all pending idle events then calls the display
- * method of each visible window.
- *
- *----------------------------------------------------------------------
- */
-
int
XSync(
Display *display,
- Bool discard)
+ TCL_UNUSED(Bool))
{
- (void)discard;
+ /*
+ * The main use of XSync is by the update command, which alternates
+ * between running an event loop to process all events without waiting and
+ * calling XSync on all displays until no events are left. There is
+ * nothing for the mac to do with respect to syncing its one display but
+ * it can (and, during regression testing, frequently does) happen that
+ * timer events fire during the event loop. Processing those here seems
+ * to make the update command work in a way that is more consistent with
+ * its behavior on other platforms.
+ */
- if (display) {
- display->request++;
- }
- if (Tk_GetNumMainWindows() != 0) {
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
- for (NSWindow *w in [NSApp orderedWindows]) {
- [w display];
- }
- }
- return Success;
+ while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
+ display->request++;
+ return 0;
}
/*
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 7527429..6c66ed8 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -93,10 +93,6 @@ static void InitFont(NSFont *nsFont,
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);
#pragma mark -
#pragma mark Font Helpers:
@@ -455,7 +451,7 @@ TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
Tcl_Interp *interp = mainPtr->interp;
- Tk_Window tkwin = (Tk_Window) mainPtr->winPtr;
+ Tk_Window tkwin = (Tk_Window)mainPtr->winPtr;
const struct SystemFontMapEntry *systemFont = systemFontMap;
NSFont *nsFont;
TkFontAttributes fa;
@@ -554,13 +550,12 @@ TkpFontPkgInit(
TkFont *
TkpGetNativeFont(
- Tk_Window tkwin, /* For display where font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display where font will be used. */
const char *name) /* Platform-specific font name. */
{
MacFont *fontPtr = NULL;
ThemeFontID themeFontId;
CTFontRef ctFont;
- (void)tkwin;
if (strcmp(name, SYSTEMFONT_NAME) == 0) {
themeFontId = kThemeSystemFont;
@@ -704,11 +699,10 @@ TkpDeleteFont(
void
TkpGetFontFamilies(
Tcl_Interp *interp, /* Interp to hold result. */
- Tk_Window tkwin) /* For display to query. */
+ TCL_UNUSED(Tk_Window)) /* For display to query. */
{
Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL);
NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies];
- (void)tkwin;
for (NSString *family in list) {
Tcl_ListObjAppendElement(NULL, resultPtr,
@@ -778,7 +772,7 @@ TkpGetSubFonts(
void
TkpGetFontAttrsForChar(
- Tk_Window tkwin, /* Window on the font's display */
+ TCL_UNUSED(Tk_Window), /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
int c, /* Character of interest */
TkFontAttributes* faPtr) /* Output: Font attributes */
@@ -788,7 +782,6 @@ TkpGetFontAttrsForChar(
*faPtr = fontPtr->font.fa;
if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) {
UTF16Char ch = (UTF16Char) c;
- (void)tkwin;
nsFont = [nsFont bestMatchingFontForCharacters:&ch
length:1 attributes:nil actualCoveredLength:NULL];
@@ -1066,7 +1059,7 @@ done:
* 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().
+ * actual implementation in TkpDrawAngledCharsInContext().
*
* Results:
* None.
@@ -1095,7 +1088,7 @@ Tk_DrawChars(
int x, int y) /* Coordinates at which to place origin of the
* string when drawing. */
{
- DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes,
0, numBytes, x, y, 0.0);
}
@@ -1118,7 +1111,7 @@ TkDrawAngledChars(
* string when drawing. */
double angle) /* What angle to put text at, in degrees. */
{
- DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes,
0, numBytes, x, y, angle);
}
@@ -1164,13 +1157,13 @@ TkpDrawCharsInContext(
* drawing. */
{
(void)display;
- DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes,
rangeStart, rangeLength, x, y, 0.0);
}
-static void
-DrawCharsInContext(
- Display *display, /* Display on which to draw. */
+void
+TkpDrawAngledCharsInContext(
+ TCL_UNUSED(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
@@ -1185,10 +1178,10 @@ DrawCharsInContext(
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
+ double x, double y, /* Coordinates at which to place origin of the
* whole (not just the range) string when
* drawing. */
- double angle)
+ double angle) /* What angle to put text at, in degrees. */
{
const MacFont *fontPtr = (const MacFont *) tkfont;
NSString *string;
@@ -1197,18 +1190,17 @@ DrawCharsInContext(
CTTypesetterRef typesetter;
CFIndex start, length;
CTLineRef line, full=nil;
- MacDrawable *macWin = (MacDrawable *) drawable;
+ MacDrawable *macWin = (MacDrawable *)drawable;
TkMacOSXDrawingContext drawingContext;
CGContextRef context;
CGColorRef fg;
NSFont *nsFont;
CGAffineTransform t;
CGFloat width, height, textX = (CGFloat) x, textY = (CGFloat) y;
- (void)display;
if (rangeStart < 0 || rangeLength <= 0 ||
rangeStart + rangeLength > numBytes ||
- !TkMacOSXSetupDrawingContext(drawable, gc, 1, &drawingContext)) {
+ !TkMacOSXSetupDrawingContext(drawable, gc, &drawingContext)) {
return;
}
string = [[TKNSString alloc] initWithTclUtfBytes:source length:numBytes];
@@ -1222,8 +1214,7 @@ DrawCharsInContext(
[attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName];
CFRelease(fg);
nsFont = [attributes objectForKey:NSFontAttributeName];
- [nsFont setInContext:[NSGraphicsContext graphicsContextWithGraphicsPort:
- context flipped:NO]];
+ [nsFont setInContext:GET_NSCONTEXT(context, NO)];
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
attributedString = [[NSAttributedString alloc] initWithString:string
attributes:attributes];
@@ -1336,12 +1327,9 @@ TkMacOSXNSFontAttributesForFont(
int
TkMacOSXIsCharacterMissing(
- Tk_Font tkfont, /* The font we are looking in. */
- unsigned int searchChar) /* The character we are looking for. */
+ TCL_UNUSED(Tk_Font), /* The font we are looking in. */
+ TCL_UNUSED(unsigned int)) /* The character we are looking for. */
{
- (void)tkfont;
- (void)searchChar;
-
return 0;
}
@@ -1380,7 +1368,7 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes(
objv[i++] = Tcl_NewStringObj(familyName, -1);
objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]);
-#define S(s) Tcl_NewStringObj(STRINGIFY(s), (int)(sizeof(STRINGIFY(s))-1))
+#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1))
objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal);
objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman);
if ([underline respondsToSelector:@selector(intValue)] &&
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index e2ff0f1..f405a53 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -39,6 +39,7 @@ typedef struct AppleEventInfo {
const char *procedure;
Tcl_DString command;
NSAppleEventDescriptor *replyEvent; /* Only used for DoScriptText. */
+ int retryCount;
} AppleEventInfo;
/*
@@ -53,11 +54,11 @@ static void ProcessAppleEvent(ClientData clientData);
* Names of the procedures which can be used to process AppleEvents.
*/
-static const char* openDocumentProc = "::tk::mac::OpenDocument";
-static const char* launchURLProc = "::tk::mac::LaunchURL";
-static const char* printDocProc = "::tk::mac::PrintDocument";
-static const char* scriptFileProc = "::tk::mac::DoScriptFile";
-static const char* scriptTextProc = "::tk::mac::DoScriptText";
+static const char openDocumentProc[] = "::tk::mac::OpenDocument";
+static const char launchURLProc[] = "::tk::mac::LaunchURL";
+static const char printDocProc[] = "::tk::mac::PrintDocument";
+static const char scriptFileProc[] = "::tk::mac::DoScriptFile";
+static const char scriptTextProc[] = "::tk::mac::DoScriptText";
#pragma mark TKApplication(TKHLEvents)
@@ -68,6 +69,11 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
[self handleQuitApplicationEvent:Nil withReplyEvent:Nil];
}
+- (void) superTerminate: (id) sender
+{
+ [super terminate:nil];
+}
+
- (void) preferences: (id) sender
{
(void)sender;
@@ -230,6 +236,13 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->procedure = openDocumentProc;
AEInfo->replyEvent = nil;
Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+
+ if (Tcl_FindCommand(_eventInterp, "::tk::mac::OpenDocuments", NULL, 0)){
+ ProcessAppleEvent((ClientData)AEInfo);
+ } else {
+ Tcl_CreateTimerHandler(500, ProcessAppleEvent, (ClientData)AEInfo);
+ }
}
- (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event
@@ -249,6 +262,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->procedure = printDocProc;
AEInfo->replyEvent = nil;
Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
- (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event
@@ -310,6 +325,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->procedure = scriptFileProc;
AEInfo->replyEvent = nil;
Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
}
} else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type,
@@ -325,19 +342,22 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
if (noErr == AEGetParamPtr(theDesc, keyDirectObject,
typeUTF8Text, &type,
data, actual, NULL)) {
- AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
- Tcl_DString *scriptTextCommand = &AEInfo->command;
- Tcl_DStringInit(scriptTextCommand);
- Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1);
+ data[actual] = '\0';
+ AppleEventInfo *AEInfo = (AppleEventInfo *)ckalloc(sizeof(AppleEventInfo));
+ Tcl_DString *scriptTextCommand = &AEInfo->command;
+ Tcl_DStringInit(scriptTextCommand);
+ Tcl_DStringAppend(scriptTextCommand, scriptTextProc, -1);
Tcl_DStringAppendElement(scriptTextCommand, data);
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptTextProc;
+ AEInfo->retryCount = 0;
if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
AEInfo->replyEvent = replyEvent;
- ProcessAppleEvent((ClientData)AEInfo);
+ ProcessAppleEvent(AEInfo);
} else {
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ Tcl_DoWhenIdle(ProcessAppleEvent, AEInfo);
+ ProcessAppleEvent(AEInfo);
}
}
}
@@ -361,6 +381,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->procedure = launchURLProc;
AEInfo->replyEvent = nil;
Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
@end
@@ -395,15 +417,30 @@ static void ProcessAppleEvent(
{
int code;
AppleEventInfo *AEInfo = (AppleEventInfo*) clientData;
- if (!AEInfo->interp ||
- !Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
+
+ if (!AEInfo->interp) {
+ return;
+ }
+
+ /*
+ * Apple events that are delivered during the app startup can arrive
+ * before the Tcl procedure for handling the events has been defined.
+ * If the command is not found we create a timer handler to process
+ * the event later, hopefully after the command has been created.
+ * We retry up to 2 times before giving up.
+ */
+
+ if (!Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
+ if (AEInfo->retryCount < 2) {
+ AEInfo->retryCount++;
+ Tcl_CreateTimerHandler(200, ProcessAppleEvent, clientData);
+ } else {
+ ckfree(clientData);
+ }
return;
}
code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command),
Tcl_DStringLength(&AEInfo->command), TCL_EVAL_GLOBAL);
- if (code != TCL_OK) {
- Tcl_BackgroundException(AEInfo->interp, code);
- }
if (AEInfo->replyEvent && code >= 0) {
int reslen;
@@ -418,7 +455,10 @@ static void ProcessAppleEvent(
AEPutParamPtr((AppleEvent*)[AEInfo->replyEvent aeDesc],
keyErrorNumber, typeSInt32, (Ptr) &code, sizeof(int));
}
+ } else if (code != TCL_OK) {
+ Tcl_BackgroundException(AEInfo->interp, code);
}
+
Tcl_DStringFree(&AEInfo->command);
ckfree(clientData);
}
@@ -442,11 +482,10 @@ static void ProcessAppleEvent(
void
TkMacOSXInitAppleEvents(
- Tcl_Interp *dummy) /* not used */
+ TCL_UNUSED(Tcl_Interp *))
{
NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager];
static Boolean initialized = FALSE;
- (void)dummy;
if (!initialized) {
initialized = TRUE;
@@ -553,14 +592,18 @@ TkMacOSXDoHLEvent(
static int
ReallyKillMe(
Tcl_Event *eventPtr,
- int flags)
+ TCL_UNUSED(int))
{
Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp;
int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL;
- int code = Tcl_EvalEx(interp, quit ? "::tk::mac::Quit" : "exit", -1, TCL_EVAL_GLOBAL);
- (void)flags;
+ if (!quit) {
+ Tcl_Exit(0);
+ }
+
+ int code = Tcl_EvalEx(interp, "::tk::mac::Quit", -1, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
+
/*
* Should be never reached...
*/
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c
index 07a20ac..0df23d9 100644
--- a/macosx/tkMacOSXImage.c
+++ b/macosx/tkMacOSXImage.c
@@ -6,7 +6,7 @@
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001-2009, Apple Inc.
* Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2017-2018 Marc Culler.
+ * Copyright (c) 2017-2020 Marc Culler.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,14 +15,16 @@
#include "tkMacOSXPrivate.h"
#include "xbytes.h"
+static CGImageRef CreateCGImageFromPixmap(Drawable pixmap);
+static CGImageRef CreateCGImageFromDrawableRect( Drawable drawable,
+ int x, int y, unsigned int width, unsigned int height);
+
#pragma mark XImage handling
int
_XInitImageFuncPtrs(
- XImage *image)
+ TCL_UNUSED(XImage *)) /* image */
{
- (void)image;
-
return 0;
}
@@ -43,10 +45,11 @@ _XInitImageFuncPtrs(
*----------------------------------------------------------------------
*/
-static void ReleaseData(void *info, const void *data, size_t size) {
- (void)data;
- (void)size;
-
+static void ReleaseData(
+ void *info,
+ TCL_UNUSED(const void *), /* data */
+ TCL_UNUSED(size_t)) /* size */
+{
ckfree(info);
}
@@ -136,142 +139,6 @@ TkMacOSXCreateCGImageWithXImage(
/*
*----------------------------------------------------------------------
*
- * XGetImage --
- *
- * This function copies data from a pixmap or window into an XImage. It
- * is essentially never used. At one time it was called by
- * pTkImgPhotoDisplay, but that is no longer the case. Currently it is
- * called two places, one of which is requesting an XY image which we do
- * not support. It probably does not work correctly -- see the comments
- * for TkMacOSXBitmapRepFromDrawableRect.
- *
- * Results:
- * Returns a newly allocated XImage containing the data from the given
- * rectangle of the given drawable, or NULL if the XImage could not be
- * constructed. NOTE: If we are copying from a window on a Retina
- * display, the dimensions of the XImage will be 2*width x 2*height.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-struct pixel_fmt {int r; int g; int b; int a;};
-static struct pixel_fmt bgra = {2, 1, 0, 3};
-static struct pixel_fmt abgr = {3, 2, 1, 0};
-
-XImage *
-XGetImage(
- Display *display,
- Drawable drawable,
- int x,
- int y,
- unsigned int width,
- unsigned int height,
- unsigned long plane_mask,
- int format)
-{
- NSBitmapImageRep* bitmap_rep = NULL;
- NSUInteger bitmap_fmt = 0;
- XImage* imagePtr = NULL;
- char* bitmap = NULL;
- char R, G, B, A;
- int depth = 32, offset = 0, bitmap_pad = 0;
- unsigned int bytes_per_row, size, row, n, m;
- unsigned int scalefactor=1, scaled_height=height, scaled_width=width;
- NSWindow *win = TkMacOSXDrawableWindow(drawable);
- static enum {unknown, no, yes} has_retina = unknown;
- (void)plane_mask;
-
- if (win && has_retina == unknown) {
-#ifdef __clang__
- has_retina = [win respondsToSelector:@selector(backingScaleFactor)] ?
- yes : no;
-#else
- has_retina = no;
-#endif
- }
-
- if (has_retina == yes) {
- /*
- * We only allow scale factors 1 or 2, as Apple currently does.
- */
-
-#ifdef __clang__
- scalefactor = [win backingScaleFactor] == 2.0 ? 2 : 1;
-#endif
- scaled_height *= scalefactor;
- scaled_width *= scalefactor;
- }
-
- if (format == ZPixmap) {
- if (width == 0 || height == 0) {
- return NULL;
- }
-
- bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(drawable,
- x, y, width, height);
- if (!bitmap_rep) {
- TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep");
- return NULL;
- }
- bitmap_fmt = [bitmap_rep bitmapFormat];
- size = [bitmap_rep bytesPerPlane];
- bytes_per_row = [bitmap_rep bytesPerRow];
- bitmap = (char *)ckalloc(size);
- if (!bitmap
- || (bitmap_fmt != 0 && bitmap_fmt != 1)
- || [bitmap_rep samplesPerPixel] != 4
- || [bitmap_rep isPlanar] != 0
- || bytes_per_row < 4 * scaled_width
- || size != bytes_per_row * scaled_height) {
- TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format");
- CFRelease(bitmap_rep);
- return NULL;
- }
- memcpy(bitmap, (char *)[bitmap_rep bitmapData], size);
- CFRelease(bitmap_rep);
-
- /*
- * When Apple extracts a bitmap from an NSView, it may be in either
- * BGRA or ABGR format. For an XImage we need RGBA.
- */
-
- struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr;
-
- for (row = 0, n = 0; row < scaled_height; row++, n += bytes_per_row) {
- for (m = n; m < n + 4*scaled_width; m += 4) {
- R = *(bitmap + m + pixel.r);
- G = *(bitmap + m + pixel.g);
- B = *(bitmap + m + pixel.b);
- A = *(bitmap + m + pixel.a);
-
- *(bitmap + m) = R;
- *(bitmap + m + 1) = G;
- *(bitmap + m + 2) = B;
- *(bitmap + m + 3) = A;
- }
- }
- imagePtr = XCreateImage(display, NULL, depth, format, offset,
- (char*) bitmap, scaled_width, scaled_height,
- bitmap_pad, bytes_per_row);
- if (scalefactor == 2) {
- imagePtr->pixelpower = 1;
- }
- } else {
- /*
- * There are some calls to XGetImage in the generic Tk code which pass
- * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled
- * here.
- */
- TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment.");
- }
- return imagePtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* DestroyImage --
*
* Destroys storage associated with an image.
@@ -306,7 +173,11 @@ DestroyImage(
* Get a single pixel from an image.
*
* Results:
- * Returns the 32 bit pixel value.
+ * The XColor structure contains an unsigned long field named pixel which
+ * identifies the color. This function returns the unsigned long that
+ * would be used as the pixel value of an XColor that has the same red
+ * green and blue components as the XImage pixel at the specified
+ * location.
*
* Side effects:
* None.
@@ -322,13 +193,18 @@ ImageGetPixel(
{
unsigned char r = 0, g = 0, b = 0;
+ /*
+ * Compute 8 bit red green and blue values, which are passed as inputs to
+ * TkMacOSXRGBPixel to produce the pixel value.
+ */
+
if (image && image->data) {
unsigned char *srcPtr = ((unsigned char*) image->data)
+ (y * image->bytes_per_line)
+ (((image->xoffset + x) * image->bits_per_pixel) / NBBY);
switch (image->bits_per_pixel) {
- case 32:
+ case 32: /* 8 bits per channel */
r = (*((unsigned int*) srcPtr) >> 16) & 0xff;
g = (*((unsigned int*) srcPtr) >> 8) & 0xff;
b = (*((unsigned int*) srcPtr) ) & 0xff;
@@ -338,12 +214,12 @@ ImageGetPixel(
r = srcPtr[1]; g = srcPtr[2]; b = srcPtr[3];
}*/
break;
- case 16:
+ case 16: /* 5 bits per channel */
r = (*((unsigned short*) srcPtr) >> 7) & 0xf8;
g = (*((unsigned short*) srcPtr) >> 2) & 0xf8;
b = (*((unsigned short*) srcPtr) << 3) & 0xf8;
break;
- case 8:
+ case 8: /* 2 bits per channel */
r = (*srcPtr << 2) & 0xc0;
g = (*srcPtr << 4) & 0xc0;
b = (*srcPtr << 6) & 0xc0;
@@ -351,7 +227,7 @@ ImageGetPixel(
g |= g >> 2 | g >> 4 | g >> 6;
b |= b >> 2 | b >> 4 | b >> 6;
break;
- case 4: {
+ case 4: { /* 1 bit per channel */
unsigned char c = (x % 2) ? *srcPtr : (*srcPtr >> 4);
r = (c & 0x04) ? 0xff : 0;
@@ -359,12 +235,13 @@ ImageGetPixel(
b = (c & 0x01) ? 0xff : 0;
break;
}
- case 1:
+ case 1: /* Black-white bitmap. */
r = g = b = ((*srcPtr) & (0x80 >> (x % 8))) ? 0xff : 0;
break;
}
}
- return (PIXEL_MAGIC << 24) | (r << 16) | (g << 8) | b;
+
+ return TkMacOSXRGBPixel(r, g, b);
}
/*
@@ -446,7 +323,7 @@ ImagePutPixel(
XImage *
XCreateImage(
Display* display,
- Visual* visual,
+ TCL_UNUSED(Visual*), /* visual */
unsigned int depth,
int format,
int offset,
@@ -457,10 +334,9 @@ XCreateImage(
int bytes_per_line)
{
XImage *ximage;
- (void)visual;
display->request++;
- ximage = (XImage *)ckalloc(sizeof(XImage));
+ ximage = ckalloc(sizeof(XImage));
ximage->height = height;
ximage->width = width;
@@ -470,13 +346,6 @@ XCreateImage(
ximage->data = data;
ximage->obdata = NULL;
- /*
- * The default pixelpower is 0. This must be explicitly set to 1 in the
- * case of an XImage extracted from a Retina display.
- */
-
- ximage->pixelpower = 0;
-
if (format == ZPixmap) {
ximage->bits_per_pixel = 32;
ximage->bitmap_unit = 32;
@@ -552,10 +421,10 @@ XPutImage(
unsigned int height) /* distination and source. */
{
TkMacOSXDrawingContext dc;
- MacDrawable *macDraw = (MacDrawable *) drawable;
+ MacDrawable *macDraw = (MacDrawable *)drawable;
display->request++;
- if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(drawable, gc, &dc)) {
return BadDrawable;
}
if (dc.context) {
@@ -571,17 +440,8 @@ XPutImage(
}
if (img) {
- /*
- * If the XImage has big pixels, the source is rescaled to reflect
- * the actual pixel dimensions. This is not currently used, but
- * could arise if the image were copied from a retina monitor and
- * redrawn on an ordinary monitor.
- */
-
- int pp = image->pixelpower;
-
bounds = CGRectMake(0, 0, image->width, image->height);
- srcRect = CGRectMake(src_x<<pp, src_y<<pp, width<<pp, height<<pp);
+ srcRect = CGRectMake(src_x, src_y, width, height);
dstRect = CGRectMake(dest_x, dest_y, width, height);
TkMacOSXDrawCGImage(drawable, gc, dc.context,
img, gc->foreground, gc->background,
@@ -598,6 +458,454 @@ XPutImage(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * CreateCGImageFromDrawableRect
+ *
+ * Extract image data from a MacOSX drawable as a CGImage.
+ *
+ * This is only called by XGetImage and XCopyArea. The Tk core uses
+ * these functions on some platforms, but on macOS the core does not
+ * call them with a source drawable which is a window. Such calls are
+ * used only for double-buffered drawing. Since macOS defines the
+ * macro TK_NO_DOUBLE_BUFFERING, the generic code never calls XGetImage
+ * or XCopyArea on macOS. Nonetheless, these function are in the stubs
+ * table and therefore could be used by extensions.
+ *
+ * This implementation does not work correctly. Originally it relied on
+ * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was
+ * deprecated by Apple in OSX 10.14 and also required the use of other
+ * deprecated functions such as [NSView lockFocus]. Apple's suggested
+ * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that
+ * is what is being used here. However, that method only works when the
+ * view has a valid CGContext, and a view is only guaranteed to have a
+ * valid context during a call to [NSView drawRect]. To further complicate
+ * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is
+ * asking the view to draw a subrectangle of itself using a special
+ * graphics context which is linked to the BitmapImageRep. But our
+ * implementation of [NSView drawRect] does not allow recursive calls. If
+ * called recursively it returns immediately without doing any drawing.
+ * So the bottom line is that this function either returns a NULL pointer
+ * or a black image. To make it useful would require a significant amount
+ * of rewriting of the drawRect method. Perhaps the next release of OSX
+ * will include some more helpful ways of doing this.
+ *
+ * Results:
+ * Returns an NSBitmapRep representing the image of the given rectangle of
+ * the given drawable. This object is retained. The caller is responsible
+ * for releasing it.
+ *
+ * NOTE: The x,y coordinates should be relative to a coordinate system
+ * with origin at the top left, as used by XImage and CGImage, not bottom
+ * left as used by NSView.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+static CGImageRef
+CreateCGImageFromDrawableRect(
+ Drawable drawable,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ MacDrawable *mac_drawable = (MacDrawable *)drawable;
+ CGContextRef cg_context = NULL;
+ CGImageRef cg_image = NULL, result = NULL;
+ NSBitmapImageRep *bitmapRep = NULL;
+ NSView *view = NULL;
+ if (mac_drawable->flags & TK_IS_PIXMAP) {
+ /*
+ * This MacDrawable is a bitmap, so its view is NULL.
+ */
+
+ CGRect image_rect = CGRectMake(x, y, width, height);
+
+ cg_context = TkMacOSXGetCGContextForDrawable(drawable);
+ cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context);
+ if (cg_image) {
+ result = CGImageCreateWithImageInRect(cg_image, image_rect);
+ CGImageRelease(cg_image);
+ }
+ } else if (TkMacOSXGetNSViewForDrawable(mac_drawable) != NULL) {
+
+ /*
+ * Convert Tk top-left to NSView bottom-left coordinates.
+ */
+
+ int view_height = [view bounds].size.height;
+ NSRect view_rect = NSMakeRect(x + mac_drawable->xOff,
+ view_height - height - y - mac_drawable->yOff,
+ width, height);
+
+ /*
+ * Attempt to copy from the view to a bitmapImageRep. If the view does
+ * not have a valid CGContext, doing this will silently corrupt memory
+ * and make a big mess. So, in that case, we just return NULL.
+ */
+
+ if (view == [NSView focusView]) {
+ bitmapRep = [view bitmapImageRepForCachingDisplayInRect: view_rect];
+ [view cacheDisplayInRect:view_rect toBitmapImageRep:bitmapRep];
+ result = [bitmapRep CGImage];
+ CFRelease(bitmapRep);
+ } else {
+ TkMacOSXDbgMsg("No CGContext - cannot copy from screen to bitmap.");
+ result = NULL;
+ }
+ } else {
+ TkMacOSXDbgMsg("Invalid source drawable");
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateCGImageFromPixmap --
+ *
+ * Create a CGImage from an X Pixmap.
+ *
+ * Results:
+ * CGImage, release after use.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static CGImageRef
+CreateCGImageFromPixmap(
+ Drawable pixmap)
+{
+ CGImageRef img = NULL;
+ CGContextRef context = TkMacOSXGetCGContextForDrawable(pixmap);
+
+ if (context) {
+ img = CGBitmapContextCreateImage(context);
+ }
+ return img;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XGetImage --
+ *
+ * This function copies data from a pixmap or window into an XImage. It
+ * is essentially never used. At one time it was called by
+ * pTkImgPhotoDisplay, but that is no longer the case. Currently it is
+ * called two places, one of which is requesting an XY image which we do
+ * not support. It probably does not work correctly -- see the comments
+ * for CGImageFromDrawableRect.
+ *
+ * Results:
+ * Returns a newly allocated XImage containing the data from the given
+ * rectangle of the given drawable, or NULL if the XImage could not be
+ * constructed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+struct pixel_fmt {int r; int g; int b; int a;};
+static struct pixel_fmt bgra = {2, 1, 0, 3};
+static struct pixel_fmt abgr = {3, 2, 1, 0};
+
+XImage *
+XGetImage(
+ Display *display,
+ Drawable drawable,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height,
+ TCL_UNUSED(unsigned long), /* plane_mask */
+ int format)
+{
+ NSBitmapImageRep* bitmapRep = NULL;
+ NSUInteger bitmap_fmt = 0;
+ XImage* imagePtr = NULL;
+ char* bitmap = NULL;
+ char R, G, B, A;
+ int depth = 32, offset = 0, bitmap_pad = 0;
+ unsigned int bytes_per_row, size, row, n, m;
+
+ if (format == ZPixmap) {
+ CGImageRef cgImage;
+ if (width == 0 || height == 0) {
+ return NULL;
+ }
+
+ cgImage = CreateCGImageFromDrawableRect(drawable, x, y, width, height);
+ if (cgImage) {
+ bitmapRep = [NSBitmapImageRep alloc];
+ [bitmapRep initWithCGImage:cgImage];
+ CFRelease(cgImage);
+ } else {
+ TkMacOSXDbgMsg("XGetImage: Failed to construct CGImage");
+ return NULL;
+ }
+ bitmap_fmt = [bitmapRep bitmapFormat];
+ size = [bitmapRep bytesPerPlane];
+ bytes_per_row = [bitmapRep bytesPerRow];
+ bitmap = ckalloc(size);
+ if (!bitmap
+ || (bitmap_fmt != 0 && bitmap_fmt != 1)
+ || [bitmapRep samplesPerPixel] != 4
+ || [bitmapRep isPlanar] != 0
+ || bytes_per_row < 4 * width
+ || size != bytes_per_row * height) {
+ TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format");
+ CFRelease(bitmapRep);
+ return NULL;
+ }
+ memcpy(bitmap, (char *)[bitmapRep bitmapData], size);
+ CFRelease(bitmapRep);
+
+ /*
+ * When Apple extracts a bitmap from an NSView, it may be in either
+ * BGRA or ABGR format. For an XImage we need RGBA.
+ */
+
+ struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr;
+
+ for (row = 0, n = 0; row < height; row++, n += bytes_per_row) {
+ for (m = n; m < n + 4*width; m += 4) {
+ R = *(bitmap + m + pixel.r);
+ G = *(bitmap + m + pixel.g);
+ B = *(bitmap + m + pixel.b);
+ A = *(bitmap + m + pixel.a);
+
+ *(bitmap + m) = R;
+ *(bitmap + m + 1) = G;
+ *(bitmap + m + 2) = B;
+ *(bitmap + m + 3) = A;
+ }
+ }
+ imagePtr = XCreateImage(display, NULL, depth, format, offset,
+ (char*) bitmap, width, height,
+ bitmap_pad, bytes_per_row);
+ } else {
+ /*
+ * There are some calls to XGetImage in the generic Tk code which pass
+ * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled
+ * here.
+ */
+ TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment.");
+ }
+ return imagePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XCopyArea --
+ *
+ * Copies image data from one drawable to another.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Image data is moved from a window or bitmap to a second window or bitmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+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;
+ CGImageRef img = NULL;
+ CGRect bounds, srcRect, dstRect;
+
+ display->request++;
+ if (!width || !height) {
+ return BadDrawable;
+ }
+
+ if (!TkMacOSXSetupDrawingContext(dst, gc, &dc)) {
+ TkMacOSXDbgMsg("Failed to setup drawing context.");
+ return BadDrawable;
+ }
+
+ if (!dc.context) {
+ TkMacOSXDbgMsg("Invalid destination drawable - no context.");
+ return BadDrawable;
+ }
+
+ if (srcDraw->flags & TK_IS_PIXMAP) {
+ img = CreateCGImageFromPixmap(src);
+ } else if (TkMacOSXGetNSWindowForDrawable(src)) {
+ img = CreateCGImageFromDrawableRect(src, src_x, src_y, width, height);
+ } else {
+ TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap.");
+ }
+
+ if (img) {
+ bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height);
+ srcRect = CGRectMake(src_x, src_y, width, height);
+ dstRect = CGRectMake(dest_x, dest_y, width, height);
+ TkMacOSXDrawCGImage(dst, gc, dc.context, img,
+ gc->foreground, gc->background, bounds, srcRect, dstRect);
+ CFRelease(img);
+ } else {
+ TkMacOSXDbgMsg("Failed to construct CGImage.");
+ }
+
+ TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * 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.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+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;
+ MacDrawable *dstDraw = (MacDrawable *)dst;
+ CGRect bounds, srcRect, dstRect;
+ display->request++;
+ if (!width || !height) {
+ /* TkMacOSXDbgMsg("Drawing of empty area requested"); */
+ return BadDrawable;
+ }
+ if (plane != 1) {
+ Tcl_Panic("Unexpected plane specified for XCopyPlane");
+ }
+ if (srcDraw->flags & TK_IS_PIXMAP) {
+ if (!TkMacOSXSetupDrawingContext(dst, gc, &dc)) {
+ return BadDrawable;
+ }
+
+ CGContextRef context = dc.context;
+
+ if (context) {
+ CGImageRef img = CreateCGImageFromPixmap(src);
+
+ if (img) {
+ TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
+ unsigned long imageBackground = gc->background;
+
+ if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) {
+ srcRect = CGRectMake(src_x, src_y, width, height);
+ CGImageRef mask = CreateCGImageFromPixmap(
+ clipPtr->value.pixmap);
+ CGImageRef submask = CGImageCreateWithImageInRect(
+ img, srcRect);
+ CGRect rect = CGRectMake(dest_x, dest_y, width, height);
+
+ rect = CGRectOffset(rect, dstDraw->xOff, dstDraw->yOff);
+ CGContextSaveGState(context);
+
+ /*
+ * Move the origin of the destination to top left.
+ */
+
+ CGContextTranslateCTM(context,
+ 0, rect.origin.y + CGRectGetMaxY(rect));
+ CGContextScaleCTM(context, 1, -1);
+
+ /*
+ * Fill with the background color, clipping to the mask.
+ */
+
+ CGContextClipToMask(context, rect, submask);
+ TkMacOSXSetColorInContext(gc, gc->background, dc.context);
+ CGContextFillRect(context, rect);
+
+ /*
+ * Fill with the foreground color, clipping to the
+ * intersection of img and mask.
+ */
+
+ CGImageRef subimage = CGImageCreateWithImageInRect(
+ img, srcRect);
+ CGContextClipToMask(context, rect, subimage);
+ TkMacOSXSetColorInContext(gc, gc->foreground, context);
+ CGContextFillRect(context, rect);
+ CGContextRestoreGState(context);
+ CGImageRelease(img);
+ CGImageRelease(mask);
+ CGImageRelease(submask);
+ CGImageRelease(subimage);
+ } else {
+ bounds = CGRectMake(0, 0,
+ srcDraw->size.width, srcDraw->size.height);
+ srcRect = CGRectMake(src_x, src_y, width, height);
+ dstRect = CGRectMake(dest_x, dest_y, width, height);
+ TkMacOSXDrawCGImage(dst, gc, dc.context, img,
+ gc->foreground, imageBackground, bounds,
+ srcRect, dstRect);
+ CGImageRelease(img);
+ }
+ } else {
+ /* no image */
+ TkMacOSXDbgMsg("Invalid source drawable");
+ }
+ } else {
+ TkMacOSXDbgMsg("Invalid destination drawable - "
+ "could not get a bitmap context.");
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
+ } else {
+ /*
+ * Source drawable is a Window, not a Pixmap.
+ */
+
+ return XCopyArea(display, src, dst, gc, src_x, src_y, width, height,
+ dest_x, dest_y);
+ }
+}
+
+/*
* Local Variables:
* mode: objc
* c-basic-offset: 4
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 881fb1b..06ff367 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -14,10 +14,9 @@
*/
#include "tkMacOSXPrivate.h"
-
-#include <sys/stat.h>
#include <dlfcn.h>
#include <objc/objc-auto.h>
+#include <sys/stat.h>
static char tkLibPath[PATH_MAX + 1] = "";
@@ -39,8 +38,9 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
@implementation TKApplication
@synthesize poolLock = _poolLock;
-@synthesize macMinorVersion = _macMinorVersion;
+@synthesize macOSVersion = _macOSVersion;
@synthesize isDrawing = _isDrawing;
+@synthesize needsToDraw = _needsToDraw;
@end
/*
@@ -113,6 +113,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
/*
* Initialize event processing.
*/
+
TkMacOSXInitAppleEvents(_eventInterp);
/*
@@ -144,7 +145,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
*/
[NSApp _lockAutoreleasePool];
- while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
+ while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
[NSApp _unlockAutoreleasePool];
}
@@ -164,15 +165,18 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
/*
* Record the OS version we are running on.
*/
- int minorVersion;
+
+ int minorVersion, majorVersion;
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion);
+ majorVersion = 10;
#else
NSOperatingSystemVersion systemVersion;
systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
+ majorVersion = systemVersion.majorVersion;
minorVersion = systemVersion.minorVersion;
#endif
- [NSApp setMacMinorVersion: minorVersion];
+ [NSApp setMacOSVersion: 10000*majorVersion + 100*minorVersion];
/*
* We are not drawing right now.
@@ -267,6 +271,80 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
*----------------------------------------------------------------------
*/
+/*
+ * Helper function which closes the shared NSFontPanel and NSColorPanel.
+ */
+
+static void closePanels(
+ void)
+{
+ if ([NSFontPanel sharedFontPanelExists]) {
+ [[NSFontPanel sharedFontPanel] orderOut:nil];
+ }
+ if ([NSColorPanel sharedColorPanelExists]) {
+ [[NSColorPanel sharedColorPanel] orderOut:nil];
+ }
+}
+
+/*
+ * This custom exit procedure is called by Tcl_Exit in place of the exit
+ * function from the C runtime. It calls the terminate method of the
+ * NSApplication class (superTerminate for a TKApplication). The purpose of
+ * doing this is to ensure that the NSFontPanel and the NSColorPanel are closed
+ * before the process exits, and that the application state is recorded
+ * correctly for all termination scenarios.
+ *
+ * TkpWantsExitProc tells Tcl_AppInit whether to install our custom exit proc,
+ * which terminates the process by calling [NSApplication terminate]. This
+ * does not work correctly if the process is part of an exec pipeline, so it is
+ * only done if the process was launched by the launcher or if both stdin and
+ * stdout are ttys. To disable using the custom exit proc altogether, undefine
+ * USE_CUSTOM_EXIT_PROC.
+ */
+
+#if defined(USE_CUSTOM_EXIT_PROC)
+static Bool doCleanupFromExit = NO;
+
+int TkpWantsExitProc(void) {
+ return doCleanupFromExit == YES;
+}
+
+TCL_NORETURN void TkpExitProc(
+ void *clientdata)
+{
+ Bool doCleanup = doCleanupFromExit;
+ if (doCleanupFromExit) {
+ doCleanupFromExit = NO; /* prevent possible recursive call. */
+ closePanels();
+ }
+
+ /*
+ * Tcl_Exit does not call Tcl_Finalize if there is an exit proc installed.
+ */
+
+ Tcl_Finalize();
+ if (doCleanup == YES) {
+ [(TKApplication *)NSApp superTerminate:nil]; /* Should not return. */
+ }
+ exit((long)clientdata); /* Convince the compiler that we don't return. */
+}
+#endif
+
+/*
+ * This signal handler is installed for the SIGINT, SIGHUP and SIGTERM signals
+ * so that normal finalization occurs when a Tk app is killed by one of these
+ * signals (e.g when ^C is pressed while running Wish in the shell). It calls
+ * Tcl_Exit instead of the C runtime exit function called by the default handler.
+ * This is consistent with the Tcl_Exit manual page, which says that Tcl_Exit
+ * should always be called instead of exit. When Tk is killed by a signal we
+ * return exit status 1.
+ */
+
+static void TkMacOSXSignalHandler(TCL_UNUSED(int)) {
+
+ Tcl_Exit(1);
+}
+
int
TkpInit(
Tcl_Interp *interp)
@@ -274,15 +352,15 @@ TkpInit(
static int initialized = 0;
/*
- * 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.
+ * TkpInit can be called multiple times with different interpreters. But
+ * The application initialization should only be done onece.
*/
if (!initialized) {
struct stat st;
-
- initialized = 1;
+ Bool shouldOpenConsole = NO;
+ Bool stdinIsNullish = (!isatty(0) &&
+ (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)));
/*
* Initialize/check OS version variable for runtime checks.
@@ -292,7 +370,10 @@ TkpInit(
# error Mac OS X 10.6 required
#endif
+ initialized = 1;
+
#ifdef TK_FRAMEWORK
+
/*
* When Tk is in a framework, force tcl_findLibrary to look in the
* framework scripts directory.
@@ -309,16 +390,6 @@ TkpInit(
#endif
/*
- * FIXME: Close stdin & stdout for remote debugging otherwise we will
- * fight with gdb for stdin & stdout
- */
-
- if (getenv("XCNOSTDIN") != NULL) {
- close(0);
- close(1);
- }
-
- /*
* Instantiate our NSApplication object. This needs to be done before
* we check whether to open a console window.
*/
@@ -333,20 +404,20 @@ TkpInit(
nil]];
[TKApplication sharedApplication];
[pool drain];
- [NSApp _setup:interp];
/*
- * WARNING: The finishLaunching method runs asynchronously, apparently
- * in a separate thread. This creates a race between the
- * initialization of the NSApplication and the initialization of Tk.
- * If Tk wins the race bad things happen with the root window (see
- * below). If the NSApplication wins then an AppleEvent created during
- * launch, e.g. by dropping a file icon on the application icon, will
- * be delivered before the procedure meant to to handle the AppleEvent
- * has been defined. This is now handled by processing the AppleEvent
- * as an idle task. See tkMacOSXHLEvents.c.
+ * WARNING: The finishLaunching method runs asynchronously. This
+ * creates a race between the initialization of the NSApplication and
+ * the initialization of Tk. If Tk wins the race bad things happen
+ * with the root window (see below). If the NSApplication wins then an
+ * AppleEvent created during launch, e.g. by dropping a file icon on
+ * the application icon, will be delivered before the procedure meant
+ * to to handle the AppleEvent has been defined. This is handled in
+ * tkMacOSXHLEvents.c by scheduling a timer event to handle the
+ * ApplEvent later, after the required procedure has been defined.
*/
+ [NSApp _setup:interp];
[NSApp finishLaunching];
/*
@@ -373,36 +444,60 @@ TkpInit(
Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT);
/*
- * 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.
+ * Decide whether to open a console window. If the TK_CONSOLE
+ * environment variable is not defined we only show the console if
+ * stdin is not a tty and there is no startup script.
*/
- if (getenv("TK_CONSOLE") ||
- (!isatty(0) && (fstat(0, &st) ||
- (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) {
+ if (getenv("TK_CONSOLE")) {
+ shouldOpenConsole = YES;
+ } else if (stdinIsNullish && Tcl_GetStartupScript(NULL) == NULL) {
+ const char *intvar = Tcl_GetVar2(interp, "tcl_interactive",
+ NULL, TCL_GLOBAL_ONLY);
+ if (intvar == NULL) {
+ Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
+ TCL_GLOBAL_ONLY);
+ }
+
+#if defined(USE_CUSTOM_EXIT_PROC)
+ doCleanupFromExit = YES;
+#endif
+
+ shouldOpenConsole = YES;
+ }
+ if (shouldOpenConsole) {
Tk_InitConsoleChannels(interp);
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ } else if (stdinIsNullish) {
/*
- * Only show the console if we don't have a startup script and
- * tcl_interactive hasn't been set already.
+ * When launched as a macOS application with no console,
+ * redirect stderr and stdout to /dev/null. This avoids waiting
+ * forever for those files to become writable if the underlying
+ * Tcl program tries to write to them with a puts command.
*/
- if (Tcl_GetStartupScript(NULL) == NULL) {
- const char *intvar = Tcl_GetVar2(interp,
- "tcl_interactive", NULL, TCL_GLOBAL_ONLY);
+ FILE *null = fopen("/dev/null", "w");
+ dup2(fileno(null), STDOUT_FILENO);
+ dup2(fileno(null), STDERR_FILENO);
+#if defined(USE_CUSTOM_EXIT_PROC)
+ doCleanupFromExit = YES;
+#endif
+ }
- if (intvar == NULL) {
- Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
- TCL_GLOBAL_ONLY);
- }
- }
- if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
+ /*
+ * FIXME: Close stdin & stdout for remote debugging if XCNOSTDIN is
+ * set. Otherwise we will fight with gdb for stdin & stdout
+ */
+
+ if (getenv("XCNOSTDIN") != NULL) {
+ close(0);
+ close(1);
}
/*
@@ -412,8 +507,46 @@ TkpInit(
*/
TkMacOSXServices_Init(interp);
+
+ /*
+ * The root window has been created and mapped, but XMapWindow deferred its
+ * call to makeKeyAndOrderFront because the first call to XMapWindow
+ * occurs too early in the initialization process for that. Process idle
+ * tasks now, so the root window is configured, then order it front.
+ */
+
+ while(Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {};
+ for (NSWindow *window in [NSApp windows]) {
+ TkWindow *winPtr = TkMacOSXGetTkWindow(window);
+ if (winPtr && Tk_IsMapped(winPtr)) {
+ [window makeKeyAndOrderFront:NSApp];
+ break;
+ }
+ }
+
+# if defined(USE_CUSTOM_EXIT_PROC)
+
+ if ((isatty(0) && isatty(1))) {
+ doCleanupFromExit = YES;
+ }
+
+# endif
+
+ /*
+ * Install a signal handler for SIGINT, SIGHUP and SIGTERM which uses
+ * Tcl_Exit instead of exit so that normal cleanup takes place if a TK
+ * application is killed with one of these signals.
+ */
+
+ signal(SIGINT, TkMacOSXSignalHandler);
+ signal(SIGHUP, TkMacOSXSignalHandler);
+ signal(SIGTERM, TkMacOSXSignalHandler);
}
+ /*
+ * Initialization steps that are needed for all interpreters.
+ */
+
if (tkLibPath[0] != '\0') {
Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
@@ -429,6 +562,7 @@ TkpInit(
TkMacOSXIconBitmapObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
TkMacOSXGetAppPathCmd, NULL, NULL);
+
return TCL_OK;
}
@@ -487,13 +621,11 @@ TkpGetAppName(
static int
TkMacOSXGetAppPathCmd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
- (void)dummy;
-
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
@@ -622,11 +754,10 @@ TkMacOSXDefaultStartupScript(void)
MODULE_SCOPE void*
TkMacOSXGetNamedSymbol(
- const char* module,
- const char* symbol)
+ TCL_UNUSED(const char *),
+ const char *symbol)
{
void *addr = dlsym(RTLD_NEXT, symbol);
- (void)module;
if (!addr) {
(void) dlerror(); /* Clear dlfcn error state */
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index bd669c0..0380596 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -99,24 +99,6 @@ typedef struct TkWindowPrivate MacDrawable;
*/
/*
- * 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;
-
-/*
* GC CGColorRef cache for tkMacOSXColor.c
*/
@@ -180,7 +162,7 @@ MODULE_SCOPE void TkpFreeGCCache(GC gc);
#define TK_MACOSX_HANDLE_EVENT_IMMEDIATELY 1024
/*
- * Defines for tkTextDisp.c
+ * Defines for tkTextDisp.c and tkFont.c
*/
#define TK_LAYOUT_WITH_BASE_CHUNKS 1
@@ -196,10 +178,7 @@ MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
MODULE_SCOPE void TkpRetainRegion(Region r);
MODULE_SCOPE void TkpReleaseRegion(Region r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
-MODULE_SCOPE Bool TkpAppIsDrawing(void);
-MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin);
-MODULE_SCOPE Bool TkTestLogDisplay(void);
-MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);
+MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable);
/*
* Include the stubbed internal platform-specific API.
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index cd369ed..6e4a764 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -51,7 +51,7 @@ static NSUInteger textInputModifiers;
#endif
NSWindow *w = [theEvent window];
TkWindow *winPtr = TkMacOSXGetTkWindow(w), *grabWinPtr, *focusWinPtr;
- Tk_Window tkwin = (Tk_Window) winPtr;
+ Tk_Window tkwin = (Tk_Window)winPtr;
NSEventType type = [theEvent type];
NSUInteger virtual = [theEvent keyCode];
NSUInteger modifiers = ([theEvent modifierFlags] &
@@ -83,7 +83,7 @@ static NSUInteger textInputModifiers;
if (winPtr->dispPtr->grabFlags || /* global grab */
grabWinPtr->mainPtr == winPtr->mainPtr){ /* same application */
winPtr =winPtr->dispPtr->focusPtr;
- tkwin = (Tk_Window) winPtr;
+ tkwin = (Tk_Window)winPtr;
}
}
@@ -255,12 +255,11 @@ static NSUInteger textInputModifiers;
*/
if (type == NSKeyDown && [theEvent isARepeat]) {
+
xEvent.xany.type = KeyRelease;
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
xEvent.xany.type = KeyPress;
}
- if (xEvent.xany.type == KeyPress) {
- }
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
return theEvent;
}
@@ -268,14 +267,8 @@ static NSUInteger textInputModifiers;
@implementation TKContentView
-
--(id)init {
- self = [super init];
- if (self) {
- _needsRedisplay = NO;
- }
- return self;
-}
+@synthesize tkDirtyRect = _tkDirtyRect;
+@synthesize tkNeedsDisplay = _tkNeedsDisplay;;
/*
* Implementation of the NSTextInputClient protocol.
@@ -293,7 +286,7 @@ static NSUInteger textInputModifiers;
XEvent xEvent;
NSString *str, *keystr, *lower;
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- Tk_Window tkwin = (Tk_Window) winPtr;
+ Tk_Window tkwin = (Tk_Window)winPtr;
Bool sendingIMEText = NO;
str = ([aString isKindOfClass: [NSAttributedString class]]) ?
@@ -329,8 +322,8 @@ static NSUInteger textInputModifiers;
*/
if (repRange.location == 0) {
- Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr;
- TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
+ Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
+ Tk_SendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
}
/*
@@ -403,7 +396,7 @@ static NSUInteger textInputModifiers;
replacementRange: (NSRange)repRange
{
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr;
+ Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
NSString *temp;
NSString *str;
(void)selRange;
@@ -439,12 +432,12 @@ static NSUInteger textInputModifiers;
* Use our insertText method to display the marked text.
*/
- TkSendVirtualEvent(focusWin, "TkStartIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkStartIMEMarkedText", NULL);
processingCompose = YES;
temp = [str copy];
[self insertText: temp replacementRange:repRange];
privateWorkingText = temp;
- TkSendVirtualEvent(focusWin, "TkEndIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(focusWin, "TkEndIMEMarkedText", NULL);
}
- (BOOL)hasMarkedText
@@ -512,8 +505,8 @@ static NSUInteger textInputModifiers;
processingCompose = NO;
if (aSelector == @selector (deleteBackward:)) {
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr;
- TkSendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
+ Tk_Window focusWin = (Tk_Window)winPtr->dispPtr->focusPtr;
+ Tk_SendVirtualEvent(focusWin, "TkAccentBackspace", NULL);
}
}
@@ -562,7 +555,6 @@ static NSUInteger textInputModifiers;
}
/* End of NSTextInputClient implementation. */
-@synthesize needsRedisplay = _needsRedisplay;
@end
@@ -588,7 +580,7 @@ static NSUInteger textInputModifiers;
privateWorkingText = nil;
processingCompose = NO;
if (composeWin) {
- TkSendVirtualEvent(composeWin, "TkClearIMEMarkedText", NULL);
+ Tk_SendVirtualEvent(composeWin, "TkClearIMEMarkedText", NULL);
}
}
}
@@ -709,8 +701,8 @@ XGrabKeyboard(
(void)time;
if (keyboardGrabWinPtr && captureWinPtr) {
- NSWindow *w = TkMacOSXDrawableWindow(grab_window);
- MacDrawable *macWin = (MacDrawable *) grab_window;
+ NSWindow *w = TkMacOSXGetNSWindowForDrawable(grab_window);
+ MacDrawable *macWin = (MacDrawable *)grab_window;
if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) {
if (modalSession) {
@@ -788,7 +780,7 @@ TkMacOSXGetModalSession(void)
* This enables correct placement of the popups used for character
* selection by the NSTextInputClient. It gets called by text entry
* widgets whenever the cursor is drawn. It does nothing if the widget's
- * NSWindow is not the current KeyWindow. Otherwise it udpates the
+ * NSWindow is not the current KeyWindow. Otherwise it updates the
* display's caret structure and records the caret geometry in static
* variables for use by the NSTextInputClient implementation. Any
* widget passed to this function will be marked as being able to input
@@ -814,7 +806,7 @@ Tk_SetCaretPos(
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkCaret *caretPtr = &(winPtr->dispPtr->caret);
- NSWindow *w = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
+ NSWindow *w = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin));
/*
* Register this widget as being capable of text input, so we know we
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index ca2a9e5..60d1d0d 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -489,13 +489,12 @@ XKeycodeToKeysym(
const char *
TkpGetString(
- TkWindow *winPtr, /* Window where event occurred: Needed to get
+ TCL_UNUSED(TkWindow *), /* 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*/
MacKeycode macKC;
char utfChars[8];
int length = 0;
@@ -588,19 +587,15 @@ XFreeModifiermap(
char *
XKeysymToString(
- KeySym keysym)
+ TCL_UNUSED(KeySym))
{
- (void)keysym;
-
return NULL;
}
KeySym
XStringToKeysym(
- const char* string)
+ TCL_UNUSED(const char *))
{
- (void)string;
-
return NoSymbol;
}
@@ -666,7 +661,7 @@ XKeysymToKeycode(
macKC.x.keychar = (unsigned int) data;
hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar));
if (hPtr != NULL) {
- unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr);
+ data = (unsigned long) Tcl_GetHashValue(hPtr);
macKC.x.xvirtual = (unsigned int) data;
}
}
diff --git a/macosx/tkMacOSXKeysyms.h b/macosx/tkMacOSXKeysyms.h
index 726f318..da364ea 100644
--- a/macosx/tkMacOSXKeysyms.h
+++ b/macosx/tkMacOSXKeysyms.h
@@ -91,7 +91,7 @@ static const KeyInfo keyArray[] = {
{114, XK_Help, NSHelpFunctionKey},
{115, XK_Home, NSHomeFunctionKey}, /* Fn Left */
{116, XK_Page_Up, NSPageUpFunctionKey}, /* Fn Up */
- {117, XK_Delete, NSDeleteFunctionKey}, /* Fn Deleete */
+ {117, XK_Delete, NSDeleteFunctionKey}, /* Fn Delete */
{118, XK_F4, NSF4FunctionKey},
{119, XK_End, NSEndFunctionKey}, /* Fn Right */
{120, XK_F2, NSF2FunctionKey},
@@ -293,7 +293,7 @@ const KeysymInfo keysymTable[] = {
{0x00d5, 0x00d5}, /* Otilde */
{0x00d6, 0x00d6}, /* Odiaeresis */
{0x00d7, 0x00d7}, /* multiply */
- {0x00d8, 0x00d8}, /* Ooblique */
+ {0x00d8, 0x00d8}, /* Oslash */
{0x00d9, 0x00d9}, /* Ugrave */
{0x00da, 0x00da}, /* Uacute */
{0x00db, 0x00db}, /* Ucircumflex */
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 1ed9408..8970109 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -36,7 +36,7 @@
#define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \
.flag = ENTRY_##f##_MENU }
static const struct {
- const char *name; const size_t len; const int flag;
+ const char *name; size_t len; int flag;
} specialMenus[] = {
SPECIALMENU(help, HELP),
SPECIALMENU(apple, APPLE),
@@ -47,8 +47,8 @@ static const struct {
#define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f }
static const struct {
- const char *name; const size_t len; const NSUInteger mask;
-} modifiers[] = {
+ const char *name; size_t len; NSUInteger mask;
+} allModifiers[] = {
MODIFIER(Control, NSControlKeyMask),
MODIFIER(Ctrl, NSControlKeyMask),
MODIFIER(Option, NSAlternateKeyMask),
@@ -64,7 +64,7 @@ static const struct {
#define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c }
static const struct {
- const char *name; const size_t len; const UniChar ch;
+ const char *name; size_t len; UniChar ch;
} specialAccelerators[] = {
ACCEL(PageUp, NSPageUpFunctionKey),
ACCEL(PageDown, NSPageDownFunctionKey),
@@ -91,11 +91,7 @@ static const struct {
#undef ACCEL
#undef sl
-static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
- * the flag that Tk is not to draw any
- * menus. */
static int inPostMenu = 0;
-static unsigned long defaultBg = 0, defaultFg = 0;
static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0;
static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0;
@@ -108,6 +104,67 @@ static void MenuSelectEvent(TkMenu *menuPtr);
static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
static int ModifierCharWidth(Tk_Font tkfont);
+#pragma mark TkBackgroundLoop
+
+/*
+ * The function TkMacOSXEventsCheckProc (in tkMacOSXNotify.c) is the "check
+ * proc" for the macOS event source. Its job is to remove NSEvents from the
+ * default event queue of the NSApplication. It does this by calling the
+ * method [NSApp nextEventMatchingMask: untilDate: inMode: dequeue:]. As a
+ * rule, when the untilDate is set to the distant past this method returns
+ * immediately. An exception to that rule is when the next event is the button
+ * press on a menu button. In that case, the method starts running a nested
+ * event loop in the mode NSEventTrackingRunLoopMode which does not return
+ * until the menu has been dismissed. In Tk 8.6.10 and earlier, this meant
+ * that the Tk event loop would block in its call to the check proc as long as
+ * the menu was posted. For example, opening a menu during the Rube Goldberg
+ * demo would cause the animation to stop. This was also the case for
+ * menubuttons.
+ *
+ * The TKBackground object below works around this problem, and allows a Tk
+ * event loop to run while a menu is open. It is a subclass of NSThread which
+ * inserts requests to call [NSApp _runBackgroundLoop] onto the queue
+ * associated with the NSEventTrackingRunLoopMode. One of these threads gets
+ * started in the callback [NSApp menuBeginTracking] and cancelled in [NSApp
+ * menuEndTracking].
+ */
+
+@interface TKBackgroundLoop: NSThread
+@end
+
+@implementation TKBackgroundLoop
+- (void) main
+{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+ NSArray *modeArray = [NSArray arrayWithObjects: NSEventTrackingRunLoopMode,
+ nil];
+ while(1) {
+
+ /*
+ * Queue a request to process Tk events during event tracking.
+ */
+
+ [NSApp performSelectorOnMainThread:@selector(_runBackgroundLoop)
+ withObject:nil
+ waitUntilDone:true
+ modes:modeArray];
+ if ([self isCancelled]) {
+ [NSThread exit];
+ }
+
+ /*
+ * Allow the tracked events to be processed too.
+ */
+
+ [NSThread sleepForTimeInterval:0.001];
+ }
+ [pool drain];
+}
+@end
+
+TKBackgroundLoop *backgroundLoop = nil;
+
+
#pragma mark TKMenu
/*
@@ -405,6 +462,12 @@ static int ModifierCharWidth(Tk_Font tkfont);
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
+ if (backgroundLoop) {
+ [backgroundLoop cancel];
+ [backgroundLoop release];
+ }
+ backgroundLoop = [[TKBackgroundLoop alloc] init];
+ [backgroundLoop start];
//TkMacOSXClearMenubarActive();
//TkMacOSXPreprocessMenu();
}
@@ -415,6 +478,11 @@ static int ModifierCharWidth(Tk_Font tkfont);
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
#endif
+ if (backgroundLoop) {
+ [backgroundLoop cancel];
+ [backgroundLoop release];
+ backgroundLoop = nil;
+ }
if (!inPostMenu) {
TkMacOSXClearMenubarActive();
}
@@ -422,10 +490,6 @@ static int ModifierCharWidth(Tk_Font tkfont);
- (void) tkSetMainMenu: (TKMenu *) menu
{
- if (gNoTkMenus) {
- return;
- }
-
TKMenu *applicationMenu = nil;
if (menu) {
@@ -624,12 +688,23 @@ TkpConfigureMenuEntry(
NSDictionary *attributes;
int imageWidth, imageHeight;
GC gc = (mePtr->textGC ? mePtr->textGC : mePtr->menuPtr->textGC);
- Tcl_Obj *fontPtr = (mePtr->fontPtr ? mePtr->fontPtr :
- mePtr->menuPtr->fontPtr);
+ Tcl_Obj *fontPtr = (mePtr->fontPtr ?
+ mePtr->fontPtr : mePtr->menuPtr->fontPtr);
+ static unsigned long defaultBg, defaultFg;
+ static int initialized = 0;
+
+ if (!initialized) {
+ TkColor *tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR);
+ defaultBg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ tkColPtr = TkpGetColor(NULL, DEF_MENU_FG);
+ defaultFg = tkColPtr->color.pixel;
+ ckfree(tkColPtr);
+ }
if (mePtr->image) {
Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
- image = TkMacOSXGetNSImageWithTkImage(mePtr->menuPtr->display,
+ image = TkMacOSXGetNSImageFromTkImage(mePtr->menuPtr->display,
mePtr->image, imageWidth, imageHeight);
} else if (mePtr->bitmapPtr != None) {
Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin,
@@ -637,10 +712,9 @@ TkpConfigureMenuEntry(
Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth,
&imageHeight);
- image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap,
+ image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap,
gc, imageWidth, imageHeight);
if (gc->foreground == defaultFg) {
- // Use a semantic foreground color by default
[image setTemplate:YES];
}
}
@@ -820,7 +894,7 @@ TkpPostMenu(
* rather than the appearance of the root window.
*/
realWinPtr = (TkWindow*) realWin;
- realWinView = TkMacOSXDrawableView(realWinPtr->privatePtr);
+ realWinView = TkMacOSXGetNSViewForDrawable(realWinPtr->privatePtr);
if (realWinView != nil) {
break;
}
@@ -1041,8 +1115,8 @@ TkpSetMainMenubar(
if (winPtr->wmInfoPtr &&
winPtr->wmInfoPtr->menuPtr &&
- winPtr->wmInfoPtr->menuPtr->masterMenuPtr) {
- menubar = winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin;
+ winPtr->wmInfoPtr->menuPtr->mainMenuPtr) {
+ menubar = winPtr->wmInfoPtr->menuPtr->mainMenuPtr->tkwin;
}
/*
@@ -1096,25 +1170,25 @@ static void
CheckForSpecialMenu(
TkMenu *menuPtr) /* The menu we are checking */
{
- if (!menuPtr->masterMenuPtr->tkwin) {
+ if (!menuPtr->mainMenuPtr->tkwin) {
return;
}
for (TkMenuEntry *cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if (cascadeEntryPtr->menuPtr->menuType == MENUBAR
- && cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin) {
- TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
int i = 0;
Tcl_DString ds;
Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, Tk_PathName(masterMenuPtr->tkwin), -1);
+ Tcl_DStringAppend(&ds, Tk_PathName(mainMenuPtr->tkwin), -1);
while (specialMenus[i].name) {
Tcl_DStringAppend(&ds, specialMenus[i].name,
specialMenus[i].len);
if (strcmp(Tcl_DStringValue(&ds),
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= specialMenus[i].flag;
} else {
cascadeEntryPtr->entryFlags &= ~specialMenus[i].flag;
@@ -1156,18 +1230,18 @@ ParseAccelerator(
*maskPtr = 0;
while (1) {
i = 0;
- while (modifiers[i].name) {
- int l = modifiers[i].len;
+ while (allModifiers[i].name) {
+ int l = allModifiers[i].len;
- if (!strncasecmp(accel, modifiers[i].name, l) &&
+ if (!strncasecmp(accel, allModifiers[i].name, l) &&
(accel[l] == '-' || accel[l] == '+')) {
- *maskPtr |= modifiers[i].mask;
+ *maskPtr |= allModifiers[i].mask;
accel += l+1;
break;
}
i++;
}
- if (!modifiers[i].name || !*accel) {
+ if (!allModifiers[i].name || !*accel) {
break;
}
}
@@ -1273,7 +1347,7 @@ TkpComputeStandardMenuGeometry(
* Do nothing if this menu is a clone.
*/
- if (menuPtr->tkwin == NULL || menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->tkwin == NULL || menuPtr->mainMenuPtr != menuPtr) {
return;
}
@@ -1391,14 +1465,14 @@ TkpComputeStandardMenuGeometry(
}
} else {
NSUInteger modifMask = [menuItem keyEquivalentModifierMask];
- int i = 0;
+ int j = 0;
- while (modifiers[i].name) {
- if (modifMask & modifiers[i].mask) {
- modifMask &= ~modifiers[i].mask;
+ while (allModifiers[j].name) {
+ if (modifMask & allModifiers[j].mask) {
+ modifMask &= ~allModifiers[j].mask;
modifierWidth += modifierCharWidth;
}
- i++;
+ j++;
}
accelWidth = [[menuItem keyEquivalent] sizeWithAttributes:
TkMacOSXNSFontAttributesForFont(tkfont)].width;
@@ -1584,30 +1658,6 @@ TkMacOSXClearMenubarActive(void)
/*
*----------------------------------------------------------------------
*
- * 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;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpMenuInit --
*
* Initializes Mac-specific menu data.
@@ -1624,7 +1674,7 @@ Tk_MacOSXTurnOffMenus(void)
void
TkpMenuInit(void)
{
- TkColor *tkColPtr;
+ // TkColor *tkColPtr;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
@@ -1635,13 +1685,6 @@ TkpMenuInit(void)
#undef observe
[NSMenuItem setUsesUserKeyEquivalents:NO];
- tkColPtr = TkpGetColor(NULL, DEF_MENU_BG_COLOR);
- defaultBg = tkColPtr->color.pixel;
- ckfree(tkColPtr);
- tkColPtr = TkpGetColor(NULL, DEF_MENU_FG);
- defaultFg = tkColPtr->color.pixel;
- ckfree(tkColPtr);
-
ChkErr(GetThemeMetric, kThemeMetricMenuMarkColumnWidth,
&menuMarkColumnWidth);
ChkErr(GetThemeMetric, kThemeMetricMenuTextLeadingEdgeMargin,
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 1e88f3a..2fad3cb 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -181,13 +181,6 @@ TkpDisplayMenuButton(
TkMacOSXComputeMenuButtonDrawParams(butPtr, dpPtr);
/*
- * Set up clipping region. Make sure the we are using the port for this
- * button, or we will set the wrong window's clip.
- */
-
- TkMacOSXSetUpClippingRgn(pixmap);
-
- /*
* Draw the native portion of the buttons.
*/
@@ -364,7 +357,7 @@ TkpComputeMenuButtonGeometry(butPtr)
*
* DrawMenuButtonImageAndText --
*
- * Draws the image and text associated witha button or label.
+ * Draws the image and text associated with a button or label.
*
* Results:
* None.
@@ -567,7 +560,7 @@ TkMacOSXDrawMenuButton(
static HIThemeButtonDrawInfo hiinfo;
MenuButtonBackgroundDrawCB(mbPtr, 32, true);
- if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
return;
}
@@ -598,7 +591,7 @@ TkMacOSXDrawMenuButton(
MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo,
mbPtr, 32, true);
} else {
- if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
+ if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) {
return;
}
TkMacOSXRestoreDrawingContext(&dc);
@@ -710,7 +703,7 @@ MenuButtonEventProc(
mbPtr->flags &= ~ACTIVE;
}
if ((buttonPtr->flags & REDRAW_PENDING) == 0) {
- Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) buttonPtr);
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, buttonPtr);
buttonPtr->flags |= REDRAW_PENDING;
}
}
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index 1029704..fe53f25 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -112,7 +112,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
* On OS X 10.12 we get duplicate tab control items if we create them here.
*/
- if ([NSApp macMinorVersion] > 12) {
+ if ([NSApp macOSVersion] > 101200) {
_defaultWindowsMenuItems = [_defaultWindowsMenuItems
arrayByAddingObjectsFromArray:
[NSArray arrayWithObjects:
@@ -203,7 +203,7 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "tkAboutDialog",
NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) {
- TkAboutDlg();
+ [super orderFrontStandardAboutPanel:nil];
} else {
int code = Tcl_EvalEx(_eventInterp, "tkAboutDialog", -1,
TCL_EVAL_GLOBAL);
@@ -373,29 +373,6 @@ TkMacOSXHandleMenuSelect(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXInitMenus --
- *
- * This procedure initializes the Macintosh menu bar.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXInitMenus(
- TCL_UNUSED(Tcl_Interp *))
-{
- [NSApp _setupMenus];
-}
-
-/*
- *----------------------------------------------------------------------
- *
* GenerateEditEvent --
*
* Takes an edit menu item and posts the corasponding a virtual event to
@@ -422,7 +399,7 @@ GenerateEditEvent(
if (!winPtr) {
return;
}
- tkwin = (Tk_Window) winPtr->dispPtr->focusPtr;
+ tkwin = (Tk_Window)winPtr->dispPtr->focusPtr;
if (!tkwin) {
return;
}
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 7dcfa10..83eef3d 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -24,6 +24,7 @@ typedef struct {
Point global;
Point local;
} MouseEventData;
+
static Tk_Window captureWinPtr = NULL; /* Current capture window; may be
* NULL. */
@@ -42,9 +43,9 @@ enum {
* window attribute pointing to the active window. As of 10.8 this behavior
* had changed. The new behavior was that if the mouse were ever moved outside
* of a window, all subsequent NSMouseMoved NSEvents would have a Nil window
- * attribute. To work around this the TKApplication remembers the last non-Nil
- * window that it received in a mouse event. If it receives an NSEvent with a
- * Nil window attribute then the saved window is used.
+ * attribute until the mouse returned to the window. In 11.1 it changed again.
+ * The window attribute can be non-nil, but referencing a window which does not
+ * belong to the application.
*/
@implementation TKApplication(TKMouseEvent)
@@ -52,151 +53,167 @@ enum {
{
NSWindow *eventWindow = [theEvent window];
NSEventType eventType = [theEvent type];
+ NSRect viewFrame = [[eventWindow contentView] frame];
+ NSPoint location = [theEvent locationInWindow];
TkWindow *winPtr = NULL, *grabWinPtr;
- Tk_Window tkwin;
+ Tk_Window tkwin = NULL, capture, target;
NSPoint local, global;
- NSInteger button = -1;
-#if 0
- NSTrackingArea *trackingArea = nil;
- NSInteger eventNumber, clickCount, buttonNumber;
-#endif
- [NSEvent stopPeriodicEvents];
+ NSInteger button;
+ Bool inTitleBar = NO;
+ int win_x, win_y;
+ unsigned int buttonState = 0;
+ static int validPresses = 0, ignoredPresses = 0;
#ifdef TK_MAC_DEBUG_EVENTS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
#endif
+
+ /*
+ * If this event is not for a Tk toplevel, it should just be passed up the
+ * responder chain. However, there is an exception for synthesized events,
+ * which are used in testing. Those events are recognized by having their
+ * both the windowNumber and the eventNumber set to -1.
+ */
+
+ if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) {
+ if ([theEvent windowNumber] != -1 || [theEvent eventNumber] != -1)
+ return theEvent;
+ }
+
+ /*
+ * Check if the event is located in the titlebar.
+ */
+
+ if (eventWindow) {
+ inTitleBar = viewFrame.size.height < location.y;
+ }
+
+ button = [theEvent buttonNumber] + Button1;
+ if ((button & -2) == Button2) {
+ button ^= 1; /* Swap buttons 2/3 */
+ }
switch (eventType) {
- case NSLeftMouseDown:
- case NSRightMouseDown:
- case NSOtherMouseDown:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ buttonState &= ~Tk_GetButtonMask(button);
+ break;
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
- button = [theEvent buttonNumber] + Button1;
+ case NSRightMouseDown:
+ case NSOtherMouseDown:
+ buttonState |= Tk_GetButtonMask(button);
+ break;
case NSMouseEntered:
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ !inTitleBar) {
+ [(TKWindow *)eventWindow setMouseInResizeArea:YES];
+ }
+ break;
case NSMouseExited:
- case NSCursorUpdate:
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) {
+ [(TKWindow *)eventWindow setMouseInResizeArea:NO];
+ break;
+ }
case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
+ case NSLeftMouseDown:
case NSMouseMoved:
+ case NSScrollWheel:
+#if 0
+ case NSCursorUpdate:
case NSTabletPoint:
case NSTabletProximity:
- case NSScrollWheel:
+#endif
break;
- default: /* Unrecognized mouse event. */
+ default: /* This type of event is ignored. */
return theEvent;
}
/*
- * Compute the mouse position in Tk screen coordinates (global) and in the
- * Tk coordinates of its containing Tk Window (local). If a grab is in effect,
- * the local coordinates should be relative to the grab window.
+ * Update the button state. We ignore left button presses that start a
+ * resize or occur in the title bar. See tickets [d72abe6b54] and
+ * [39cbacb9e8].
*/
- if (eventWindow) {
- local = [theEvent locationInWindow];
+ if (eventType == NSLeftMouseDown) {
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ [(TKWindow *) eventWindow mouseInResizeArea]) {
- /*
- * Do not send ButtonPress XEvents for MouseDown NSEvents that start a
- * resize. (The MouseUp will be handled during LiveResize.) See
- * ticket [d72abe6b54].
- */
+ /*
+ * When the left button is pressed in the resize area, we receive
+ * NSMouseDown, but when it is released we do not receive
+ * NSMouseUp. So ignore the event and clear the button state but
+ * do not change the ignoredPresses count.
+ */
- if (eventType == NSLeftMouseDown &&
- ([eventWindow styleMask] & NSResizableWindowMask) &&
- [NSApp macMinorVersion] > 6) {
- NSRect frame = [eventWindow frame];
- if (local.x < 3 || local.x > frame.size.width - 3 || local.y < 3) {
- return theEvent;
- }
+ buttonState &= ~Tk_GetButtonMask(Button1);
+ return theEvent;
}
- global = [eventWindow tkConvertPointToScreen: local];
- tkwin = TkpGetCapture();
- if (tkwin) {
- winPtr = (TkWindow *) tkwin;
- eventWindow = TkMacOSXDrawableWindow(winPtr->window);
- if (eventWindow) {
- local = [eventWindow tkConvertPointFromScreen: global];
- } else {
- return theEvent;
- }
+ if (inTitleBar) {
+ ignoredPresses++;
+ return theEvent;
}
- local.y = [eventWindow frame].size.height - local.y;
- global.y = TkMacOSXZeroScreenHeight() - global.y;
- } else {
-
- /*
- * If the event has no NSWindow, the location is in screen coordinates.
- */
-
- global = [theEvent locationInWindow];
- tkwin = TkpGetCapture();
- if (tkwin) {
- winPtr = (TkWindow *) tkwin;
- eventWindow = TkMacOSXDrawableWindow(winPtr->window);
- } else {
- eventWindow = [NSApp mainWindow];
+ validPresses++;
+ buttonState |= Tk_GetButtonMask(Button1);
+ }
+ if (eventType == NSLeftMouseUp) {
+ if (ignoredPresses > 0) {
+ ignoredPresses--;
+ } else if (validPresses > 0) {
+ validPresses--;
}
- if (!eventWindow) {
- return theEvent;
+ if (validPresses == 0) {
+ buttonState &= ~Tk_GetButtonMask(Button1);
}
- local = [eventWindow tkConvertPointFromScreen: global];
- local.y = [eventWindow frame].size.height - local.y;
- global.y = TkMacOSXZeroScreenHeight() - global.y;
}
/*
- * If we still don't have a window, try using the toplevel that
- * manages the NSWindow.
+ * Find an appropriate NSWindow to attach to this event, and its
+ * associated Tk window.
*/
- if (!tkwin) {
- winPtr = TkMacOSXGetTkWindow(eventWindow);
- tkwin = (Tk_Window) winPtr;
+ capture = TkpGetCapture();
+ if (capture) {
+ winPtr = (TkWindow *) capture;
+ eventWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
+ if (!eventWindow) {
+ return theEvent;
+ }
+ } else {
+ if (eventWindow) {
+ winPtr = TkMacOSXGetTkWindow(eventWindow);
+ }
+ if (!winPtr) {
+ eventWindow = [NSApp mainWindow];
+ winPtr = TkMacOSXGetTkWindow(eventWindow);
+ }
}
- if (!tkwin) {
+ if (!winPtr) {
/*
- * We can't find a window for this event. We have to ignore it.
+ * We couldn't find a Tk window for this event. We have to ignore it.
*/
#ifdef TK_MAC_DEBUG_EVENTS
- TkMacOSXDbgMsg("tkwin == NULL");
+ TkMacOSXDbgMsg("Event received with no Tk window.");
#endif
return theEvent;
}
+ tkwin = (Tk_Window) winPtr;
/*
- * Ignore the event if a local grab is in effect and the Tk event window is
- * not in the grabber's subtree.
- */
-
- grabWinPtr = winPtr->dispPtr->grabWinPtr;
- if (grabWinPtr && /* There is a grab in effect ... */
- !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */
- grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */
- Tk_Window tkwin2, tkEventWindow = Tk_CoordsToWindow(global.x, global.y, tkwin);
- if (!tkEventWindow) {
- return theEvent;
- }
- for (tkwin2 = tkEventWindow;
- !Tk_IsTopLevel(tkwin2);
- tkwin2 = Tk_Parent(tkwin2)) {
- if (tkwin2 == (Tk_Window) grabWinPtr) {
- break;
- }
- }
- if (tkwin2 != (Tk_Window) grabWinPtr) {
- return theEvent;
- }
- }
-
- /*
- * Convert local from NSWindow flipped coordinates to the toplevel's
- * coordinates.
+ * Compute the mouse position in local (window) and global (screen)
+ * coordinates. These are Tk coordinates, meaning that the local origin is
+ * at the top left corner of the containing toplevel and the global origin
+ * is at top left corner of the primary screen.
*/
+ global = [NSEvent mouseLocation];
+ local = [eventWindow tkConvertPointFromScreen: global];
+ global.x = floor(global.x);
+ global.y = floor(TkMacOSXZeroScreenHeight() - global.y);
+ local.x = floor(local.x);
+ local.y = floor([eventWindow frame].size.height - local.y);
if (Tk_IsEmbedded(winPtr)) {
TkWindow *contPtr = TkpGetOtherWindow(winPtr);
if (Tk_IsTopLevel(contPtr)) {
@@ -213,25 +230,44 @@ enum {
}
/*
- * Use the toplevel coordinates to find the containing Tk window. Then
- * convert local into the coordinates of that window. (The converted
- * local coordinates are only needed for scrollwheel events.)
+ * Use the local coordinates to find the Tk window which should receive
+ * this event. Also convert local into the coordinates of that window.
+ * (The converted local coordinates are only needed for scrollwheel
+ * events.)
*/
- int win_x, win_y;
- tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
- local.x = win_x;
- local.y = win_y;
+ target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
/*
- * Generate an XEvent for this mouse event.
+ * Ignore the event if a local grab is in effect and the Tk window is
+ * not in the grabber's subtree.
*/
- unsigned int state = 0;
- if (button > 0) {
- state |= TkGetButtonMask(button);
+ grabWinPtr = winPtr->dispPtr->grabWinPtr;
+ if (grabWinPtr && /* There is a grab in effect ... */
+ !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */
+ grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */
+ Tk_Window tkwin2;
+ if (!target) {
+ return theEvent;
+ }
+ for (tkwin2 = target;
+ !Tk_IsTopLevel(tkwin2);
+ tkwin2 = Tk_Parent(tkwin2)) {
+ if (tkwin2 == (Tk_Window)grabWinPtr) {
+ break;
+ }
+ }
+ if (tkwin2 != (Tk_Window)grabWinPtr) {
+ return theEvent;
+ }
}
+ /*
+ * Generate an XEvent for this mouse event.
+ */
+
+ unsigned int state = buttonState;
NSUInteger modifiers = [theEvent modifierFlags];
if (modifiers & NSAlphaShiftKeyMask) {
@@ -259,48 +295,45 @@ enum {
if (eventType != NSScrollWheel) {
/*
- * For normal mouse events, Tk_UpdatePointer will send the XEvent.
+ * For normal mouse events, Tk_UpdatePointer will send the appropriate
+ * XEvents using its cached state information. Unfortunately, it will
+ * also recompute the local coordinates.
*/
#ifdef TK_MAC_DEBUG_EVENTS
- TKLog(@"UpdatePointer %p x %f.0 y %f.0 %d",
- tkwin, global.x, global.y, state);
+ TKLog(@"UpdatePointer %p x %.1f y %.1f %d",
+ target, global.x, global.y, state);
#endif
- Tk_UpdatePointer(tkwin, global.x, global.y, state);
+
+ Tk_UpdatePointer(target, global.x, global.y, state);
} else {
+ CGFloat delta;
+ XEvent xEvent;
/*
* For scroll wheel events we need to send the XEvent here.
*/
- CGFloat delta;
- int coarseDelta;
- XEvent xEvent;
-
xEvent.type = MouseWheelEvent;
- xEvent.xbutton.x = local.x;
- xEvent.xbutton.y = local.y;
+ xEvent.xbutton.x = win_x;
+ xEvent.xbutton.y = win_y;
xEvent.xbutton.x_root = global.x;
xEvent.xbutton.y_root = global.y;
xEvent.xany.send_event = false;
- xEvent.xany.display = Tk_Display(tkwin);
- xEvent.xany.window = Tk_WindowId(tkwin);
+ xEvent.xany.display = Tk_Display(target);
+ xEvent.xany.window = Tk_WindowId(target);
- delta = [theEvent deltaY];
+ delta = [theEvent deltaY] * 120;
if (delta != 0.0) {
- coarseDelta = (delta > -1.0 && delta < 1.0) ?
- (signbit(delta) ? -1 : 1) : lround(delta);
xEvent.xbutton.state = state;
- xEvent.xkey.keycode = coarseDelta;
+ xEvent.xkey.keycode = (delta > 0) ? ceil(delta) : floor(delta);
xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
}
- delta = [theEvent deltaX];
+ delta = [theEvent deltaX] * 120;
if (delta != 0.0) {
- coarseDelta = (delta > -1.0 && delta < 1.0) ?
- (signbit(delta) ? -1 : 1) : lround(delta);
xEvent.xbutton.state = state | ShiftMask;
- xEvent.xkey.keycode = coarseDelta;
+ xEvent.xkey.keycode = (delta > 0) ? ceil(delta) : floor(delta);
xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
}
@@ -314,34 +347,6 @@ enum {
/*
*----------------------------------------------------------------------
*
- * 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.
@@ -398,8 +403,15 @@ ButtonModifiers2State(
* Tk on OSX supports at most 9 buttons.
*/
- state = (buttonState & 0x7F) * Button1Mask;
- /* Handle buttons 8/9 */
+ state = (buttonState & 0x079) * Button1Mask;
+ /* Handle swapped buttons 2/3 */
+ if (buttonState & 0x02) {
+ state |= Button3Mask;
+ }
+ if (buttonState & 0x04) {
+ state |= Button2Mask;
+ }
+ /* Handle buttons 8/9 */
state |= (buttonState & 0x180) * (Button8Mask >> 7);
if (keyModifiers & alphaLock) {
@@ -468,8 +480,8 @@ XQueryPointer(
NSPoint global = [NSEvent mouseLocation];
if (getLocal) {
- MacDrawable *macWin = (MacDrawable *) w;
- NSWindow *win = TkMacOSXDrawableWindow(w);
+ MacDrawable *macWin = (MacDrawable *)w;
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(w);
if (win) {
NSPoint local;
@@ -507,7 +519,7 @@ XQueryPointer(
* True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue. Grab state may
+ * Additional events may be placed on the Tk event queue. Grab state may
* also change.
*
*----------------------------------------------------------------------
@@ -545,7 +557,7 @@ TkGenerateButtonEventForXPointer(
* True if event(s) are generated, false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue. Grab state may
+ * Additional events may be placed on the Tk event queue. Grab state may
* also change.
*
*----------------------------------------------------------------------
@@ -558,8 +570,8 @@ TkGenerateButtonEvent(
Window window, /* X Window containing button event. */
unsigned int state) /* Button Key state suitable for X event. */
{
- MacDrawable *macWin = (MacDrawable *) window;
- NSWindow *win = TkMacOSXDrawableWindow(window);
+ MacDrawable *macWin = (MacDrawable *)window;
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
MouseEventData med;
bzero(&med, sizeof(MouseEventData));
@@ -597,7 +609,7 @@ TkGenerateButtonEvent(
* True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue. Grab state may
+ * Additional events may be placed on the Tk event queue. Grab state may
* also change.
*
*----------------------------------------------------------------------
@@ -611,7 +623,7 @@ GenerateButtonEvent(
int dummy;
TkDisplay *dispPtr;
-#if UNUSED
+#ifdef UNUSED
/*
* ButtonDown events will always occur in the front window. ButtonUp
@@ -640,51 +652,40 @@ GenerateButtonEvent(
return true;
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWarpPointer --
+ *
+ * Move the mouse cursor to the screen location specified by the warpX and
+ * warpY fields of a TkDisplay.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The mouse cursor is moved.
+ *
+ *----------------------------------------------------------------------
+ */
+
void
TkpWarpPointer(
TkDisplay *dispPtr)
{
CGPoint pt;
- NSPoint loc;
- int wNum;
if (dispPtr->warpWindow) {
int x, y;
- TkWindow *winPtr = (TkWindow *) dispPtr->warpWindow;
- TkWindow *topPtr = winPtr->privatePtr->toplevel->winPtr;
- NSWindow *w = TkMacOSXDrawableWindow(winPtr->window);
- wNum = [w windowNumber];
Tk_GetRootCoords(dispPtr->warpWindow, &x, &y);
pt.x = x + dispPtr->warpX;
pt.y = y + dispPtr->warpY;
- loc.x = dispPtr->warpX;
- loc.y = Tk_Height(topPtr) - dispPtr->warpY;
} else {
- wNum = 0;
- pt.x = loc.x = dispPtr->warpX;
+ pt.x = dispPtr->warpX;
pt.y = dispPtr->warpY;
- loc.y = TkMacOSXZeroScreenHeight() - pt.y;
}
- /*
- * Generate an NSEvent of type NSMouseMoved.
- *
- * It is not clear why this is necessary. For example, calling
- * event generate $w <Motion> -warp 1 -x $X -y $Y
- * will cause two <Motion> events to be added to the Tcl queue.
- */
-
CGWarpMouseCursorPosition(pt);
- NSEvent *warpEvent = [NSEvent mouseEventWithType:NSMouseMoved
- location:loc
- modifierFlags:0
- timestamp:GetCurrentEventTime()
- windowNumber:wNum
- context:nil
- eventNumber:0
- clickCount:1
- pressure:0.0];
- [NSApp postEvent:warpEvent atStart:NO];
}
/*
@@ -712,8 +713,7 @@ TkpSetCapture(
while (winPtr && !Tk_IsTopLevel(winPtr)) {
winPtr = winPtr->parentPtr;
}
- [NSEvent stopPeriodicEvents];
- captureWinPtr = (Tk_Window) winPtr;
+ captureWinPtr = (Tk_Window)winPtr;
}
/*
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 82ded8a..e169a7d 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -13,10 +13,10 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#include <tclInt.h>
#include "tkMacOSXPrivate.h"
#include "tkMacOSXInt.h"
#include "tkMacOSXConstants.h"
-#include <tclInt.h>
#import <objc/objc-auto.h>
/* This is not used for anything at the moment. */
@@ -156,6 +156,7 @@ void DebugPrintQueue(void)
* this block should be removed.
*/
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
if ([theEvent type] == NSAppKitDefined) {
static Bool aWindowIsMoving = NO;
switch([theEvent subtype]) {
@@ -174,6 +175,8 @@ void DebugPrintQueue(void)
break;
}
}
+#endif
+
[super sendEvent:theEvent];
[NSApp tkCheckPasteboard];
@@ -183,6 +186,13 @@ void DebugPrintQueue(void)
#endif
}
+
+- (void) _runBackgroundLoop
+{
+ while(Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)){
+ TkMacOSXDrawAllViews(NULL);
+ }
+}
@end
#pragma mark -
@@ -201,15 +211,13 @@ void DebugPrintQueue(void)
*----------------------------------------------------------------------
*/
-NSString *
+static NSString *
GetRunLoopMode(NSModalSession modalSession)
{
NSString *runLoopMode = nil;
if (modalSession) {
runLoopMode = NSModalPanelRunLoopMode;
- } else if (TkpGetCapture()) {
- runLoopMode = NSEventTrackingRunLoopMode;
}
if (!runLoopMode) {
runLoopMode = [[NSRunLoop currentRunLoop] currentMode];
@@ -261,7 +269,6 @@ Tk_MacOSXSetupTkNotifier(void)
Tcl_CreateEventSource(TkMacOSXEventsSetupProc,
TkMacOSXEventsCheckProc, NULL);
TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL);
- Tcl_SetServiceMode(TCL_SERVICE_ALL);
TclMacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode);
TclMacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode);
}
@@ -300,10 +307,90 @@ TkMacOSXNotifyExitHandler(
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXDrawAllViews --
+ *
+ * This static function is meant to be run as an idle task. It attempts
+ * to redraw all views which have the tkNeedsDisplay property set to YES.
+ * This relies on a feature of [NSApp nextEventMatchingMask: ...] which
+ * is undocumented, namely that it sometimes blocks and calls drawRect
+ * for all views that need display before it returns. We call it with
+ * deQueue=NO so that it will not change anything on the AppKit event
+ * queue, because we only want the side effect that it runs drawRect. The
+ * only time when any NSViews have the needsDisplay property set to YES
+ * is during execution of this function.
+ *
+ * The reason for running this function as an idle task is to try to
+ * arrange that all widgets will be fully configured before they are
+ * drawn. Any idle tasks that might reconfigure them should be higher on
+ * the idle queue, so they should be run before the display procs are run
+ * by drawRect.
+ *
+ * If this function is called directly with non-NULL clientData parameter
+ * then the int which it references will be set to the number of windows
+ * that need display, but the needsDisplay property of those windows will
+ * not be changed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Parts of windows my get redrawn.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXDrawAllViews(
+ ClientData clientData)
+{
+ int count = 0, *dirtyCount = (int *)clientData;
+
+ for (NSWindow *window in [NSApp windows]) {
+ if ([[window contentView] isMemberOfClass:[TKContentView class]]) {
+ TKContentView *view = [window contentView];
+ if ([view tkNeedsDisplay]) {
+ count++;
+ if (dirtyCount) {
+ continue;
+ }
+ [view setNeedsDisplayInRect:[view tkDirtyRect]];
+ }
+ } else {
+ [window displayIfNeeded];
+ }
+ }
+ if (dirtyCount) {
+ *dirtyCount = count;
+ }
+ [NSApp nextEventMatchingMask:NSAnyEventMask
+ untilDate:[NSDate distantPast]
+ inMode:GetRunLoopMode(TkMacOSXGetModalSession())
+ dequeue:NO];
+ for (NSWindow *window in [NSApp windows]) {
+ if ([[window contentView] isMemberOfClass:[TKContentView class]]) {
+ TKContentView *view = [window contentView];
+
+ /*
+ * If we did not run drawRect, we set needsDisplay back to NO.
+ * Note that if drawRect did run it may have added to Tk's dirty
+ * rect, due to attempts to draw outside of drawRect's dirty rect.
+ */
+
+ if ([view needsDisplay]) {
+ [view setNeedsDisplay: NO];
+ }
+ }
+ }
+ [NSApp setNeedsToDraw:NO];
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkMacOSXEventsSetupProc --
*
* This procedure implements the setup part of the MacOSX event source. It
- * is invoked by Tcl_DoOneEvent before calling TkMacOSXEventsProc to
+ * is invoked by Tcl_DoOneEvent before calling TkMacOSXEventsCheckProc to
* process all queued NSEvents. In our case, all we need to do is to set
* the Tcl MaxBlockTime to 0 before starting the loop to process all
* queued NSEvents.
@@ -313,18 +400,33 @@ TkMacOSXNotifyExitHandler(
*
* Side effects:
*
- * If NSEvents are queued, then the maximum block time will be set to 0 to
- * ensure that control returns immediately to Tcl.
+ * If NSEvents are queued, or if there is any drawing that needs to be
+ * done, then the maximum block time will be set to 0 to ensure that
+ * Tcl_WaitForEvent returns immediately.
*
*----------------------------------------------------------------------
*/
+#define TICK 200
+static Tcl_TimerToken ticker = NULL;
+
+static void
+Heartbeat(
+ TCL_UNUSED(ClientData))
+{
+
+ if (ticker) {
+ ticker = Tcl_CreateTimerHandler(TICK, Heartbeat, NULL);
+ }
+}
+
+static const Tcl_Time zeroBlockTime = { 0, 0 };
+
static void
TkMacOSXEventsSetupProc(
ClientData dummy,
int flags)
{
- static Bool havePeriodicEvents = NO;
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
(void)dummy;
@@ -333,35 +435,39 @@ TkMacOSXEventsSetupProc(
*/
if (flags & TCL_WINDOW_EVENTS && !runloopMode) {
- static const Tcl_Time zeroBlockTime = { 0, 0 };
+
[NSApp _resetAutoreleasePool];
- /*
- * Call this with dequeue=NO -- just checking if the queue is empty.
- */
+ /*
+ * After calling this setup proc, Tcl_DoOneEvent will call
+ * Tcl_WaitForEvent. Then it will call check proc to collect the
+ * events and translate them into XEvents.
+ *
+ * If we have any events waiting or if there is any drawing to be done
+ * we want Tcl_WaitForEvent to return immediately. So we set the block
+ * time to 0 and stop the heatbeat.
+ */
NSEvent *currentEvent =
[NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
inMode:GetRunLoopMode(TkMacOSXGetModalSession())
dequeue:NO];
- if (currentEvent) {
- if (currentEvent.type > 0) {
- Tcl_SetMaxBlockTime(&zeroBlockTime);
- [NSEvent stopPeriodicEvents];
- havePeriodicEvents = NO;
- }
- } else if (!havePeriodicEvents){
+ if ((currentEvent) || [NSApp needsToDraw] ) {
+ Tcl_SetMaxBlockTime(&zeroBlockTime);
+ Tcl_DeleteTimerHandler(ticker);
+ ticker = NULL;
+ } else if (ticker == NULL) {
/*
- * When the user is not generating events we schedule a "hearbeat"
- * event to fire every 0.1 seconds. This helps to make the vwait
- * command more responsive when there is no user input, e.g. when
- * running the test suite.
+ * When the user is not generating events we schedule a "heartbeat"
+ * TimerHandler to fire every 200 milliseconds. The handler does
+ * nothing, but when its timer fires it causes Tcl_WaitForEvent to
+ * return. This helps avoid hangs when calling vwait during the
+ * non-regression tests.
*/
- havePeriodicEvents = YES;
- [NSEvent startPeriodicEventsAfterDelay:0.0 withPeriod:0.1];
+ ticker = Tcl_CreateTimerHandler(TICK, Heartbeat, NULL);
}
}
}
@@ -385,11 +491,11 @@ TkMacOSXEventsSetupProc(
*/
static void
TkMacOSXEventsCheckProc(
- ClientData dummy,
+ TCL_UNUSED(ClientData),
int flags)
{
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
- (void)dummy;
+ int eventsFound = 0;
/*
* runloopMode will be nil if we are in a Tcl event loop.
@@ -428,17 +534,19 @@ TkMacOSXEventsCheckProc(
inMode:GetRunLoopMode(modalSession)
dequeue:YES];
if (currentEvent) {
+
/*
* Generate Xevents.
*/
- int oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
NSEvent *processedEvent = [NSApp tkProcessEvent:currentEvent];
- Tcl_SetServiceMode(oldServiceMode);
if (processedEvent) {
+ eventsFound++;
+
#ifdef TK_MAC_DEBUG_EVENTS
TKLog(@" event: %@", currentEvent);
#endif
+
if (modalSession) {
[NSApp _modalSession:modalSession sendEvent:currentEvent];
} else {
@@ -455,6 +563,25 @@ TkMacOSXEventsCheckProc(
*/
[NSApp _unlockAutoreleasePool];
+
+ /*
+ * Add an idle task to the end of the idle queue which will redisplay
+ * all of our dirty windows. We want this to happen after all other
+ * idle tasks have run so that all widgets will be configured before
+ * they are displayed. The drawRect method "borrows" the idle queue
+ * while drawing views. That is, it sends expose events which cause
+ * display procs to be posted as idle tasks and then runs an inner
+ * event loop to processes those idle tasks. We are trying to arrange
+ * for the idle queue to be empty when it starts that process and empty
+ * when it finishes.
+ */
+
+ int dirtyCount = 0;
+ TkMacOSXDrawAllViews(&dirtyCount);
+ if (dirtyCount > 0) {
+ Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL);
+ Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL);
+ }
}
}
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 28010ec..d875873 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -131,29 +131,38 @@
*/
#define TK_NO_DOUBLE_BUFFERING 1
+#define TK_HAS_DYNAMIC_COLORS 1
+#define TK_DYNAMIC_COLORMAP 0x0fffffff
/*
- * Magic pixel code values for system colors.
- *
- * NOTE: values must be kept in sync with indices into the
- * systemColorMap array in tkMacOSXColor.c !
+ * Inform tkImgPhInstance.c that our tkPutImage can render an image with an
+ * alpha channel directly into a window.
+ */
+
+#define TKPUTIMAGE_CAN_BLEND
+
+/*
+ * Used by xcolor.c
*/
-#define TRANSPARENT_PIXEL 30
-#define APPEARANCE_PIXEL 52
-#define PIXEL_MAGIC ((unsigned char) 0x69)
+MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green,
+ unsigned long blue);
+#define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8))
/*
- * The following macro returns the pixel value that corresponds to the
- * 16-bit RGB values in the given XColor structure.
- * The format is: (PIXEL_MAGIC << 24) | (R << 16) | (G << 8) | B
- * where each of R, G and B is the high order byte of a 16-bit component.
+ * Used by tkWindow.c
*/
-#define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \
- | (((p)->red >> 8) & 0xff)) << 8) \
- | (((p)->green >> 8) & 0xff)) << 8) \
- | (((p)->blue >> 8) & 0xff))
+MODULE_SCOPE void TkMacOSXHandleMapOrUnmap(Tk_Window tkwin, XEvent *event);
+
+#define TkpHandleMapOrUnmap(tkwin, event) TkMacOSXHandleMapOrUnmap(tkwin, event)
+
+/*
+ * Used by tkAppInit
+ */
+#define USE_CUSTOM_EXIT_PROC
+EXTERN int TkpWantsExitProc(void);
+EXTERN TCL_NORETURN void TkpExitProc(void *);
#endif /* _TKMACPORT */
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 079e033..8149860 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -4,7 +4,8 @@
* Macros and declarations that are purely internal & private to TkAqua.
*
* Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
+ * Copyright (c) 2008-2009 Apple Inc.
+ * Copyright (c) 2020 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -102,11 +103,11 @@
* debug message in case of failure.
*/
#define ChkErr(f, ...) ({ \
- OSStatus err = f(__VA_ARGS__); \
- if (err != noErr) { \
- TkMacOSXDbgOSErr(f, err); \
+ OSStatus err_ = f(__VA_ARGS__); \
+ if (err_ != noErr) { \
+ TkMacOSXDbgOSErr(f, err_); \
} \
- err;})
+ err_;})
#else /* TK_MAC_DEBUG */
#define TKLog(f, ...)
@@ -225,10 +226,6 @@ MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
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,
@@ -249,45 +246,32 @@ MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp,
int enable);
MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
int antiAlias);
-MODULE_SCOPE int TkMacOSXGenerateFocusEvent(TkWindow *winPtr,
- int activeFlag);
-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 NSBitmapImageRep* TkMacOSXBitmapRepFromDrawableRect(Drawable drawable,
- int x, int y, unsigned int width, unsigned int height);
-MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithXImage(XImage *image);
MODULE_SCOPE void TkMacOSXDrawCGImage(Drawable d, GC gc, CGContextRef context,
CGImageRef image, unsigned long imageForeground,
unsigned long imageBackground, CGRect imageBounds,
CGRect srcBounds, CGRect dstBounds);
MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc,
- int useCG, TkMacOSXDrawingContext *dcPtr);
+ TkMacOSXDrawingContext *dcPtr);
MODULE_SCOPE void TkMacOSXRestoreDrawingContext(
TkMacOSXDrawingContext *dcPtr);
MODULE_SCOPE void TkMacOSXSetColorInContext(GC gc, unsigned long pixel,
CGContextRef context);
-MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr,
- NSWindow *window, int fullscreen,
- Tcl_Interp *interp);
-MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr,
- int active);
-MODULE_SCOPE NSWindow* TkMacOSXDrawableWindow(Drawable drawable);
-MODULE_SCOPE NSView* TkMacOSXDrawableView(MacDrawable *macWin);
+#define TkMacOSXGetTkWindow(window) (TkWindow *)Tk_MacOSXGetTkWindow(window)
+#define TkMacOSXGetNSWindowForDrawable(drawable) ((NSWindow *)Tk_MacOSXGetNSWindowForDrawable(drawable))
+#define TkMacOSXGetNSViewForDrawable(macWin) ((NSView *)Tk_MacOSXGetNSViewForDrawable((Drawable)(macWin)))
+#define TkMacOSXGetCGContextForDrawable(drawable) ((CGContextRef)Tk_MacOSXGetCGContextForDrawable(drawable))
MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
MODULE_SCOPE void TkMacOSXInvalidateViewRegion(NSView *view,
HIShapeRef rgn);
-MODULE_SCOPE CGContextRef TkMacOSXGetCGContextForDrawable(Drawable drawable);
-MODULE_SCOPE CGImageRef TkMacOSXCreateCGImageWithDrawable(Drawable drawable);
-MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithTkImage(Display *display,
+MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromTkImage(Display *display,
Tk_Image image, int width, int height);
-MODULE_SCOPE NSImage* TkMacOSXGetNSImageWithBitmap(Display *display,
+MODULE_SCOPE NSImage* TkMacOSXGetNSImageFromBitmap(Display *display,
Pixmap bitmap, GC gc, int width, int height);
MODULE_SCOPE CGColorRef TkMacOSXCreateCGColor(GC gc, unsigned long pixel);
MODULE_SCOPE NSColor* TkMacOSXGetNSColor(GC gc, unsigned long pixel);
-MODULE_SCOPE TkWindow* TkMacOSXGetTkWindow(NSWindow *w);
MODULE_SCOPE NSFont* TkMacOSXNSFontForFont(Tk_Font tkfont);
MODULE_SCOPE NSDictionary* TkMacOSXNSFontAttributesForFont(Tk_Font tkfont);
MODULE_SCOPE NSModalSession TkMacOSXGetModalSession(void);
@@ -304,9 +288,13 @@ MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc,
int inset, int thickness);
MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp);
MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
+ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode);
+MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view,
+ NSRect *bounds);
+MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);
+MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData);
+MODULE_SCOPE unsigned long TkMacOSXClearPixel(void);
#pragma mark Private Objective-C Classes
@@ -337,16 +325,21 @@ VISIBILITY_HIDDEN
NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems;
NSArray *_defaultHelpMenuItems, *_defaultFileMenuItems;
NSAutoreleasePool *_mainPool;
+ NSThread *_backgoundLoop;
+
#ifdef __i386__
/* The Objective C runtime used on i386 requires this. */
int _poolLock;
- int _macMinorVersion;
+ int _macOSVersion; /* 10000 * major + 100*minor */
Bool _isDrawing;
+ Bool _needsToDraw;
#endif
+
}
@property int poolLock;
-@property int macMinorVersion;
+@property int macOSVersion;
@property Bool isDrawing;
+@property Bool needsToDraw;
@end
@interface TKApplication(TKInit)
@@ -372,6 +365,7 @@ VISIBILITY_HIDDEN
@interface NSApplication(TKNotify)
/* We need to declare this hidden method. */
- (void) _modalSession: (NSModalSession) session sendEvent: (NSEvent *) event;
+- (void) _runBackgroundLoop;
@end
@interface TKApplication(TKEvent)
- (NSEvent *)tkProcessEvent:(NSEvent *)theEvent;
@@ -388,6 +382,7 @@ VISIBILITY_HIDDEN
@end
@interface TKApplication(TKHLEvents)
- (void) terminate: (id) sender;
+- (void) superTerminate: (id) sender;
- (void) preferences: (id) sender;
- (void) handleQuitApplicationEvent: (NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent;
@@ -417,9 +412,11 @@ VISIBILITY_HIDDEN
{
@private
NSString *privateWorkingText;
- Bool _needsRedisplay;
+ Bool _tkNeedsDisplay;
+ NSRect _tkDirtyRect;
}
-@property Bool needsRedisplay;
+@property Bool tkNeedsDisplay;
+@property NSRect tkDirtyRect;
@end
@interface TKContentView(TKKeyEvent)
@@ -428,7 +425,9 @@ VISIBILITY_HIDDEN
@end
@interface TKContentView(TKWindowEvent)
-- (void) generateExposeEvents: (HIShapeRef) shape;
+- (void) addTkDirtyRect: (NSRect) rect;
+- (void) clearTkDirtyRect;
+- (void) generateExposeEvents: (NSRect) rect;
- (void) tkToolbarButton: (id) sender;
@end
@@ -439,16 +438,40 @@ VISIBILITY_HIDDEN
VISIBILITY_HIDDEN
@interface TKWindow : NSWindow
+{
+#ifdef __i386__
+ /* The Objective C runtime used on i386 requires this. */
+ Bool _mouseInResizeArea;
+ Window _tkWindow;
+#endif
+}
+@property Bool mouseInResizeArea;
+@property Window tkWindow;
@end
@interface TKWindow(TKWm)
- (void) tkLayoutChanged;
@end
-@interface NSDrawerWindow : NSWindow
+@interface TKDrawerWindow : NSWindow
{
id _i1, _i2;
+#ifdef __i386__
+ /* The Objective C runtime used on i386 requires this. */
+ Window _tkWindow;
+#endif
+}
+@property Window tkWindow;
+@end
+
+@interface TKPanel : NSPanel
+{
+#ifdef __i386__
+ /* The Objective C runtime used on i386 requires this. */
+ Window _tkWindow;
+#endif
}
+@property Window tkWindow;
@end
#pragma mark NSMenu & NSMenuItem Utilities
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index 0a5ff6d..6cb61dd 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -12,6 +12,16 @@
*/
#include "tkMacOSXPrivate.h"
+static void RetainRegion(TkRegion r);
+static void ReleaseRegion(TkRegion r);
+
+#ifdef DEBUG
+static int totalRegions = 0;
+static int totalRegionRetainCount = 0;
+#define DebugLog(msg, ...) fprintf(stderr, (msg), ##__VA_ARGS__)
+#else
+#define DebugLog(msg, ...)
+#endif
/*
@@ -34,7 +44,10 @@
Region
XCreateRegion(void)
{
- return (Region) HIShapeCreateMutable();
+ Region region = (Region) HIShapeCreateMutable();
+ DebugLog("Created region: total regions = %d\n", ++totalRegions);
+ RetainRegion(region);
+ return region;
}
/*
@@ -59,7 +72,8 @@ XDestroyRegion(
Region r)
{
if (r) {
- CFRelease(r);
+ DebugLog("Destroyed region: total regions = %d\n", --totalRegions);
+ ReleaseRegion(r);
}
return Success;
}
@@ -320,7 +334,7 @@ TkpBuildRegionFromAlphaData(
/*
*----------------------------------------------------------------------
*
- * TkpRetainRegion --
+ * RetainRegion --
*
* Increases reference count of region.
*
@@ -333,17 +347,18 @@ TkpBuildRegionFromAlphaData(
*----------------------------------------------------------------------
*/
-void
-TkpRetainRegion(
+static void
+RetainRegion(
Region r)
{
CFRetain(r);
+ DebugLog("Retained region: total count is %d\n", ++totalRegionRetainCount);
}
/*
*----------------------------------------------------------------------
*
- * TkpReleaseRegion --
+ * ReleaseRegion --
*
* Decreases reference count of region.
*
@@ -356,11 +371,12 @@ TkpRetainRegion(
*----------------------------------------------------------------------
*/
-void
-TkpReleaseRegion(
+static void
+ReleaseRegion(
Region r)
{
CFRelease(r);
+ DebugLog("Released region: total count is %d\n", --totalRegionRetainCount);
}
/*
@@ -463,7 +479,7 @@ XOffsetRegion(
*----------------------------------------------------------------------
*
* TkMacOSXHIShapeCreateEmpty, TkMacOSXHIShapeCreateMutableWithRect,
- * TkMacOSXHIShapeSetWithShape, TkMacOSXHIShapeSetWithRect,
+ * TkMacOSXHIShapeSetWithShape,
* TkMacOSHIShapeDifferenceWithRect, TkMacOSHIShapeUnionWithRect,
* TkMacOSHIShapeUnion --
*
@@ -502,22 +518,6 @@ TkMacOSXHIShapeSetWithShape(
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,
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index 2e33622..2bbd795 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -149,8 +149,6 @@ TkpDisplayScale(
MacScale *macScalePtr = clientData;
Rect r;
WindowRef windowRef;
- CGrafPtr destPort, savePort;
- Boolean portChanged;
MacDrawable *macDraw;
SInt32 initialValue, minValue, maxValue;
UInt16 numTicks;
@@ -179,7 +177,7 @@ TkpDisplayScale(
Tcl_DStringAppend(&buf, scalePtr->command, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, string, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
@@ -215,11 +213,8 @@ TkpDisplayScale(
* 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));
+ macDraw = (MacDrawable *)Tk_WindowId(tkwin);
+ windowRef = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin));
/*
* Create Macintosh control.
@@ -293,9 +288,6 @@ TkpDisplayScale(
HiliteControl(macScalePtr->scaleHandle, 0);
Draw1Control(macScalePtr->scaleHandle);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
done:
scalePtr->flags &= ~REDRAW_ALL;
}
@@ -327,14 +319,10 @@ TkpScaleElement(
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
@@ -346,10 +334,6 @@ TkpScaleElement(
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
@@ -401,8 +385,6 @@ MacScaleEventProc(
Point where;
Rect bounds;
int part;
- CGrafPtr destPort, savePort;
- Boolean portChanged;
#ifdef TK_MAC_DEBUG_SCALE
fprintf(stderr,"MacScaleEventProc\n" );
@@ -414,14 +396,6 @@ MacScaleEventProc(
* 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);
@@ -447,10 +421,6 @@ MacScaleEventProc(
*/
TkGenerateButtonEventForXPointer(Tk_WindowId(macScalePtr->info.tkwin));
-
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
}
/*
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index a49ec55..3149b15 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -174,8 +174,8 @@ static void drawMacScrollbar(
MacScrollbar *msPtr,
CGContextRef context)
{
- MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
- NSView *view = TkMacOSXDrawableView(macWin);
+ Drawable d = Tk_WindowId(scrollPtr->tkwin);
+ NSView *view = TkMacOSXGetNSViewForDrawable(d);
CGPathRef path;
CGPoint inner[2], outer[2], thumbOrigin;
CGSize thumbSize;
@@ -258,12 +258,12 @@ TkpDisplayScrollbar(
return;
}
- MacDrawable *macWin = (MacDrawable *) winPtr->window;
- NSView *view = TkMacOSXDrawableView(macWin);
+ MacDrawable *macWin = (MacDrawable *)winPtr->window;
+ NSView *view = TkMacOSXGetNSViewForDrawable(macWin);
if ((view == NULL)
|| (macWin->flags & TK_DO_NOT_DRAW)
- || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) {
+ || !TkMacOSXSetupDrawingContext((Drawable)macWin, NULL, &dc)) {
return;
}
@@ -316,7 +316,7 @@ TkpDisplayScrollbar(
if (SNOW_LEOPARD_STYLE) {
HIThemeDrawTrack(&msPtr->info, 0, dc.context,
kHIThemeOrientationInverted);
- } else if ([NSApp macMinorVersion] <= 8) {
+ } else if ([NSApp macOSVersion] <= 100800) {
HIThemeDrawTrack(&msPtr->info, 0, dc.context,
kHIThemeOrientationNormal);
} else {
@@ -377,7 +377,7 @@ TkpComputeScrollbarGeometry(
scrollPtr->highlightWidth = 0;
}
scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
scrollPtr->arrowLength = scrollPtr->width;
} else {
scrollPtr->arrowLength = 0;
@@ -590,12 +590,12 @@ UpdateControlValues(
{
MacScrollbar *msPtr = (MacScrollbar *) scrollPtr;
Tk_Window tkwin = scrollPtr->tkwin;
- MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
+ MacDrawable *macWin = (MacDrawable *)Tk_WindowId(scrollPtr->tkwin);
double dViewSize;
HIRect contrlRect;
short width, height;
- NSView *view = TkMacOSXDrawableView(macWin);
+ NSView *view = TkMacOSXGetNSViewForDrawable(macWin);
CGFloat viewHeight = [view bounds].size.height;
NSRect frame;
@@ -662,7 +662,7 @@ UpdateControlValues(
*
* ScrollbarEvent --
*
- * This procedure is invoked in response to <ButtonPress>,
+ * This procedure is invoked in response to <Button>,
* <ButtonRelease>, <EnterNotify>, and <LeaveNotify> events. The
* Scrollbar appearance is modified for each event.
*
diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c
index 71a86df..8cc00d3 100644
--- a/macosx/tkMacOSXSend.c
+++ b/macosx/tkMacOSXSend.c
@@ -3,7 +3,7 @@
*
* 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.
+ * current implementation for the Mac has most functionality stubbed 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
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 974fec1..6e1a9a1 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -20,12 +20,10 @@
static int
ServicesEventProc(
- Tcl_Event *event,
- int flags)
+ TCL_UNUSED(Tcl_Event *),
+ TCL_UNUSED(int))
{
TkMainInfo *info = TkGetMainInfoList();
- (void)event;
- (void)flags;
Tcl_GlobalEval(info->interp, "::tk::mac::PerformService");
return 1;
@@ -143,9 +141,8 @@ ServicesEventProc(
int
TkMacOSXServices_Init(
- Tcl_Interp *dummy)
+ TCL_UNUSED(Tcl_Interp *))
{
- (void)dummy;
/*
* Initialize an instance of TkService and register it with the NSApp.
*/
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 611afd7..d2979f6 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -14,6 +14,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXDebug.h"
#include "tkMacOSXWm.h"
+#include "tkMacOSXConstants.h"
/*
#ifdef TK_MAC_DEBUG
@@ -38,7 +39,7 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
*
* XDestroyWindow --
*
- * Dealocates the given X Window.
+ * Deallocates the given X Window.
*
* Results:
* The window id is returned.
@@ -51,11 +52,10 @@ static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
int
XDestroyWindow(
- Display *display, /* Display. */
+ TCL_UNUSED(Display *), /* Display. */
Window window) /* Window. */
{
- MacDrawable *macWin = (MacDrawable *) window;
- (void)display;
+ MacDrawable *macWin = (MacDrawable *)window;
/*
* Remove any dangling pointers that may exist if the window we are
@@ -69,7 +69,7 @@ XDestroyWindow(
if (!Tk_IsTopLevel(macWin->winPtr)) {
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
if (macWin->winPtr->parentPtr != NULL) {
- TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)macWin->winPtr->parentPtr);
}
if (macWin->visRgn) {
CFRelease(macWin->visRgn);
@@ -120,14 +120,18 @@ XDestroyWindow(
*
* XMapWindow --
*
- * Map the given X Window to the screen. See X window documentation for
- * more details.
+ * This X11 stub maps the given X11 Window but does not update any of
+ * the Tk structures describing the window. Tk applications should
+ * never call this directly, but it is called by Tk_MapWindow and
+ * Tk_WmMapWindow.
*
* Results:
- * None.
+ * Returns Success or BadWindow.
*
* Side effects:
- * The subwindow or toplevel may appear on the screen.
+ * The subwindow or toplevel may appear on the screen. VisibilityNotify
+ * events are generated.
+ *
*
*----------------------------------------------------------------------
*/
@@ -137,10 +141,13 @@ XMapWindow(
Display *display, /* Display. */
Window window) /* Window. */
{
- MacDrawable *macWin = (MacDrawable *) window;
+ if (!window) {
+ return BadWindow;
+ }
+ MacDrawable *macWin = (MacDrawable *)window;
TkWindow *winPtr = macWin->winPtr;
- NSWindow *win = TkMacOSXDrawableWindow(window);
- XEvent event;
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
+ static Bool initialized = NO;
/*
* Under certain situations it's possible for this function to be called
@@ -155,9 +162,9 @@ XMapWindow(
}
display->request++;
- winPtr->flags |= TK_MAPPED;
if (Tk_IsTopLevel(winPtr)) {
if (!Tk_IsEmbedded(winPtr)) {
+ TKContentView *view = [win contentView];
/*
* We want to activate Tk when a toplevel is mapped but we must not
@@ -169,12 +176,14 @@ XMapWindow(
TkMacOSXApplyWindowAttributes(winPtr, win);
[win setExcludedFromWindowsMenu:NO];
- [NSApp activateIgnoringOtherApps:NO];
- [[win contentView] setNeedsDisplay:YES];
- if ([win canBecomeKeyWindow]) {
- [win makeKeyAndOrderFront:NSApp];
- } else {
- [win orderFrontRegardless];
+ [NSApp activateIgnoringOtherApps:initialized];
+ [view addTkDirtyRect: [view bounds]];
+ if (initialized) {
+ if ([win canBecomeKeyWindow]) {
+ [win makeKeyAndOrderFront:NSApp];
+ } else {
+ [win orderFrontRegardless];
+ }
}
} else {
TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
@@ -184,25 +193,10 @@ XMapWindow(
* the window.
*/
- TkMacOSXInvalClipRgns((Tk_Window) contWinPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)contWinPtr);
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
}
-
- TkMacOSXInvalClipRgns((Tk_Window) winPtr);
-
- /*
- * We only need to send the MapNotify event for toplevel windows.
- */
-
- event.xany.serial = LastKnownRequestProcessed(display);
- 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 = winPtr->atts.override_redirect;
- Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ TkMacOSXInvalClipRgns((Tk_Window)winPtr);
} else {
/*
@@ -210,24 +204,33 @@ XMapWindow(
* and redisplay the window.
*/
- TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr);
}
- if ([NSApp isDrawing]) {
- [[win contentView] setNeedsRedisplay:YES];
- } else {
- [[win contentView] setNeedsDisplay:YES];
+ /*
+ * Mark the toplevel as needing to be redrawn, unless the window is being
+ * mapped while drawing is taking place.
+ */
+
+ TKContentView *view = [win contentView];
+ if (view != [NSView focusView]) {
+ [view addTkDirtyRect:[view bounds]];
}
/*
* 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(winPtr, &event);
+ if (initialized) {
+ XEvent event;
+ event.xany.send_event = False;
+ event.xany.display = display;
+ event.xvisibility.type = VisibilityNotify;
+ event.xvisibility.state = VisibilityUnobscured;
+ NotifyVisibility(winPtr, &event);
+ } else {
+ initialized = YES;
+ }
return Success;
}
@@ -270,11 +273,13 @@ NotifyVisibility(
*
* XUnmapWindow --
*
- * Unmap the given X Window to the screen. See X window documentation for
- * more details.
+ * This X11 stub maps the given X11 Window but does not update any of
+ * The Tk structures describing the window. Tk applications should
+ * never call this directly, but it is called by Tk_UnmapWindow and
+ * Tk_WmUnmapWindow.
*
* Results:
- * None.
+ * Always returns Success or BadWindow.
*
* Side effects:
* The subwindow or toplevel may be removed from the screen.
@@ -287,33 +292,22 @@ XUnmapWindow(
Display *display, /* Display. */
Window window) /* Window. */
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
TkWindow *winPtr = macWin->winPtr;
TkWindow *parentPtr = winPtr->parentPtr;
- NSWindow *win = TkMacOSXDrawableWindow(window);
- XEvent event;
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
+ if (!window) {
+ return BadWindow;
+ }
display->request++;
if (Tk_IsTopLevel(winPtr)) {
if (!Tk_IsEmbedded(winPtr) &&
winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
[win orderOut:nil];
+ [win setExcludedFromWindowsMenu:YES];
}
- TkMacOSXInvalClipRgns((Tk_Window) winPtr);
-
- /*
- * We only need to send the UnmapNotify event for toplevel windows.
- */
-
- event.xany.serial = LastKnownRequestProcessed(display);
- 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);
+ TkMacOSXInvalClipRgns((Tk_Window)winPtr);
} else {
/*
* Rebuild the visRgn clip region for the parent so it will be allowed
@@ -323,17 +317,15 @@ XUnmapWindow(
if (parentPtr && parentPtr->privatePtr->visRgn) {
TkMacOSXInvalidateViewRegion(
- TkMacOSXDrawableView(parentPtr->privatePtr),
+ TkMacOSXGetNSViewForDrawable(parentPtr->privatePtr),
parentPtr->privatePtr->visRgn);
}
- TkMacOSXInvalClipRgns((Tk_Window) parentPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)parentPtr);
TkMacOSXUpdateClipRgn(parentPtr);
}
- winPtr->flags &= ~TK_MAPPED;
- if ([NSApp isDrawing]) {
- [[win contentView] setNeedsRedisplay:YES];
- } else {
- [[win contentView] setNeedsDisplay:YES];
+ TKContentView *view = [win contentView];
+ if (view != [NSView focusView]) {
+ [view addTkDirtyRect:[view bounds]];
}
return Success;
}
@@ -362,19 +354,23 @@ XResizeWindow(
unsigned int width,
unsigned int height)
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
- NSWindow *w = macWin->winPtr->wmInfoPtr->window;
+ TKWindow *w = (TKWindow *)macWin->winPtr->wmInfoPtr->window;
if (w) {
- NSRect r = [w contentRectForFrameRect:[w frame]];
+ if ([w styleMask] & NSFullScreenWindowMask) {
+ [w tkLayoutChanged];
+ } else {
+ NSRect r = [w contentRectForFrameRect:[w frame]];
- r.origin.y += r.size.height - height;
- r.size.width = width;
- r.size.height = height;
- [w setFrame:[w frameRectForContentRect:r] display:YES];
+ r.origin.y += r.size.height - height;
+ r.size.width = width;
+ r.size.height = height;
+ [w setFrame:[w frameRectForContentRect:r] display:NO];
+ }
}
} else {
MoveResizeWindow(macWin);
@@ -407,7 +403,7 @@ XMoveResizeWindow(
unsigned int width,
unsigned int height)
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
@@ -430,7 +426,7 @@ XMoveResizeWindow(
X + XOff, TkMacOSXZeroScreenHeight() - Y - YOff - Height,
Width, Height);
- [w setFrame:[w frameRectForContentRect:r] display:YES];
+ [w setFrame:[w frameRectForContentRect:r] display:NO];
}
} else {
MoveResizeWindow(macWin);
@@ -460,7 +456,7 @@ XMoveWindow(
Window window, /* Window. */
int x, int y)
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
@@ -498,7 +494,7 @@ MoveResizeWindow(
{
int deltaX = 0, deltaY = 0, parentBorderwidth = 0;
MacDrawable *macParent = NULL;
- NSWindow *macWindow = TkMacOSXDrawableWindow((Drawable) macWin);
+ NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable((Drawable)macWin);
/*
* Find the Parent window, for an embedded window it will be its container.
@@ -535,7 +531,7 @@ MoveResizeWindow(
if (macWindow) {
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
if (macParent) {
- TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)macParent->winPtr);
}
}
UpdateOffsets(macWin->winPtr, deltaX, deltaY);
@@ -603,7 +599,7 @@ XRaiseWindow(
Display *display, /* Display. */
Window window) /* Window. */
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
@@ -637,7 +633,7 @@ XLowerWindow(
Display *display, /* Display. */
Window window) /* Window. */
{
- MacDrawable *macWin = (MacDrawable *) window;
+ MacDrawable *macWin = (MacDrawable *)window;
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
@@ -673,11 +669,10 @@ XConfigureWindow(
Display *display, /* Display. */
Window w, /* Window. */
unsigned int value_mask,
- XWindowChanges *values)
+ TCL_UNUSED(XWindowChanges *))
{
- MacDrawable *macWin = (MacDrawable *) w;
+ MacDrawable *macWin = (MacDrawable *)w;
TkWindow *winPtr = macWin->winPtr;
- (void)values;
display->request++;
@@ -698,17 +693,11 @@ XConfigureWindow(
*/
if (value_mask & CWStackMode) {
- NSView *view = TkMacOSXDrawableView(macWin);
- Rect bounds;
- NSRect r;
+ NSView *view = TkMacOSXGetNSViewForDrawable(macWin);
if (view) {
- TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);
- TkMacOSXWinBounds(winPtr, &bounds);
- r = NSMakeRect(bounds.left,
- [view bounds].size.height - bounds.bottom,
- bounds.right - bounds.left, bounds.bottom - bounds.top);
- [view setNeedsDisplayInRect:r];
+ TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr);
+ TkpRedrawWidget((Tk_Window)winPtr);
}
}
@@ -827,7 +816,7 @@ TkMacOSXUpdateClipRgn(
/*
* Clip away the area of any windows that may obscure this window.
- * For a non-toplevel window, first, clip to the parents visible
+ * For a non-toplevel window, first, clip to the parent's 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
@@ -856,15 +845,6 @@ TkMacOSXUpdateClipRgn(
TkMacOSXUpdateClipRgn(win2Ptr);
ChkErr(HIShapeIntersect,
win2Ptr->privatePtr->aboveVisRgn, rgn, rgn);
- } else if (tkMacOSXEmbedHandler != NULL) {
- Region r = XCreateRegion();
- HIShapeRef visRgn;
-
- tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr, r);
- visRgn = TkMacOSXGetNativeRegion(r);
- ChkErr(HIShapeIntersect, visRgn, rgn, rgn);
- CFRelease(visRgn);
- TkpReleaseRegion(r);
}
/*
@@ -988,13 +968,13 @@ TkMacOSXVisableClipRgn(
static OSStatus
InvalViewRect(
int msg,
- HIShapeRef rgn,
+ TCL_UNUSED(HIShapeRef),
const CGRect *rect,
void *ref)
{
static CGAffineTransform t;
- NSView *view = ref;
- (void)rgn;
+ TKContentView *view = ref;
+ NSRect dirtyRect;
if (!view) {
return paramErr;
@@ -1005,8 +985,8 @@ InvalViewRect(
NSHeight([view bounds]));
break;
case kHIShapeEnumerateRect:
- [view setNeedsDisplayInRect:NSRectFromCGRect(
- CGRectApplyAffineTransform(*rect, t))];
+ dirtyRect = NSRectFromCGRect(CGRectApplyAffineTransform(*rect, t));
+ [view addTkDirtyRect:dirtyRect];
break;
}
return noErr;
@@ -1052,16 +1032,17 @@ TkMacOSXInvalidateWindow(
if (macWin->flags & TK_CLIP_INVALID) {
TkMacOSXUpdateClipRgn(macWin->winPtr);
}
- TkMacOSXInvalidateViewRegion(TkMacOSXDrawableView(macWin),
+ TkMacOSXInvalidateViewRegion(TkMacOSXGetNSViewForDrawable(macWin),
(flag == TK_WINDOW_ONLY) ? macWin->visRgn : macWin->aboveVisRgn);
}
/*
*----------------------------------------------------------------------
*
- * TkMacOSXDrawableWindow --
+ * TkMacOSXGetNSWindowForDrawable --
*
- * This function returns the NSWindow for a given X drawable.
+ * This function returns the NSWindow for a given X drawable, if the
+ * drawable is a window. If the drawable is a pixmap it returns nil.
*
* Results:
* A NSWindow, or nil for off screen pixmaps.
@@ -1072,11 +1053,11 @@ TkMacOSXInvalidateWindow(
*----------------------------------------------------------------------
*/
-NSWindow *
-TkMacOSXDrawableWindow(
+void *
+Tk_MacOSXGetNSWindowForDrawable(
Drawable drawable)
{
- MacDrawable *macWin = (MacDrawable *) drawable;
+ MacDrawable *macWin = (MacDrawable *)drawable;
NSWindow *result = nil;
if (!macWin || macWin->flags & TK_IS_PIXMAP) {
@@ -1092,50 +1073,25 @@ TkMacOSXDrawableWindow(
TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
if (contWinPtr) {
- result = TkMacOSXDrawableWindow((Drawable) contWinPtr->privatePtr);
+ result = TkMacOSXGetNSWindowForDrawable((Drawable)contWinPtr->privatePtr);
}
}
return result;
}
-
-void *
-TkMacOSXDrawable(
- Drawable drawable)
-{
- return TkMacOSXDrawableWindow(drawable);
-}
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetDrawablePort --
- *
- * This function returns the Graphics Port for a given X drawable.
- *
- * Results:
- * NULL.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void *
-TkMacOSXGetDrawablePort(
- Drawable drawable)
-{
- (void)drawable;
-
- return NULL;
-}
-
-/*
- *----------------------------------------------------------------------
+ * TkMacOSXGetNSViewForDrawable/TkMacOSXGetRootControl --
*
- * TkMacOSXDrawableView --
+ * The function name TkMacOSXGetRootControl is being preserved only
+ * because it exists in a stubs table. Nobody knows what it means to
+ * get a "RootControl". The macro TkMacOSXGetNSViewForDrawable calls
+ * this function and should always be used rather than directly using
+ * the obscure official name of this function.
*
- * This function returns the NSView for a given X drawable.
+ * It returns the NSView for a given X drawable in the case that the
+ * drawable is a window. If the drawable is a pixmap it returns nil.
*
* Results:
* A NSView* or nil.
@@ -1146,14 +1102,15 @@ TkMacOSXGetDrawablePort(
*----------------------------------------------------------------------
*/
-NSView *
-TkMacOSXDrawableView(
- MacDrawable *macWin)
+void *
+TkMacOSXGetRootControl(
+ Drawable drawable)
{
- NSView *result = nil;
+ void *result = NULL;
+ MacDrawable *macWin = (MacDrawable *)drawable;
if (!macWin) {
- result = nil;
+ result = NULL;
} else if (!macWin->toplevel) {
result = macWin->view;
} else if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
@@ -1162,7 +1119,7 @@ TkMacOSXDrawableView(
TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
if (contWinPtr) {
- result = TkMacOSXDrawableView(contWinPtr->privatePtr);
+ result = TkMacOSXGetRootControl((Drawable)contWinPtr->privatePtr);
}
}
return result;
@@ -1171,33 +1128,6 @@ TkMacOSXDrawableView(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetRootControl --
- *
- * This function returns the NSView for a given X drawable.
- *
- * Results:
- * A NSView* .
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void *
-TkMacOSXGetRootControl(
- Drawable drawable)
-{
- /*
- * will probably need to fix this up for embedding
- */
-
- return TkMacOSXDrawableView((MacDrawable *) drawable);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkMacOSXInvalClipRgns --
*
* This function invalidates the clipping regions for a given window and
@@ -1258,7 +1188,7 @@ TkMacOSXInvalClipRgns(
childPtr = winPtr->childList;
while (childPtr) {
if (!Tk_IsTopLevel(childPtr)) {
- TkMacOSXInvalClipRgns((Tk_Window) childPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)childPtr);
}
childPtr = childPtr->nextPtr;
}
@@ -1271,7 +1201,7 @@ TkMacOSXInvalClipRgns(
childPtr = TkpGetOtherWindow(winPtr);
if (childPtr) {
- TkMacOSXInvalClipRgns((Tk_Window) childPtr);
+ TkMacOSXInvalClipRgns((Tk_Window)childPtr);
}
/*
@@ -1285,7 +1215,7 @@ TkMacOSXInvalClipRgns(
*
* TkMacOSXWinBounds --
*
- * Given a Tk window this function determines the windows bounds in
+ * Given a Tk window this function determines the window's 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.
@@ -1294,7 +1224,7 @@ TkMacOSXInvalClipRgns(
* None.
*
* Side effects:
- * None.
+ * Fills in a Rect.
*
*----------------------------------------------------------------------
*/
@@ -1317,16 +1247,15 @@ TkMacOSXWinBounds(
*
* 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.
+ * Given a Tk window this function determines the window's bounds in
+ * the coordinate system of the Tk toplevel window in which this window
+ * is contained. This fills in a CGRect struct.
*
* Results:
* None.
*
* Side effects:
- * None.
+ * Fill in a CGRect.
*
*----------------------------------------------------------------------
*/
@@ -1341,6 +1270,39 @@ TkMacOSXWinCGBounds(
bounds->size.width = winPtr->changes.width;
bounds->size.height = winPtr->changes.height;
}
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXWinNSBounds --
+ *
+ * Given a Tk window this function determines the window's bounds in
+ * the coordinate system of the TKContentView in which this Tk window
+ * is contained, which has the origin at the lower left corner. This
+ * fills in an NSRect struct and requires the TKContentView as a
+ * parameter
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Fills in an NSRect.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXWinNSBounds(
+ TkWindow *winPtr,
+ NSView *view,
+ NSRect *bounds)
+{
+ bounds->size.width = winPtr->changes.width;
+ bounds->size.height = winPtr->changes.height;
+ bounds->origin.x = winPtr->privatePtr->xOff;
+ bounds->origin.y = ([view bounds].size.height -
+ bounds->size.height -
+ winPtr->privatePtr->yOff);
+}
/*
*----------------------------------------------------------------------
@@ -1421,13 +1383,12 @@ UpdateOffsets(
Pixmap
Tk_GetPixmap(
Display *display, /* Display for new pixmap (can be null). */
- Drawable d, /* Drawable where pixmap will be used (ignored). */
+ TCL_UNUSED(Drawable), /* Drawable where pixmap will be used (ignored). */
int width, /* Dimensions of pixmap. */
int height,
int depth) /* Bits per pixel for pixmap. */
{
MacDrawable *macPix;
- (void)d;
if (display != NULL) {
display->request++;
@@ -1470,7 +1431,7 @@ Tk_FreePixmap(
Display *display, /* Display. */
Pixmap pixmap) /* Pixmap to destroy */
{
- MacDrawable *macPix = (MacDrawable *) pixmap;
+ MacDrawable *macPix = (MacDrawable *)pixmap;
display->request++;
if (macPix->context) {
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 2d22824..4ded4de 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -14,6 +14,8 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXConstants.h"
+#include "tkMacOSXWm.h"
+
/*
* Forward declarations of procedures defined later in this file:
@@ -24,9 +26,11 @@ static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
#endif
static int PressButtonObjCmd (ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+ int objc, Tcl_Obj *const *objv);
static int InjectKeyEventObjCmd (ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+ int objc, Tcl_Obj *const *objv);
+static int MenuBarHeightObjCmd (ClientData dummy, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const *objv);
/*
@@ -59,7 +63,7 @@ TkplatformtestInit(
#endif
Tcl_CreateObjCommand(interp, "pressbutton", PressButtonObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "injectkeyevent", InjectKeyEventObjCmd, NULL, NULL);
-
+ Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL);
return TCL_OK;
}
@@ -96,21 +100,48 @@ DebuggerObjCmd(
/*
*----------------------------------------------------------------------
*
+ * MenuBarHeightObjCmd --
+ *
+ * This procedure calls [NSMenu menuBarHeight] and returns the result
+ * as an integer. Windows can never be placed to overlap the MenuBar,
+ * so tests need to be aware of its size.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MenuBarHeightObjCmd(
+ TCL_UNUSED(void *), /* Not used. */
+ Tcl_Interp *interp, /* Not used. */
+ TCL_UNUSED(int), /* Not used. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Not used. */
+{
+ static int height = 0;
+ if (height == 0) {
+ height = (int) [[NSApp mainMenu] menuBarHeight];
+ }
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkTestLogDisplay --
*
* The test image display procedure calls this to determine whether it
- * should write a log message recording that it has being run. On OSX
- * 10.14 and later, only calls to the display procedure which occur inside
- * of the drawRect method should be logged, since those are the only ones
- * which actually draw anything. On earlier systems the opposite is true.
- * The calls from within the drawRect method are redundant, since the
- * first time the display procedure is run it will do the drawing and that
- * first call will usually not occur inside of drawRect.
+ * should write a log message recording that it has being run.
*
* Results:
- * On OSX 10.14 and later, returns true if and only if called from
- * within [NSView drawRect]. On earlier systems returns false if
- * and only if called from with [NSView drawRect].
+ * Returns true if and only if the NSView of the drawable is the
+ * current focusView, which on 10.14 and newer systems can only be the
+ * case when within [NSView drawRect].
*
* Side effects:
* None
@@ -118,11 +149,23 @@ DebuggerObjCmd(
*----------------------------------------------------------------------
*/
MODULE_SCOPE Bool
-TkTestLogDisplay(void) {
- if ([NSApp macMinorVersion] >= 14) {
- return [NSApp isDrawing];
+TkTestLogDisplay(
+ Drawable drawable)
+{
+ MacDrawable *macWin = (MacDrawable *)drawable;
+ NSWindow *win = nil;
+ if (macWin->toplevel && macWin->toplevel->winPtr &&
+ macWin->toplevel->winPtr->wmInfoPtr &&
+ macWin->toplevel->winPtr->wmInfoPtr->window) {
+ win = macWin->toplevel->winPtr->wmInfoPtr->window;
+ } else if (macWin->winPtr && macWin->winPtr->wmInfoPtr &&
+ macWin->winPtr->wmInfoPtr->window) {
+ win = macWin->winPtr->wmInfoPtr->window;
+ }
+ if (win) {
+ return ([win contentView] == [NSView focusView]);
} else {
- return ![NSApp isDrawing];
+ return True;
}
}
@@ -132,9 +175,11 @@ TkTestLogDisplay(void) {
* PressButtonObjCmd --
*
* This Tcl command simulates a button press at a specific screen
- * location. It injects NSEvents into the NSApplication event queue,
- * as opposed to adding events to the Tcl queue as event generate
- * would do. One application is for testing the grab command.
+ * location. It injects NSEvents into the NSApplication event queue, as
+ * opposed to adding events to the Tcl queue as event generate would do.
+ * One application is for testing the grab command. These events have
+ * their unused context property set to 1 as a signal indicating that they
+ * should not be ignored by [NSApp tkProcessMouseEvent].
*
* Results:
* A standard Tcl result.
@@ -147,19 +192,19 @@ TkTestLogDisplay(void) {
static int
PressButtonObjCmd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
- int x = 0, y = 0, i, value, wNum;
+ int x = 0, y = 0, i, value;
+ NSInteger signal = -1;
CGPoint pt;
NSPoint loc;
NSEvent *motion, *press, *release;
NSArray *screens = [NSScreen screens];
CGFloat ScreenHeight = 0;
enum {X=1, Y};
- (void)dummy;
if (screens && [screens count]) {
ScreenHeight = [[screens objectAtIndex:0] frame].size.height;
@@ -187,15 +232,20 @@ PressButtonObjCmd(
pt.x = loc.x = x;
pt.y = y;
loc.y = ScreenHeight - y;
- wNum = 0;
+
+ /*
+ * We set the window number and the eventNumber to -1 as a signal to
+ * processMouseEvent.
+ */
+
CGWarpMouseCursorPosition(pt);
motion = [NSEvent mouseEventWithType:NSMouseMoved
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:0
+ eventNumber:signal
clickCount:1
pressure:0.0];
[NSApp postEvent:motion atStart:NO];
@@ -203,9 +253,9 @@ PressButtonObjCmd(
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:1
+ eventNumber:signal
clickCount:1
pressure:0.0];
[NSApp postEvent:press atStart:NO];
@@ -213,18 +263,18 @@ PressButtonObjCmd(
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:2
+ eventNumber:signal
clickCount:1
- pressure:0.0];
+ pressure:-1.0];
[NSApp postEvent:release atStart:NO];
return TCL_OK;
}
static int
InjectKeyEventObjCmd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -241,7 +291,6 @@ InjectKeyEventObjCmd(
NSEvent *keyEvent;
NSUInteger type;
MacKeycode macKC;
- (void)dummy;
if (objc < 3) {
wrongArgs:
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 71e687b..30a2d57 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -30,17 +30,17 @@
* Declaration of functions used only in this file
*/
-static int GenerateUpdates(HIShapeRef updateRgn,
- CGRect *updateBounds, TkWindow *winPtr);
+static int GenerateUpdates(
+ CGRect *updateBounds, TkWindow *winPtr);
static int GenerateActivateEvents(TkWindow *winPtr,
int activeFlag);
-static void DoWindowActivate(ClientData clientData);
#pragma mark TKApplication(TKWindowEvent)
-#ifdef TK_MAC_DEBUG_NOTIFICATIONS
-extern NSString *NSWindowWillOrderOnScreenNotification;
extern NSString *NSWindowDidOrderOnScreenNotification;
+extern NSString *NSWindowWillOrderOnScreenNotification;
+
+#ifdef TK_MAC_DEBUG_NOTIFICATIONS
extern NSString *NSWindowDidOrderOffScreenNotification;
#endif
@@ -90,15 +90,12 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
height = bounds.size.height - wmPtr->yInParent;
flags |= TK_SIZE_CHANGED;
}
- if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) {
- /*
- * Propagate geometry changes immediately.
- */
-
- flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY;
- }
+ /*
+ * Propagate geometry changes immediately.
+ */
- TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags);
+ flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY;
+ TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width, height, flags);
}
}
@@ -114,25 +111,21 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
if (winPtr) {
winPtr->wmInfoPtr->hints.initial_state =
TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState;
- Tk_MapWindow((Tk_Window) winPtr);
- if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) {
+ Tk_MapWindow((Tk_Window)winPtr);
- /*
- * Process all Tk events generated by Tk_MapWindow().
- */
+ /*
+ * Process all Tk events generated by Tk_MapWindow().
+ */
- while (Tcl_ServiceEvent(0)) {}
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {}
+ while (Tcl_ServiceEvent(0)) {}
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
- /*
- * NSWindowDidDeminiaturizeNotification is received after
- * NSWindowDidBecomeKeyNotification, so activate manually
- */
+ /*
+ * NSWindowDidDeminiaturizeNotification is received after
+ * NSWindowDidBecomeKeyNotification, so activate manually
+ */
- GenerateActivateEvents(winPtr, 1);
- } else {
- Tcl_DoWhenIdle(DoWindowActivate, winPtr);
- }
+ GenerateActivateEvents(winPtr, 1);
}
}
@@ -154,6 +147,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
willUseFullScreenContentSize:(NSSize)proposedSize
{
(void)window;
+
/*
* We don't need to change the proposed size, but we do need to implement
* this method. Otherwise the full screen window will be sized to the
@@ -188,7 +182,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
- Tk_UnmapWindow((Tk_Window) winPtr);
+ Tk_UnmapWindow((Tk_Window)winPtr);
}
}
@@ -200,7 +194,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
- TkGenWMDestroyEvent((Tk_Window) winPtr);
+ TkGenWMDestroyEvent((Tk_Window)winPtr);
}
/*
@@ -211,33 +205,45 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
return (winPtr ? NO : YES);
}
-#ifdef TK_MAC_DEBUG_NOTIFICATIONS
-
-- (void) windowDragStart: (NSNotification *) notification
+- (void) windowBecameVisible: (NSNotification *) notification
{
- TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
-}
+ NSWindow *window = [notification object];
+ TkWindow *winPtr = TkMacOSXGetTkWindow(window);
+ if (winPtr) {
+ TKContentView *view = [window contentView];
-- (void) windowLiveResize: (NSNotification *) notification
-{
- TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
- //BOOL start = [[notification name] isEqualToString:NSWindowWillStartLiveResizeNotification];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
+ if (@available(macOS 10.15, *)) {
+ [view viewDidChangeEffectiveAppearance];
+ }
+#endif
+ [view addTkDirtyRect:[view bounds]];
+ Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL);
+ Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL);
+ }
}
- (void) windowMapped: (NSNotification *) notification
{
- TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
NSWindow *w = [notification object];
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
- //Tk_MapWindow((Tk_Window) winPtr);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
}
}
-- (void) windowBecameVisible: (NSNotification *) notification
+#ifdef TK_MAC_DEBUG_NOTIFICATIONS
+
+- (void) windowDragStart: (NSNotification *) notification
+{
+ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+}
+
+- (void) windowLiveResize: (NSNotification *) notification
{
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+ //BOOL start = [[notification name] isEqualToString:NSWindowWillStartLiveResizeNotification];
}
- (void) windowUnmapped: (NSNotification *) notification
@@ -247,7 +253,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
if (winPtr) {
- //Tk_UnmapWindow((Tk_Window) winPtr);
+ //Tk_UnmapWindow((Tk_Window)winPtr);
}
}
@@ -266,6 +272,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
observe(NSWindowDidResizeNotification, windowBoundsChanged:);
observe(NSWindowDidDeminiaturizeNotification, windowExpanded:);
observe(NSWindowDidMiniaturizeNotification, windowCollapsed:);
+ observe(NSWindowWillOrderOnScreenNotification, windowMapped:);
+ observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:);
#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070)
observe(NSWindowDidEnterFullScreenNotification, windowEnteredFullScreen:);
@@ -276,8 +284,6 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
observe(NSWindowWillMoveNotification, windowDragStart:);
observe(NSWindowWillStartLiveResizeNotification, windowLiveResize:);
observe(NSWindowDidEndLiveResizeNotification, windowLiveResize:);
- observe(NSWindowWillOrderOnScreenNotification, windowMapped:);
- observe(NSWindowDidOrderOnScreenNotification, windowBecameVisible:);
observe(NSWindowDidOrderOffScreenNotification, windowUnmapped:);
#endif
#undef observe
@@ -394,26 +400,53 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
/*
*----------------------------------------------------------------------
*
- * TkpAppIsDrawing --
+ * TkpWillDrawWidget --
*
* A widget display procedure can call this to determine whether it is
- * being run inside of the drawRect method. This is needed for some tests,
- * especially of the Text widget, which record data in a global Tcl
- * variable and assume that display procedures will be run in a
- * predictable sequence as Tcl idle tasks.
+ * being run inside of the drawRect method. If not, it may be desirable
+ * for the display procedure to simply clear the REDRAW_PENDING flag
+ * and return. The widget can be recorded in order to schedule a
+ * redraw, via and Expose event, from within drawRect.
+ *
+ * This is also needed for some tests, especially of the Text widget,
+ * which record data in a global Tcl variable and assume that display
+ * procedures will be run in a predictable sequence as Tcl idle tasks.
*
* Results:
- * True only while running the drawRect method of a TKContentView;
+ * True if called from the drawRect method of a TKContentView with
+ * tkwin NULL or pointing to a widget in the current focusView.
*
* Side effects:
- * None
+ * Currently none. One day the tkwin parameter may be recorded to
+ * handle redrawing the widget later.
*
*----------------------------------------------------------------------
*/
-MODULE_SCOPE Bool
-TkpAppIsDrawing(void) {
- return [NSApp isDrawing];
+int
+TkpWillDrawWidget(Tk_Window tkwin) {
+ int result;
+ if (tkwin) {
+ TkWindow *winPtr = (TkWindow *)tkwin;
+ TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(
+ (Drawable)winPtr->privatePtr);
+ result = ([NSApp isDrawing] && view == [NSView focusView]);
+#if 0
+ printf("TkpWillDrawWidget: %s %d %d \n", Tk_PathName(tkwin),
+ [NSApp isDrawing], (view == [NSView focusView]));
+ if (!result) {
+ NSRect dirtyRect;
+ TkMacOSXWinNSBounds(winPtr, view, &dirtyRect);
+ printf("TkpAppCanDraw: dirtyRect for %s is %s\n",
+ Tk_PathName(tkwin),
+ NSStringFromRect(dirtyRect).UTF8String);
+ [view addTkDirtyRect:dirtyRect];
+ }
+#endif
+ } else {
+ result = [NSApp isDrawing];
+ }
+ return result;
}
/*
@@ -421,55 +454,39 @@ TkpAppIsDrawing(void) {
*
* GenerateUpdates --
*
- * Given a Macintosh update region and a Tk window this function geneates
+ * Given an update rectangle and a Tk window, this function generates
* an X Expose event for the window if it meets the update region. The
- * function will then recursivly have each damaged window generate Expose
+ * function will then recursively 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.
+ * Additional events may be placed on the Tk event queue.
*
*----------------------------------------------------------------------
*/
static int
GenerateUpdates(
- HIShapeRef updateRgn,
CGRect *updateBounds,
TkWindow *winPtr)
{
TkWindow *childPtr;
XEvent event;
CGRect bounds, damageBounds;
- HIShapeRef boundsRgn, damageRgn;
TkMacOSXWinCGBounds(winPtr, &bounds);
if (!CGRectIntersectsRect(bounds, *updateBounds)) {
return 0;
}
- if (!HIShapeIntersectsRect(updateRgn, &bounds)) {
- return 0;
- }
/*
- * Compute the bounding box of the area that the damage occured in.
+ * Compute the bounding box of the area that the damage occurred in.
*/
- boundsRgn = HIShapeCreateWithRect(&bounds);
- damageRgn = HIShapeCreateIntersection(updateRgn, boundsRgn);
- if (HIShapeIsEmpty(damageRgn)) {
- CFRelease(damageRgn);
- CFRelease(boundsRgn);
- return 0;
- }
- HIShapeGetBounds(damageRgn, &damageBounds);
-
- CFRelease(damageRgn);
- CFRelease(boundsRgn);
-
+ damageBounds = CGRectIntersection(bounds, *updateBounds);
event.xany.serial = LastKnownRequestProcessed(Tk_Display(winPtr));
event.xany.send_event = false;
event.xany.window = Tk_WindowId(winPtr);
@@ -483,7 +500,7 @@ GenerateUpdates(
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
#ifdef TK_MAC_DEBUG_DRAWING
- TKLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
+ TKLog(@"Exposed %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
event.xexpose.y, event.xexpose.width, event.xexpose.height);
#endif
@@ -496,7 +513,7 @@ GenerateUpdates(
if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) {
continue;
}
- GenerateUpdates(updateRgn, updateBounds, childPtr);
+ GenerateUpdates(updateBounds, childPtr);
}
/*
@@ -506,7 +523,7 @@ GenerateUpdates(
if (Tk_IsContainer(winPtr)) {
childPtr = TkpGetOtherWindow(winPtr);
if (childPtr != NULL && Tk_IsMapped(childPtr)) {
- GenerateUpdates(updateRgn, updateBounds, childPtr);
+ GenerateUpdates(updateBounds, childPtr);
}
/*
@@ -520,58 +537,6 @@ GenerateUpdates(
/*
*----------------------------------------------------------------------
*
- * 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(
- TkWindow *winPtr,
- int activeFlag)
-{
- TkGenerateActivateEvents(winPtr, activeFlag);
- if (activeFlag || ![NSApp isActive]) {
- TkMacOSXGenerateFocusEvent(winPtr, activeFlag);
- }
- return true;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * DoWindowActivate --
- *
- * Idle handler that calls GenerateActivateEvents().
- *
- * Results:
- * None.
- *
- * Side effects:
- * Additional events may be place on the Tk event queue.
- *
- *----------------------------------------------------------------------
- */
-
-void
-DoWindowActivate(
- ClientData clientData)
-{
- GenerateActivateEvents(clientData, 1);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkMacOSXGenerateFocusEvent --
*
* Given a Macintosh window activate event this function generates all
@@ -581,12 +546,12 @@ DoWindowActivate(
* True if event(s) are generated - false otherwise.
*
* Side effects:
- * Additional events may be place on the Tk event queue.
+ * Additional events may be placed on the Tk event queue.
*
*----------------------------------------------------------------------
*/
-MODULE_SCOPE int
+static int
TkMacOSXGenerateFocusEvent(
TkWindow *winPtr, /* Root X window for event. */
int activeFlag)
@@ -628,6 +593,35 @@ TkMacOSXGenerateFocusEvent(
/*
*----------------------------------------------------------------------
*
+ * 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 placed on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+GenerateActivateEvents(
+ TkWindow *winPtr,
+ int activeFlag)
+{
+ TkGenerateActivateEvents(winPtr, activeFlag);
+ if (activeFlag || ![NSApp isActive]) {
+ TkMacOSXGenerateFocusEvent(winPtr, activeFlag);
+ }
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkGenWMConfigureEvent --
*
* Generate a ConfigureNotify event for Tk. Depending on the value of flag
@@ -739,7 +733,7 @@ TkGenWMConfigureEvent(
/*
* Now set up the changes structure. Under X we wait for the
- * ConfigureNotify to set these values. On the Mac we know imediatly that
+ * ConfigureNotify to set these values. On the Mac we know immediately 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.
@@ -830,7 +824,7 @@ TkWmProtocolEventProc(
if (result != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (command for \"%s\" window manager protocol)",
- Tk_GetAtomName((Tk_Window) winPtr, protocol)));
+ Tk_GetAtomName((Tk_Window)winPtr, protocol)));
Tcl_BackgroundException(interp, result);
}
Tcl_Release(interp);
@@ -844,8 +838,8 @@ TkWmProtocolEventProc(
* message then just destroy the window.
*/
- if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
- Tk_DestroyWindow((Tk_Window) winPtr);
+ if (protocol == Tk_InternAtom((Tk_Window)winPtr, "WM_DELETE_WINDOW")) {
+ Tk_DestroyWindow((Tk_Window)winPtr);
}
}
@@ -919,43 +913,32 @@ ConfigureRestrictProc(
return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT);
}
-/*
- * If a window gets mapped inside the drawRect method, this will be run as an
- * idle task, after drawRect returns, to clean up the mess.
- */
+@implementation TKContentView(TKWindowEvent)
-static void
-RedisplayView(
- ClientData clientdata)
+- (void) addTkDirtyRect: (NSRect) rect
{
- NSView *view = (NSView *) clientdata;
-
- /*
- * Make sure that we are not trying to displaying a view that no longer
- * exists. Must call [NSApp windows] because [NSApp orderedWindows] excludes
- * floating/utility windows and other window panels.
- */
-
- for (NSWindow *w in [NSApp windows]) {
- if ([w contentView] == view) {
- [view setNeedsDisplay:YES];
- break;
- }
- }
+ _tkNeedsDisplay = YES;
+ _tkDirtyRect = NSUnionRect(_tkDirtyRect, rect);
+ [NSApp setNeedsToDraw:YES];
}
-@implementation TKContentView(TKWindowEvent)
+- (void) clearTkDirtyRect
+{
+ _tkNeedsDisplay = NO;
+ _tkDirtyRect = NSZeroRect;
+ [NSApp setNeedsToDraw:NO];
+}
- (void) drawRect: (NSRect) rect
{
- const NSRect *rectsBeingDrawn;
- NSInteger rectsBeingDrawnCount;
(void)rect;
#ifdef TK_MAC_DEBUG_DRAWING
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- if (winPtr) fprintf(stderr, "drawRect: drawing %s\n",
- Tk_PathName(winPtr));
+ if (winPtr) {
+ fprintf(stderr, "drawRect: drawing %s in %s\n",
+ Tk_PathName(winPtr), NSStringFromRect(rect).UTF8String);
+ }
#endif
/*
@@ -964,37 +947,16 @@ RedisplayView(
*/
if ([NSApp isDrawing]) {
- if ([NSApp macMinorVersion] > 13) {
+ if ([NSApp macOSVersion] > 101300) {
TKLog(@"WARNING: a recursive call to drawRect was aborted.");
}
return;
}
[NSApp setIsDrawing: YES];
-
- [self getRectsBeingDrawn:&rectsBeingDrawn count:&rectsBeingDrawnCount];
- CGFloat height = [self bounds].size.height;
- HIMutableShapeRef drawShape = HIShapeCreateMutable();
-
- while (rectsBeingDrawnCount--) {
- CGRect r = NSRectToCGRect(*rectsBeingDrawn++);
-
-#ifdef TK_MAC_DEBUG_DRAWING
- fprintf(stderr, "drawRect: %dx%d@(%d,%d)\n", (int)r.size.width,
- (int)r.size.height, (int)r.origin.x, (int)r.origin.y);
-#endif
-
- r.origin.y = height - (r.origin.y + r.size.height);
- HIShapeUnionWithRect(drawShape, &r);
- }
- [self generateExposeEvents:(HIShapeRef)drawShape];
- CFRelease(drawShape);
- [NSApp setIsDrawing: NO];
-
- if ([self needsRedisplay]) {
- [self setNeedsRedisplay:NO];
- Tcl_DoWhenIdle(RedisplayView, self);
- }
+ [self clearTkDirtyRect];
+ [self generateExposeEvents:rect];
+ [NSApp setIsDrawing:NO];
#ifdef TK_MAC_DEBUG_DRAWING
fprintf(stderr, "drawRect: done.\n");
@@ -1006,7 +968,7 @@ RedisplayView(
[super setFrameSize: newsize];
NSWindow *w = [self window];
TkWindow *winPtr = TkMacOSXGetTkWindow(w);
- Tk_Window tkwin = (Tk_Window) winPtr;
+ Tk_Window tkwin = (Tk_Window)winPtr;
if (![self inLiveResize] &&
[w respondsToSelector: @selector (tkLayoutChanged)]) {
@@ -1051,13 +1013,14 @@ RedisplayView(
TkMacOSXUpdateClipRgn(winPtr);
/*
- * Generate and process expose events to redraw the window.
+ * Generate and process expose events to redraw the window. To avoid
+ * crashes, only do this if we are being called from drawRect. See
+ * ticket [1fa8c3ed8d].
*/
- HIRect bounds = NSRectToCGRect([self bounds]);
- HIShapeRef shape = HIShapeCreateWithRect(&bounds);
- [self generateExposeEvents: shape];
- [w displayIfNeeded];
+ if([NSApp isDrawing] || [self inLiveResize]) {
+ [self generateExposeEvents: [self bounds]];
+ }
/*
* Finally, unlock the main autoreleasePool.
@@ -1074,11 +1037,11 @@ RedisplayView(
* pending idle events are processed so the drawing will actually take place.
*/
-- (void) generateExposeEvents: (HIShapeRef) shape
+- (void) generateExposeEvents: (NSRect) rect
{
unsigned long serial;
- CGRect updateBounds;
int updatesNeeded;
+ CGRect updateBounds;
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
ClientData oldArg;
Tk_RestrictProc *oldProc;
@@ -1087,26 +1050,25 @@ RedisplayView(
}
/*
- * Generate Tk Expose events.
+ * Generate Tk Expose events. All of these events will share the same
+ * serial number.
*/
- HIShapeGetBounds(shape, &updateBounds);
-
- /*
- * All of these events will share the same serial number.
- */
-
- serial = LastKnownRequestProcessed(Tk_Display(winPtr));
- updatesNeeded = GenerateUpdates(shape, &updateBounds, winPtr);
-
+ updateBounds = NSRectToCGRect(rect);
+ updateBounds.origin.y = ([self bounds].size.height - updateBounds.origin.y
+ - updateBounds.size.height);
+ updatesNeeded = GenerateUpdates(&updateBounds, winPtr);
if (updatesNeeded) {
+ serial = LastKnownRequestProcessed(Tk_Display(winPtr));
+
/*
- * First process all of the Expose events.
+ * Use the ExposeRestrictProc to process only the expose events. This
+ * will create idle drawing tasks, which we handle before we return.
*/
oldProc = Tk_RestrictEvents(ExposeRestrictProc, UINT2PTR(serial), &oldArg);
- while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {};
+ while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {};
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
/*
@@ -1118,51 +1080,104 @@ RedisplayView(
* effect.)
*
* Fortunately, Tk schedules all drawing to be done while Tcl is idle.
- * So we can do the drawing by processing all of the idle events that
- * were created when the expose events were processed.
+ * So to run any display procs which were scheduled by the expose
+ * events we process all idle events before returning.
*/
+
while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
}
}
/*
- * This method is called when a user changes between light and dark mode. The
- * implementation here generates a Tk virtual event which can be bound to a
- * function that redraws the window in an appropriate style.
+ * In macOS 10.14 and later this method is called when a user changes between
+ * light and dark mode or changes the accent color. The implementation
+ * generates two virtual events. The first is either <<LightAqua>> or
+ * <<DarkAqua>>, depending on the view's current effective appearance. The
+ * second is <<AppearnceChanged>> and has a data string describing the
+ * effective appearance of the view and the current accent and highlight
+ * colors.
*/
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+
+static const char *const accentNames[] = {
+ "Graphite",
+ "Red",
+ "Orange",
+ "Yellow",
+ "Green",
+ "Blue",
+ "Purple",
+ "Pink"
+};
+
- (void) viewDidChangeEffectiveAppearance
{
- XVirtualEvent event;
- int x, y;
- NSWindow *w = [self window];
- TkWindow *winPtr = TkMacOSXGetTkWindow(w);
- Tk_Window tkwin = (Tk_Window) winPtr;
+ Tk_Window tkwin = (Tk_Window)TkMacOSXGetTkWindow([self window]);
+ if (!tkwin) {
+ return;
+ }
+ NSAppearanceName effectiveAppearanceName = [[self effectiveAppearance] name];
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+ static const char *defaultColor = NULL;
+
+ if (effectiveAppearanceName == NSAppearanceNameAqua) {
+ Tk_SendVirtualEvent(tkwin, "LightAqua", NULL);
+ } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) {
+ Tk_SendVirtualEvent(tkwin, "DarkAqua", NULL);
+ }
+ if ([NSApp macOSVersion] < 101500) {
+
+ /*
+ * Mojave cannot handle the KVO shenanigans that we need for the
+ * highlight and accent color notifications.
+ */
- if (!winPtr) {
return;
}
- bzero(&event, sizeof(XVirtualEvent));
- event.type = VirtualEvent;
- event.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
- 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, winPtr->window, 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;
- if (TkMacOSXInDarkMode(tkwin)) {
- event.name = Tk_GetUid("DarkAqua");
- } else {
- event.name = Tk_GetUid("LightAqua");
+ if (!defaultColor) {
+ defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor";
+ preferences = [[NSUserDefaults standardUserDefaults] retain];
+
+ /*
+ * AppKit calls this method when the user changes the Accent Color
+ * but not when the user changes the Highlight Color. So we register
+ * to receive KVO notifications for Highlight Color as well.
+ */
+
+ [preferences addObserver:self
+ forKeyPath:@"AppleHighlightColor"
+ options:NSKeyValueObservingOptionNew
+ context:NULL];
}
- Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
+ NSString *accent = [preferences stringForKey:@"AppleAccentColor"];
+ NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"]
+ componentsSeparatedByString: @" "];
+ NSString *highlight = [words count] > 3 ? [words objectAtIndex:3] : nil;
+ const char *accentName = accent ? accentNames[1 + accent.intValue] : defaultColor;
+ const char *highlightName = highlight ? highlight.UTF8String: defaultColor;
+ char data[256];
+ snprintf(data, 256, "Appearance %s Accent %s Highlight %s",
+ effectiveAppearanceName.UTF8String, accentName,
+ highlightName);
+ Tk_SendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1));
}
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary *)change
+ context:(void *)context
+{
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+ if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) {
+ if (@available(macOS 10.14, *)) {
+ [self viewDidChangeEffectiveAppearance];
+ }
+ }
+}
+
+#endif
+
/*
* This is no-op on 10.7 and up because Apple has removed this widget, but we
* are leaving it here for backwards compatibility.
@@ -1176,7 +1191,7 @@ RedisplayView(
XVirtualEvent event;
int x, y;
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- Tk_Window tkwin = (Tk_Window) winPtr;
+ Tk_Window tkwin = (Tk_Window)winPtr;
(void)sender;
if (!winPtr){
@@ -1199,12 +1214,10 @@ RedisplayView(
Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
}
-- (BOOL) isOpaque
-{
- NSWindow *w = [self window];
- return (w && (([w styleMask] & NSTexturedBackgroundWindowMask) ||
- ![w isOpaque]) ? NO : YES);
-}
+/*
+ * On Catalina this is never called and drawRect clips to the rect that
+ * is passed to it by AppKit.
+ */
- (BOOL) wantsDefaultClipping
{
@@ -1223,7 +1236,8 @@ RedisplayView(
- (void) keyDown: (NSEvent *) theEvent
{
- (void)theEvent;
+ (void)theEvent;
+
#ifdef TK_MAC_DEBUG_EVENTS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
#endif
@@ -1231,7 +1245,7 @@ RedisplayView(
/*
* When the services menu is opened this is called for each Responder in
- * the Responder chain until a service provider is found. The TkContentView
+ * the Responder chain until a service provider is found. The TKContentView
* should be the first (and generally only) Responder in the chain. We
* return the TkServices object that was created in TkpInit.
*/
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index f24b8d4..77da97d 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -183,7 +183,7 @@ static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
/*
@@ -193,13 +193,6 @@ static const Tk_GeomMgr wmMgrType = {
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:
*/
@@ -320,7 +313,7 @@ static int WmWinAppearance(Tcl_Interp *interp, TkWindow *winPtr,
static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr,
NSWindow *macWindow, UInt64 oldAttributes,
int oldFlags, int create, int initial);
-static void ApplyMasterOverrideChanges(TkWindow *winPtr,
+static void ApplyContainerOverrideChanges(TkWindow *winPtr,
NSWindow *macWindow);
static void GetMinSize(TkWindow *winPtr, int *minWidthPtr,
int *minHeightPtr);
@@ -360,11 +353,21 @@ static void RemoveTransient(TkWindow *winPtr);
#pragma mark -
-#pragma mark TKWindow(TKWm)
+@implementation TKPanel: NSPanel
+@synthesize tkWindow = _tkWindow;
+@end
+
+@implementation TKDrawerWindow: NSWindow
+@synthesize tkWindow = _tkWindow;
+@end
@implementation TKWindow: NSWindow
+@synthesize mouseInResizeArea = _mouseInResizeArea;
+@synthesize tkWindow = _tkWindow;
@end
+#pragma mark TKWindow(TKWm)
+
@implementation TKWindow(TKWm)
/*
@@ -523,7 +526,7 @@ static void
SetWindowSizeLimits(
TkWindow *winPtr)
{
- NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
WmInfo *wmPtr = winPtr->wmInfoPtr;
int minWidth, minHeight, maxWidth, maxHeight, base;
@@ -671,7 +674,7 @@ TkWmNewWindow(
wmPtr->reparent = None;
wmPtr->titleUid = NULL;
wmPtr->iconName = NULL;
- wmPtr->master = NULL;
+ wmPtr->container = NULL;
wmPtr->hints.flags = InputHint | StateHint;
wmPtr->hints.input = True;
wmPtr->hints.initial_state = NormalState;
@@ -729,7 +732,7 @@ TkWmNewWindow(
* detect size and position changes caused by window managers.
*/
- Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
+ Tk_CreateEventHandler((Tk_Window)winPtr, StructureNotifyMask,
TopLevelEventProc, winPtr);
/*
@@ -737,7 +740,75 @@ TkWmNewWindow(
* window manager.
*/
- Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
+ Tk_ManageGeometry((Tk_Window)winPtr, &wmMgrType, NULL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXHandleMapOrUnmap --
+ *
+ * The mechanism used by a geometry manager to propogate the information
+ * about which of its content widgets are mapped is to call Tk_MapWindow
+ * or Tk_UnmapNotify. Those functions generate MapNotify or UnmapNotify
+ * events and then handle them immediately. Other platforms use
+ * Tk_HandleEvent to do this. But that does not work correctly on macOS
+ * due to the fact that the calls to Tk_MapNotify or Tk_UnmapNotify can
+ * occur in display procedures which are being run in the drawRect method
+ * of a TKContentView. The events will be processed after drawRect
+ * returns, but they need to be processed immediately in some cases.
+
+ * This function operates as a macOS alternative to Tk_HandleEvent, for
+ * processing MapNotify or UnmapNotify events only. It is called by
+ * Tk_MapWindow, Tk_UnmapWindow, TkWmMapWindow and TkWmUnmapWindow.
+ * Rather than using Tk_HandleEvent it installs a filter which restricts
+ * to the MapNotify or UnmapNotify events, it queues the event and then
+ * processes window events with the filter installed. This allows the
+ * event to be handled immediately even from within the drawRect method.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Handles a MapNotify or UnMapNotify event.
+ *
+ *----------------------------------------------------------------------
+ */
+static Tk_RestrictAction
+MapUnmapRestrictProc(
+ TCL_UNUSED(void*),
+ XEvent *eventPtr)
+{
+ return (eventPtr->type==MapNotify || eventPtr->type==UnmapNotify ?
+ TK_PROCESS_EVENT : TK_DEFER_EVENT);
+}
+
+MODULE_SCOPE
+void TkMacOSXHandleMapOrUnmap(
+ Tk_Window tkwin,
+ XEvent *event)
+{
+ ClientData oldArg;
+ Tk_RestrictProc *oldProc;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ const Tk_GeomMgr *geomMgrPtr = winPtr->geomMgrPtr;
+
+ /*
+ * Sadly, this approach does not work with the "text" geometry manager.
+ * The mysterious unexplained crash elicited by textDisp-5.2 occurs. So we
+ * have to check for the "text" manager and revert to using Tk_HandleEvent
+ * in that case. Hopefully this can be removed when the revised text
+ * widget is in place.
+ */
+
+ if (geomMgrPtr && strcmp(geomMgrPtr->name, "text") == 0) {
+ Tk_HandleEvent(event);
+ return;
+ }
+ oldProc = Tk_RestrictEvents(MapUnmapRestrictProc, NULL, &oldArg);
+ Tk_QueueWindowEvent(event, TCL_QUEUE_TAIL);
+ while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
+ Tk_RestrictEvents(oldProc, oldArg, &oldArg);
}
/*
@@ -769,6 +840,8 @@ TkWmMapWindow(
* mapped. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
+ XEvent event;
+
if (wmPtr->flags & WM_NEVER_MAPPED) {
/*
* Create the underlying Mac window for this Tk window.
@@ -784,7 +857,7 @@ TkWmMapWindow(
* Generate configure event when we first map the window.
*/
- TkGenWMConfigureEvent((Tk_Window) winPtr, wmPtr->x, wmPtr->y, -1, -1,
+ TkGenWMConfigureEvent((Tk_Window)winPtr, wmPtr->x, wmPtr->y, -1, -1,
TK_LOCATION_CHANGED);
/*
@@ -832,10 +905,19 @@ TkWmMapWindow(
wmPtr->flags &= ~WM_ABOUT_TO_MAP;
/*
- * Map the window.
+ * Map the window and process a MapNotify event for it.
*/
+ winPtr->flags |= TK_MAPPED;
XMapWindow(winPtr->display, winPtr->window);
+ event.xany.serial = LastKnownRequestProcessed(winPtr->display);
+ event.xany.send_event = False;
+ event.xany.display = winPtr->display;
+ event.xmap.window = winPtr->window;
+ event.xmap.type = MapNotify;
+ event.xmap.event = winPtr->window;
+ event.xmap.override_redirect = winPtr->atts.override_redirect;
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
/*
@@ -860,7 +942,18 @@ TkWmUnmapWindow(
TkWindow *winPtr) /* Top-level window that's about to be
* unmapped. */
{
+ XEvent event;
+
+ event.xany.serial = LastKnownRequestProcessed(winPtr->display);
+ event.xany.send_event = False;
+ event.xany.display = winPtr->display;
+ event.xunmap.type = UnmapNotify;
+ event.xunmap.window = winPtr->window;
+ event.xunmap.event = winPtr->window;
+ event.xunmap.from_configure = false;
+ winPtr->flags &= ~TK_MAPPED;
XUnmapWindow(winPtr->display, winPtr->window);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
/*
@@ -885,19 +978,19 @@ TkWmDeadWindow(
TkWindow *winPtr) /* Top-level window that's being deleted. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2;
- NSWindow *ourNSWindow;
+ TKWindow *deadNSWindow;
if (wmPtr == NULL) {
return;
}
/*
- *If the dead window is a transient, remove it from the master's list.
+ *If the dead window is a transient, remove it from the container's list.
*/
RemoveTransient(winPtr);
- Tk_ManageGeometry((Tk_Window) winPtr, NULL, NULL);
- Tk_DeleteEventHandler((Tk_Window) winPtr, StructureNotifyMask,
+ Tk_ManageGeometry((Tk_Window)winPtr, NULL, NULL);
+ Tk_DeleteEventHandler((Tk_Window)winPtr, StructureNotifyMask,
TopLevelEventProc, winPtr);
if (wmPtr->hints.flags & IconPixmapHint) {
Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
@@ -912,11 +1005,11 @@ TkWmDeadWindow(
ckfree(wmPtr->leaderName);
}
if (wmPtr->icon != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+ wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr;
wmPtr2->iconFor = NULL;
}
if (wmPtr->iconFor != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr;
+ wmPtr2 = ((TkWindow *)wmPtr->iconFor)->wmInfoPtr;
wmPtr2->icon = NULL;
wmPtr2->hints.flags &= ~IconWindowHint;
}
@@ -943,11 +1036,11 @@ TkWmDeadWindow(
for (Transient *transientPtr = wmPtr->transientPtr;
transientPtr != NULL; transientPtr = transientPtr->nextPtr) {
TkWindow *winPtr2 = transientPtr->winPtr;
- TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2);
+ TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2);
- if (masterPtr == winPtr) {
+ if (containerPtr == winPtr) {
wmPtr2 = winPtr2->wmInfoPtr;
- wmPtr2->master = NULL;
+ wmPtr2->container = NULL;
}
}
@@ -964,27 +1057,27 @@ TkWmDeadWindow(
* the parent. Then close and release the NSWindow.
*/
- ourNSWindow = wmPtr->window;
- if (ourNSWindow && !Tk_IsEmbedded(winPtr)) {
- NSWindow *parent = [ourNSWindow parentWindow];
- TkMacOSXUnregisterMacWindow(ourNSWindow);
+ deadNSWindow = (TKWindow *)wmPtr->window;
+ if (deadNSWindow && !Tk_IsEmbedded(winPtr)) {
+ NSWindow *parent = [deadNSWindow parentWindow];
+ [deadNSWindow setTkWindow:None];
if (winPtr->window) {
- ((MacDrawable *) winPtr->window)->view = nil;
+ ((MacDrawable *)winPtr->window)->view = nil;
}
wmPtr->window = NULL;
if (parent) {
- [parent removeChildWindow:ourNSWindow];
+ [parent removeChildWindow:deadNSWindow];
}
#if DEBUG_ZOMBIES > 1
{
- const char *title = [[ourNSWindow title] UTF8String];
+ const char *title = [[deadNSWindow title] UTF8String];
if (title == nil) {
title = "unnamed window";
}
fprintf(stderr, ">>>> Closing <%s>. Count is: %lu\n", title,
- [ourNSWindow retainCount]);
+ [deadNSWindow retainCount]);
}
#endif
@@ -1011,7 +1104,7 @@ TkWmDeadWindow(
wmPtr2 = winPtr2->wmInfoPtr;
isOnScreen = (wmPtr2->hints.initial_state != IconicState &&
wmPtr2->hints.initial_state != WithdrawnState);
- if (w != ourNSWindow && isOnScreen && [w canBecomeKeyWindow]) {
+ if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) {
[w makeKeyAndOrderFront:NSApp];
break;
}
@@ -1021,12 +1114,12 @@ TkWmDeadWindow(
* Prevent zombies on systems with a TouchBar.
*/
- if (ourNSWindow == [NSApp keyWindow]) {
+ if (deadNSWindow == [NSApp keyWindow]) {
[NSApp _setKeyWindow:nil];
[NSApp _setMainWindow:nil];
}
- [ourNSWindow close];
- [ourNSWindow release];
+ [deadNSWindow close];
+ [deadNSWindow release];
[NSApp _resetAutoreleasePool];
#if DEBUG_ZOMBIES > 1
@@ -1094,7 +1187,7 @@ Tk_WmObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
static const char *const optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
"command", "deiconify", "focusmodel", "forget",
@@ -1433,7 +1526,7 @@ WmSetAttribute(
oldFlags, 1, 0);
[macWindow setBackgroundColor:boolean ? [NSColor clearColor] : nil];
[macWindow setOpaque:!boolean];
- TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
+ TkMacOSXInvalidateWindow((MacDrawable *)winPtr->window,
TK_PARENT_WINDOW);
}
break;
@@ -1529,12 +1622,12 @@ WmAttributesCmd(
NSWindow *macWindow;
if (winPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
+ Tk_MakeWindowExist((Tk_Window)winPtr);
}
if (!TkMacOSXHostToplevelExists(winPtr)) {
TkMacOSXMakeRealWindowExist(winPtr);
}
- macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (objc == 3) { /* wm attributes $win */
Tcl_Obj *result = Tcl_NewObj();
@@ -1663,7 +1756,7 @@ WmColormapwindowsCmd(
return TCL_ERROR;
}
if (objc == 3) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
+ Tk_MakeWindowExist((Tk_Window)winPtr);
resultObj = Tcl_NewObj();
for (i = 0; i < wmPtr->cmapCount; i++) {
if ((i == (wmPtr->cmapCount-1))
@@ -1671,7 +1764,7 @@ WmColormapwindowsCmd(
break;
}
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) wmPtr->cmapList[i]));
+ Tk_NewWindowObj((Tk_Window)wmPtr->cmapList[i]));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -1691,7 +1784,7 @@ WmColormapwindowsCmd(
gotToplevel = 1;
}
if (winPtr2->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr2);
+ Tk_MakeWindowExist((Tk_Window)winPtr2);
}
cmapList[i] = winPtr2;
}
@@ -1710,7 +1803,7 @@ WmColormapwindowsCmd(
wmPtr->cmapCount = windowObjc;
/*
- * On the Macintosh all of this is just an excercise in compatability as
+ * On the Macintosh all of this is just an excercise in compatibility as
* we don't support colormaps. If we did they would be installed here.
*/
@@ -1800,13 +1893,12 @@ WmDeiconifyCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
-
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't deiconify %s: it is an icon for %s",
@@ -1825,27 +1917,27 @@ WmDeiconifyCmd(
ZoomState : NormalState);
[win setExcludedFromWindowsMenu:NO];
TkMacOSXApplyWindowAttributes(winPtr, win);
- [win orderFront:nil];
+ [win orderFront:NSApp];
if (wmPtr->icon) {
Tk_UnmapWindow((Tk_Window)wmPtr->icon);
}
/*
* If this window has a transient, the transient must also be deiconified if
- * it was withdrawn by the master.
+ * it was withdrawn by the container.
*/
for (Transient *transientPtr = wmPtr->transientPtr;
transientPtr != NULL; transientPtr = transientPtr->nextPtr) {
TkWindow *winPtr2 = transientPtr->winPtr;
WmInfo *wmPtr2 = winPtr2->wmInfoPtr;
- TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2);
+ TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2);
- if (masterPtr == winPtr) {
+ if (containerPtr == winPtr) {
if ((wmPtr2->hints.initial_state == WithdrawnState) &&
- ((transientPtr->flags & WITHDRAWN_BY_MASTER) != 0)) {
+ ((transientPtr->flags & WITHDRAWN_BY_CONTAINER) != 0)) {
TkpWmSetState(winPtr2, NormalState);
- transientPtr->flags &= ~WITHDRAWN_BY_MASTER;
+ transientPtr->flags &= ~WITHDRAWN_BY_CONTAINER;
}
}
}
@@ -1932,7 +2024,7 @@ WmForgetCmd(
TCL_UNUSED(int), /* Number of arguments. */
TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
- Tk_Window frameWin = (Tk_Window) winPtr;
+ Tk_Window frameWin = (Tk_Window)winPtr;
if (Tk_IsTopLevel(frameWin)) {
MacDrawable *macWin;
@@ -1940,7 +2032,7 @@ WmForgetCmd(
Tk_MakeWindowExist(frameWin);
Tk_MakeWindowExist((Tk_Window)winPtr->parentPtr);
- macWin = (MacDrawable *) winPtr->window;
+ macWin = (MacDrawable *)winPtr->window;
TkFocusJoin(winPtr);
Tk_UnmapWindow(frameWin);
@@ -1951,7 +2043,7 @@ WmForgetCmd(
macWin->flags &= ~TK_HOST_EXISTS;
TkWmDeadWindow(winPtr);
- RemapWindows(winPtr, (MacDrawable *) winPtr->parentPtr->window);
+ RemapWindows(winPtr, (MacDrawable *)winPtr->parentPtr->window);
/*
* Make sure wm no longer manages this window
@@ -2008,7 +2100,7 @@ WmFrameCmd(
}
window = wmPtr->reparent;
if (window == None) {
- window = Tk_WindowId((Tk_Window) winPtr);
+ window = Tk_WindowId((Tk_Window)winPtr);
}
sprintf(buf, "0x%" TCL_Z_MODIFIER "x", (size_t)window);
Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
@@ -2041,7 +2133,7 @@ WmGeometryCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
char xSign = '+', ySign = '+';
int width, height, x = wmPtr->x, y= wmPtr->y;
char *argv3;
@@ -2167,7 +2259,7 @@ WmGridCmd(
errorMsg = "heightInc can't be <= 0";
goto error;
}
- Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
+ Tk_SetGrid((Tk_Window)winPtr, reqWidth, reqHeight, widthInc,
heightInc);
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
@@ -2288,12 +2380,12 @@ WmIconbitmapCmd(
}
str = Tcl_GetStringFromObj(objv[3], &len);
if (winPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
+ Tk_MakeWindowExist((Tk_Window)winPtr);
}
if (!TkMacOSXHostToplevelExists(winPtr)) {
TkMacOSXMakeRealWindowExist(winPtr);
}
- if (WmSetAttribute(winPtr, TkMacOSXDrawableWindow(winPtr->window), interp,
+ if (WmSetAttribute(winPtr, TkMacOSXGetNSWindowForDrawable(winPtr->window), interp,
WMATT_TITLEPATH, objv[3]) == TCL_OK) {
if (!len) {
if (wmPtr->hints.icon_pixmap != None) {
@@ -2303,7 +2395,7 @@ WmIconbitmapCmd(
wmPtr->hints.flags &= ~IconPixmapHint;
}
} else {
- pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, Tk_GetUid(str));
+ pixmap = Tk_GetBitmap(interp, (Tk_Window)winPtr, Tk_GetUid(str));
if (pixmap == None) {
return TCL_ERROR;
}
@@ -2344,27 +2436,27 @@ WmIconifyCmd(
return TCL_ERROR;
}
- if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": override-redirect flag is set",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT",
NULL);
return TCL_ERROR;
- } else if (wmPtr->master != NULL) {
+ } else if (wmPtr->container != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient", winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "TRANSIENT", NULL);
return TCL_ERROR;
} else if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
} else if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an embedded window",
+ "can't iconify \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -2377,17 +2469,17 @@ WmIconifyCmd(
/*
* If this window has a transient the transient must be withdrawn when
- * the master is iconified.
+ * the container is iconified.
*/
for (Transient *transientPtr = wmPtr->transientPtr;
transientPtr != NULL; transientPtr = transientPtr->nextPtr) {
TkWindow *winPtr2 = transientPtr->winPtr;
- TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2);
- if (masterPtr == winPtr &&
+ TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2);
+ if (containerPtr == winPtr &&
winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) {
TkpWmSetState(winPtr2, WithdrawnState);
- transientPtr->flags |= WITHDRAWN_BY_MASTER;
+ transientPtr->flags |= WITHDRAWN_BY_CONTAINER;
}
}
@@ -2582,7 +2674,7 @@ WmIconphotoCmd(
Tk_SizeOfImage(tk_icon, &width, &height);
if (width != 0 && height != 0) {
- newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon,
+ newIcon = TkMacOSXGetNSImageFromTkImage(winPtr->display, tk_icon,
width, height);
}
Tk_FreeImage(tk_icon);
@@ -2690,7 +2782,7 @@ WmIconwindowCmd(
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -2698,7 +2790,7 @@ WmIconwindowCmd(
if (*Tcl_GetString(objv[3]) == '\0') {
wmPtr->hints.flags &= ~IconWindowHint;
if (wmPtr->icon != NULL) {
- wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+ wmPtr2 = ((TkWindow *)wmPtr->icon)->wmInfoPtr;
wmPtr2->iconFor = NULL;
wmPtr2->hints.initial_state = WithdrawnState;
}
@@ -2715,7 +2807,7 @@ WmIconwindowCmd(
NULL);
return TCL_ERROR;
}
- wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
+ wmPtr2 = ((TkWindow *)tkwin2)->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s is already an icon for %s",
@@ -2726,7 +2818,7 @@ WmIconwindowCmd(
if (wmPtr->icon != NULL) {
TkWindow *oldIcon = (TkWindow *)wmPtr->icon;
WmInfo *wmPtr3 = oldIcon->wmInfoPtr;
- NSWindow *win = TkMacOSXDrawableWindow(oldIcon->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(oldIcon->window);
/*
* The old icon should be withdrawn.
@@ -2741,7 +2833,7 @@ WmIconwindowCmd(
wmPtr->hints.icon_window = Tk_WindowId(tkwin2);
wmPtr->hints.flags |= IconWindowHint;
wmPtr->icon = tkwin2;
- wmPtr2->iconFor = (Tk_Window) winPtr;
+ wmPtr2->iconFor = (Tk_Window)winPtr;
if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
/*
* If the window is in normal or zoomed state, the icon should be
@@ -2782,11 +2874,11 @@ WmManageCmd(
TCL_UNUSED(int), /* Number of arguments. */
TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
- Tk_Window frameWin = (Tk_Window) winPtr;
+ Tk_Window frameWin = (Tk_Window)winPtr;
WmInfo *wmPtr = winPtr->wmInfoPtr;
if (!Tk_IsTopLevel(frameWin)) {
- MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ MacDrawable *macWin = (MacDrawable *)winPtr->window;
if (!Tk_IsManageable(frameWin)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -2801,8 +2893,8 @@ WmManageCmd(
if (wmPtr == NULL) {
TkWmNewWindow(winPtr);
if (winPtr->window == None) {
- Tk_MakeWindowExist((Tk_Window) winPtr);
- macWin = (MacDrawable *) winPtr->window;
+ Tk_MakeWindowExist((Tk_Window)winPtr);
+ macWin = (MacDrawable *)winPtr->window;
}
}
wmPtr = winPtr->wmInfoPtr;
@@ -2956,7 +3048,7 @@ WmOverrideredirectCmd(
{
int flag;
XSetWindowAttributes atts;
- TKWindow *win = (TKWindow *)TkMacOSXDrawableWindow(winPtr->window);
+ TKWindow *win = (TKWindow *)TkMacOSXGetNSWindowForDrawable(winPtr->window);
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
@@ -2964,8 +3056,8 @@ WmOverrideredirectCmd(
}
if (objc == 3) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
- Tk_Attributes((Tk_Window) winPtr)->override_redirect != 0));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
+ Tk_Attributes((Tk_Window) winPtr)->override_redirect));
return TCL_OK;
}
@@ -2973,8 +3065,8 @@ WmOverrideredirectCmd(
return TCL_ERROR;
}
atts.override_redirect = flag ? True : False;
- Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts);
- ApplyMasterOverrideChanges(winPtr, win);
+ Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts);
+ ApplyContainerOverrideChanges(winPtr, win);
return TCL_OK;
}
@@ -3096,7 +3188,7 @@ WmProtocolCmd(
return TCL_OK;
}
- protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3]));
+ protocol = Tk_InternAtom((Tk_Window)winPtr, Tcl_GetString(objv[3]));
if (objc == 4) {
/*
* Return the command to handle a given protocol.
@@ -3336,7 +3428,7 @@ WmStackorderCmd(
resultObj = Tcl_NewObj();
for (windowPtr = windows; *windowPtr ; windowPtr++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) *windowPtr));
+ Tk_NewWindowObj((Tk_Window)*windowPtr));
}
Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
@@ -3456,14 +3548,14 @@ WmStateCmd(
if (objc == 4) {
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't change state of %s: it is an icon for %s",
+ "can't change state of \"%s\": it is an icon for \"%s\"",
Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't change state of %s: it is an embedded window",
+ "can't change state of \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -3485,7 +3577,7 @@ WmStateCmd(
break;
case OPT_ICONIC:
- if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ if (Tk_Attributes((Tk_Window)winPtr)->override_redirect) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": override-redirect flag is set",
winPtr->pathName));
@@ -3493,7 +3585,7 @@ WmStateCmd(
"OVERRIDE_REDIRECT", NULL);
return TCL_ERROR;
}
- if (wmPtr->master != NULL) {
+ if (wmPtr->container != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient",
winPtr->pathName));
@@ -3610,37 +3702,37 @@ WmTransientCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- Tk_Window master;
- TkWindow *masterPtr, *w;
+ Tk_Window container;
+ TkWindow *containerPtr, *w;
WmInfo *wmPtr2;
Transient *transient;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
- if (wmPtr->master != NULL) {
+ if (wmPtr->container != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(Tk_PathName(wmPtr->master), -1));
+ Tcl_NewStringObj(Tk_PathName(wmPtr->container), -1));
}
return TCL_OK;
}
if (*Tcl_GetString(objv[3]) == '\0') {
RemoveTransient(winPtr);
} else {
- if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = (TkWindow*) master;
- while (!Tk_TopWinHierarchy(masterPtr)) {
+ containerPtr = (TkWindow*) container;
+ while (!Tk_TopWinHierarchy(containerPtr)) {
/*
- * Ensure that the master window is actually a Tk toplevel.
+ * Ensure that the container window is actually a Tk toplevel.
*/
- masterPtr = masterPtr->parentPtr;
+ containerPtr = containerPtr->parentPtr;
}
- Tk_MakeWindowExist((Tk_Window)masterPtr);
+ Tk_MakeWindowExist((Tk_Window)containerPtr);
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -3650,7 +3742,7 @@ WmTransientCmd(
return TCL_ERROR;
}
- wmPtr2 = masterPtr->wmInfoPtr;
+ wmPtr2 = containerPtr->wmInfoPtr;
/*
* Under some circumstances, wmPtr2 is NULL here.
@@ -3658,25 +3750,25 @@ WmTransientCmd(
if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
}
- for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->master) {
+ for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
+ w = (TkWindow *)w->wmInfoPtr->container) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
- Tk_PathName(masterPtr)));
+ "can't set \"%s\" as container: would cause management loop",
+ Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
}
}
/*
- * Add the transient to the master's list, if it not already there.
+ * Add the transient to the container's list, if it not already there.
*/
for (transient = wmPtr2->transientPtr;
@@ -3691,19 +3783,19 @@ WmTransientCmd(
}
/*
- * If the master is withdrawn or iconic then withdraw the transient.
+ * If the container is withdrawn or iconic then withdraw the transient.
*/
if ((wmPtr2->hints.initial_state == WithdrawnState ||
wmPtr2->hints.initial_state == IconicState) &&
wmPtr->hints.initial_state != WithdrawnState) {
TkpWmSetState(winPtr, WithdrawnState);
- transient->flags |= WITHDRAWN_BY_MASTER;
+ transient->flags |= WITHDRAWN_BY_CONTAINER;
}
- wmPtr->master = (Tk_Window) masterPtr;
+ wmPtr->container = (Tk_Window)containerPtr;
}
- ApplyMasterOverrideChanges(winPtr, NULL);
+ ApplyContainerOverrideChanges(winPtr, NULL);
return TCL_OK;
}
@@ -3712,15 +3804,15 @@ WmTransientCmd(
*
* RemoveTransient --
*
- * Clears the transient's master record and removes the transient from the
- * master's list.
+ * Clears the transient's container record and removes the transient from the
+ * container's list.
*
* Results:
* None
*
* Side effects:
- * References to a master are removed from the transient's wmInfo
- * structure and references to the transient are removed from its master's
+ * References to a container are removed from the transient's wmInfo
+ * structure and references to the transient are removed from its container's
* wmInfo.
*
*----------------------------------------------------------------------
@@ -3731,18 +3823,18 @@ RemoveTransient(
TkWindow *winPtr)
{
WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2;
- TkWindow *masterPtr;
+ TkWindow *containerPtr;
Transient *transPtr, *temp;
- if (wmPtr == NULL || wmPtr->master == NULL) {
+ if (wmPtr == NULL || wmPtr->container == NULL) {
return;
}
- masterPtr = (TkWindow *)wmPtr->master;
- wmPtr2 = masterPtr->wmInfoPtr;
+ containerPtr = (TkWindow *)wmPtr->container;
+ wmPtr2 = containerPtr->wmInfoPtr;
if (wmPtr2 == NULL) {
return;
}
- wmPtr->master = NULL;
+ wmPtr->container= NULL;
transPtr = wmPtr2->transientPtr;
while (transPtr != NULL) {
if (transPtr->winPtr != winPtr) {
@@ -3806,10 +3898,6 @@ WmWithdrawCmd(
TkpWmSetState(winPtr, WithdrawnState);
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
- [win orderOut:NSApp];
- [win setExcludedFromWindowsMenu:YES];
-
/*
* If this window has a transient, the transient must also be withdrawn.
*/
@@ -3817,12 +3905,12 @@ WmWithdrawCmd(
for (Transient *transientPtr = wmPtr->transientPtr;
transientPtr != NULL; transientPtr = transientPtr->nextPtr) {
TkWindow *winPtr2 = transientPtr->winPtr;
- TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2);
+ TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2);
- if (masterPtr == winPtr &&
+ if (containerPtr == winPtr &&
winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) {
TkpWmSetState(winPtr2, WithdrawnState);
- transientPtr->flags |= WITHDRAWN_BY_MASTER;
+ transientPtr->flags |= WITHDRAWN_BY_CONTAINER;
}
}
@@ -3879,7 +3967,7 @@ Tk_SetGrid(
int widthInc, int heightInc)/* Pixel increments corresponding to a change
* of one grid unit. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
WmInfo *wmPtr;
/*
@@ -3973,7 +4061,7 @@ Tk_UnsetGrid(
Tk_Window tkwin) /* Token for window that is currently
* controlling gridding. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
WmInfo *wmPtr;
/*
@@ -4046,14 +4134,14 @@ TopLevelEventProc(
Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display,
-1, -1, -1, NULL, NULL);
- Tk_DestroyWindow((Tk_Window) winPtr);
+ 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");
+ Tcl_Panic("received unwanted reparent event");
}
}
@@ -4080,7 +4168,7 @@ TopLevelReqProc(
TCL_UNUSED(void *), /* Not used. */
Tk_Window tkwin) /* Information about window. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
WmInfo *wmPtr;
wmPtr = winPtr->wmInfoPtr;
@@ -4260,7 +4348,7 @@ UpdateGeometryInfo(
wmPtr->x = wmPtr->y = 0;
wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
- Tk_GeometryRequest((Tk_Window) contWinPtr, width, height);
+ Tk_GeometryRequest((Tk_Window)contWinPtr, width, height);
}
return;
}
@@ -4513,7 +4601,7 @@ Tk_GetRootCoords(
int *yPtr) /* Where to store y-displacement of (0,0). */
{
int x, y;
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
/*
* Search back through this window's parents all the way to a top-level
@@ -4535,27 +4623,6 @@ Tk_GetRootCoords(
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;
}
@@ -4677,10 +4744,10 @@ Tk_CoordsToWindow(
}
winPtr = nextPtr;
}
- if (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) {
+ if (winPtr->mainPtr != ((TkWindow *)tkwin)->mainPtr) {
return NULL;
}
- return (Tk_Window) winPtr;
+ return (Tk_Window)winPtr;
}
/*
@@ -4720,7 +4787,7 @@ Tk_TopCoordsToWindow(
int x, y; /* Coordinates in winPtr. */
Window *children; /* Children of winPtr, or NULL. */
- winPtr = (TkWindow *) tkwin;
+ winPtr = (TkWindow *)tkwin;
x = rootX;
y = rootY;
while (1) {
@@ -4773,7 +4840,7 @@ Tk_TopCoordsToWindow(
}
*newX = x;
*newY = y;
- return (Tk_Window) winPtr;
+ return (Tk_Window)winPtr;
}
/*
@@ -4874,7 +4941,7 @@ Tk_GetVRootGeometry(
int *heightPtr)
{
WmInfo *wmPtr;
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
/*
* Find the top-level window for tkwin, and locate the window manager
@@ -4925,7 +4992,7 @@ Tk_MoveToplevelWindow(
Tk_Window tkwin, /* Window to move. */
int x, int y) /* New location for window (within parent). */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
if (!(winPtr->flags & TK_TOP_LEVEL)) {
@@ -4995,7 +5062,7 @@ TkWmRestackToplevel(
wmPtr->hints.initial_state == WithdrawnState) {
return;
}
- macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (macWindow == nil) {
return;
}
@@ -5011,7 +5078,7 @@ TkWmRestackToplevel(
otherWmPtr->hints.initial_state == WithdrawnState) {
return;
}
- otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window);
+ otherMacWindow = TkMacOSXGetNSWindowForDrawable(otherPtr->window);
if (otherMacWindow == nil) {
return;
}
@@ -5117,7 +5184,7 @@ TkWmAddToColormapWindows(
topPtr->wmInfoPtr->cmapCount = count+1;
/*
- * On the Macintosh all of this is just an excercise in compatability as
+ * On the Macintosh all of this is just an excercise in compatibility as
* we don't support colormaps. If we did they would be installed here.
*/
}
@@ -5353,20 +5420,20 @@ TkSetWMName(
}
NSString *title = [[NSString alloc] initWithUTF8String:titleUid];
- [TkMacOSXDrawableWindow(winPtr->window) setTitle:title];
+ [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title];
[title release];
}
/*
*----------------------------------------------------------------------
*
- * TkGetTransientMaster --
+ * TkMacOSXGetContainer --
*
* If the passed window has the TRANSIENT_FOR property set this will
- * return the master window. Otherwise it will return None.
+ * return the container window. Otherwise it will return None.
*
* Results:
- * The master window or None.
+ * The container window or None.
*
* Side effects:
* None.
@@ -5375,11 +5442,11 @@ TkSetWMName(
*/
Tk_Window
-TkGetTransientMaster(
+TkMacOSXGetContainer(
TkWindow *winPtr)
{
if (winPtr->wmInfoPtr != NULL) {
- return (Tk_Window)winPtr->wmInfoPtr->master;
+ return (Tk_Window)winPtr->wmInfoPtr->container;
}
return NULL;
}
@@ -5389,7 +5456,8 @@ TkGetTransientMaster(
*
* TkMacOSXGetXWindow --
*
- * Returns the X window Id associated with the given NSWindow*.
+ * Stub function that returns the X window Id associated with the
+ * given NSWindow*.
*
* Results:
* The window id is returned. None is returned if not a Tk window.
@@ -5404,27 +5472,26 @@ Window
TkMacOSXGetXWindow(
void *macWinPtr)
{
- Tcl_HashEntry *hPtr;
-
- if (!macWinPtr || !windowHashInit) {
- return None;
+ Window window = None;
+ TKWindow *w = (TKWindow *)macWinPtr;
+ if ([w respondsToSelector: @selector (tkWindow)]) {
+ window = [w tkWindow];
}
- hPtr = Tcl_FindHashEntry(&windowTable, macWinPtr);
- if (hPtr == NULL) {
- return None;
- }
- return (Window) Tcl_GetHashValue(hPtr);
+ return window ? window : None;
}
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetTkWindow --
+ * Tk_MacOSXGetTkWindow --
*
- * Returns the TkWindow* associated with the given NSWindow*.
+ * Returns the Tk_Window associated with the given NSWindow*. This
+ * function is a stub, so the NSWindow* parameter must be declared as
+ * void*.
*
* Results:
- * The TkWindow* returned. NULL is returned if not a Tk window.
+ * A Tk_Window, or NULL if the NSWindow is not associated with
+ * any Tk window.
*
* Side effects:
* None.
@@ -5432,15 +5499,17 @@ TkMacOSXGetXWindow(
*----------------------------------------------------------------------
*/
-TkWindow*
-TkMacOSXGetTkWindow(
- NSWindow *w)
+Tk_Window
+Tk_MacOSXGetTkWindow(
+ void *w)
{
- Window window = TkMacOSXGetXWindow(w);
+ Window window = None;
TkDisplay *dispPtr = TkGetDisplayList();
-
+ if ([(NSWindow *)w respondsToSelector: @selector (tkWindow)]) {
+ window = [(TKWindow *)w tkWindow];
+ }
return (window != None ?
- (TkWindow *)Tk_IdToWindow(dispPtr->display, window) : NULL);
+ Tk_IdToWindow(dispPtr->display, window) : NULL);
}
/*
@@ -5465,7 +5534,7 @@ MODULE_SCOPE int
TkMacOSXIsWindowZoomed(
TkWindow *winPtr)
{
- NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
return [macWindow isZoomed];
}
@@ -5584,7 +5653,7 @@ TkUnsupported1ObjCmd(
}
return WmWinStyle(interp, winPtr, objc, objv);
case TKMWS_TABID:
- if ([NSApp macMinorVersion] < 12) {
+ if ([NSApp macOSVersion] < 101200) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Tabbing identifiers did not exist until OSX 10.12.", -1));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "TABBINGID", NULL);
@@ -5596,7 +5665,7 @@ TkUnsupported1ObjCmd(
}
return WmWinTabbingId(interp, winPtr, objc, objv);
case TKMWS_APPEARANCE:
- if ([NSApp macMinorVersion] < 9) {
+ if ([NSApp macOSVersion] < 100900) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Window appearances did not exist until OSX 10.9.", -1));
Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL);
@@ -5606,7 +5675,7 @@ TkUnsupported1ObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "window ?appearancename?");
return TCL_ERROR;
}
- if (objc == 4 && [NSApp macMinorVersion] < 14) {
+ if (objc == 4 && [NSApp macOSVersion] < 101400) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"Window appearances cannot be changed before OSX 10.14.",
-1));
@@ -5620,7 +5689,7 @@ TkUnsupported1ObjCmd(
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- TkMacOSXInDarkMode((Tk_Window) winPtr)));
+ TkMacOSXInDarkMode((Tk_Window)winPtr)));
return TCL_OK;
default:
return TCL_ERROR;
@@ -5847,13 +5916,14 @@ WmWinTabbingId(
#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101200)
Tcl_Obj *result = NULL;
NSString *idString;
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (win) {
idString = win.tabbingIdentifier;
result = Tcl_NewStringObj(idString.UTF8String, [idString length]);
}
if (result == NULL) {
- NSLog(@"Failed to read tabbing identifier; try calling update idletasks before getting/setting the tabbing identifier of the window.");
+ NSLog(@"Failed to read tabbing identifier; try calling update idletasks"
+ " before getting/setting the tabbing identifier of the window.");
return TCL_OK;
}
Tcl_SetObjResult(interp, result);
@@ -5937,7 +6007,7 @@ WmWinAppearance(
#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
const char *resultString = "unrecognized";
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (win) {
appearance = win.appearance.name;
if (appearance == nil) {
@@ -6012,7 +6082,7 @@ TkpMakeMenuWindow(
* is always visible, e.g. as a floating
* menu. */
{
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
if (transient) {
winPtr->wmInfoPtr->macClass = kSimpleWindowClass;
@@ -6049,13 +6119,13 @@ TkMacOSXMakeRealWindowExist(
WmInfo *wmPtr = winPtr->wmInfoPtr;
MacDrawable *macWin;
WindowClass macClass;
- Bool overrideRedirect = Tk_Attributes((Tk_Window) winPtr)->override_redirect;
+ Bool overrideRedirect = Tk_Attributes((Tk_Window)winPtr)->override_redirect;
if (TkMacOSXHostToplevelExists(winPtr)) {
return;
}
- macWin = (MacDrawable *) winPtr->window;
+ macWin = (MacDrawable *)winPtr->window;
/*
* If this is embedded, make sure its container's toplevel exists, then
@@ -6072,14 +6142,7 @@ TkMacOSXMakeRealWindowExist(
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");
- }
+ Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container");
return;
/*
@@ -6116,16 +6179,18 @@ TkMacOSXMakeRealWindowExist(
NSUnifiedTitleAndToolbarWindowMask : 0) |
((attributes & kWindowSideTitlebarAttribute) ? 1 << 9 : 0) |
(attributes >> WM_NSMASK_SHIFT);
- Class winClass = (macClass == kDrawerWindowClass ? [NSDrawerWindow class] :
+ Class winClass = (macClass == kDrawerWindowClass ? [TKDrawerWindow class] :
(styleMask & (NSUtilityWindowMask|NSDocModalWindowMask|
- NSNonactivatingPanelMask|NSHUDWindowMask)) ? [NSPanel class] :
+ NSNonactivatingPanelMask|NSHUDWindowMask)) ? [TKPanel class] :
[TKWindow class]);
NSRect structureRect = [winClass frameRectForContentRect:NSZeroRect
styleMask:styleMask];
NSRect contentRect = NSMakeRect(5 - structureRect.origin.x,
TkMacOSXZeroScreenHeight() - (TkMacOSXZeroScreenTop() + 5 +
structureRect.origin.y + structureRect.size.height + 200), 200, 200);
- NSWindow *window = [[winClass alloc] initWithContentRect:contentRect
+ if (wmPtr->hints.initial_state == WithdrawnState) {
+ }
+ TKWindow *window = [[winClass alloc] initWithContentRect:contentRect
styleMask:styleMask backing:NSBackingStoreBuffered defer:YES];
if (!window) {
Tcl_Panic("couldn't allocate new Mac window");
@@ -6138,7 +6203,7 @@ TkMacOSXMakeRealWindowExist(
[window setAcceptsMouseMovedEvents:YES];
[window setReleasedWhenClosed:NO];
if (styleMask & NSUtilityWindowMask) {
- [(NSPanel*)window setFloatingPanel:YES];
+ [(TKPanel*)window setFloatingPanel:YES];
}
if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) &&
!(styleMask & NSDocModalWindowMask)) {
@@ -6158,115 +6223,59 @@ TkMacOSXMakeRealWindowExist(
geometry.origin.y = TkMacOSXZeroScreenHeight() - (geometry.origin.y +
geometry.size.height);
[window setFrame:geometry display:YES];
- TkMacOSXRegisterOffScreenWindow((Window) macWin, window);
+ [window setTkWindow: (Window) macWin];
macWin->flags |= TK_HOST_EXISTS;
if (overrideRedirect) {
XSetWindowAttributes atts;
atts.override_redirect = True;
- Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts);
- ApplyMasterOverrideChanges(winPtr, NULL);
+ Tk_ChangeWindowAttributes((Tk_Window)winPtr, CWOverrideRedirect, &atts);
+ ApplyContainerOverrideChanges(winPtr, NULL);
}
}
/*
*----------------------------------------------------------------------
*
- * TkpDisplayWindow --
+ * TkpRedrawWidget --
*
- * Mark the contentView of this window as needing display so the window
- * will be drawn by the window manager. If this is called within the
- * drawRect method, do nothing.
+ * Mark the bounding rectangle of this widget as needing display so the
+ * widget will be drawn by [NSView drawRect:]. If this is called within
+ * the drawRect method, do nothing.
*
* Results:
* None.
*
* Side effects:
- * The window's contentView is marked as needing display.
- *
- *----------------------------------------------------------------------
- */
-
-MODULE_SCOPE void
-TkpDisplayWindow(Tk_Window tkwin) {
- if (![NSApp isDrawing]) {
- TkWindow *winPtr = (TkWindow *) tkwin;
- NSWindow *w = TkMacOSXDrawableWindow(winPtr->window);
-
- [[w contentView] setNeedsDisplay: YES];
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * 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.
+ * The widget's bounding rectangle is marked as dirty.
*
*----------------------------------------------------------------------
*/
void
-TkMacOSXRegisterOffScreenWindow(
- Window window, /* Window structure. */
- void *portPtr) /* Pointer to a Mac Window. */
-{
- Tcl_HashEntry *valueHashPtr;
- int isNew;
+TkpRedrawWidget(Tk_Window tkwin) {
+ TkWindow *winPtr = (TkWindow *)tkwin;
+ NSWindow *w;
+ Rect tkBounds;
+ NSRect bounds;
- if (!windowHashInit) {
- Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
- windowHashInit = true;
+ if ([NSApp isDrawing]) {
+ return;
}
- valueHashPtr = Tcl_CreateHashEntry(&windowTable, (char *) portPtr, &isNew);
- if (!isNew) {
- Tcl_Panic("Same macintosh window allocated twice!");
+ w = TkMacOSXGetNSWindowForDrawable(winPtr->window);
+ if (w) {
+ TKContentView *view = [w contentView];
+ TkMacOSXWinBounds(winPtr, &tkBounds);
+ bounds = NSMakeRect(tkBounds.left,
+ [view bounds].size.height - tkBounds.bottom,
+ tkBounds.right - tkBounds.left,
+ tkBounds.bottom - tkBounds.top);
+ [view setTkNeedsDisplay:YES];
+ [view setTkDirtyRect:bounds];
}
- 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, macWinPtr);
- if (!entryPtr) {
- TkMacOSXDbgMsg("Failed to find window %p", macWinPtr);
- } else {
- Tcl_DeleteHashEntry(entryPtr);
- }
-}
/*
*----------------------------------------------------------------------
@@ -6394,11 +6403,12 @@ TkpWmSetState(
return;
}
- macWin = TkMacOSXDrawableWindow(winPtr->window);
+ macWin = TkMacOSXGetNSWindowForDrawable(winPtr->window);
if (state == WithdrawnState) {
- Tk_UnmapWindow((Tk_Window) winPtr);
+ 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.
@@ -6408,16 +6418,18 @@ TkpWmSetState(
![macWin isMiniaturized]) {
[macWin miniaturize:NSApp];
}
- Tk_UnmapWindow((Tk_Window) winPtr);
+ Tk_UnmapWindow((Tk_Window)winPtr);
} else if (state == NormalState || state == ZoomState) {
- Tk_MapWindow((Tk_Window) winPtr);
- if (macWin && ([macWin styleMask] & NSMiniaturizableWindowMask) &&
- [macWin isMiniaturized]) {
- [macWin deminiaturize:NSApp];
- }
- TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn :
- inZoomOut);
+ Tk_MapWindow((Tk_Window)winPtr);
+ [macWin deminiaturize:NSApp];
+ [macWin orderFront:NSApp];
+ TkMacOSXZoomToplevel(macWin, state == NormalState ? inZoomIn : inZoomOut);
}
+ /*
+ * Make sure windows are updated after the state change.
+ */
+
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
}
/*
@@ -6444,29 +6456,6 @@ TkpIsWindowFloating(
}
/*
- *----------------------------------------------------------------------
- *
- * 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 --
@@ -6590,7 +6579,7 @@ TkpChangeFocus(
}
if (Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr)) {
- NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(winPtr->window);
TkWmRestackToplevel(winPtr, Above, NULL);
if (force) {
@@ -6645,7 +6634,7 @@ WmStackorderToplevelWrapperMap(
if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr)
&& (winPtr->display == display)) {
hPtr = Tcl_CreateHashEntry(table,
- (char*) TkMacOSXDrawableWindow(winPtr->window), &newEntry);
+ (void *)TkMacOSXGetNSWindowForDrawable(winPtr->window), &newEntry);
Tcl_SetHashValue(hPtr, winPtr);
}
@@ -6724,8 +6713,8 @@ TkMacOSXApplyWindowAttributes(
WmInfo *wmPtr = winPtr->wmInfoPtr;
ApplyWindowAttributeFlagChanges(winPtr, macWindow, 0, 0, 0, 1);
- if (wmPtr->master != NULL || winPtr->atts.override_redirect) {
- ApplyMasterOverrideChanges(winPtr, macWindow);
+ if (wmPtr->container != NULL || winPtr->atts.override_redirect) {
+ ApplyContainerOverrideChanges(winPtr, macWindow);
}
}
@@ -6765,7 +6754,7 @@ ApplyWindowAttributeFlagChanges(
if (!create) {
return;
}
- Tk_MakeWindowExist((Tk_Window) winPtr);
+ Tk_MakeWindowExist((Tk_Window)winPtr);
}
if (!TkMacOSXHostToplevelExists(winPtr)) {
if (!create) {
@@ -6773,7 +6762,7 @@ ApplyWindowAttributeFlagChanges(
}
TkMacOSXMakeRealWindowExist(winPtr);
}
- macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
}
if ((changedAttributes & kWindowCloseBoxAttribute) || initial) {
[[macWindow standardWindowButton:NSWindowCloseButton]
@@ -6850,7 +6839,7 @@ ApplyWindowAttributeFlagChanges(
* after 10.10.
*/
-#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
if (!(macWindow.styleMask & NSUtilityWindowMask)) {
/*
* Exclude overrideredirect, transient, and "help"-styled
@@ -6858,12 +6847,11 @@ ApplyWindowAttributeFlagChanges(
*/
if ((winPtr->atts.override_redirect) ||
- (wmPtr->master != NULL) ||
+ (wmPtr->container != NULL) ||
(winPtr->wmInfoPtr->macClass == kHelpWindowClass)) {
b |= (NSWindowCollectionBehaviorCanJoinAllSpaces |
NSWindowCollectionBehaviorFullScreenAuxiliary);
} else {
- NSSize screenSize = [[macWindow screen] frame].size;
b |= NSWindowCollectionBehaviorFullScreenPrimary;
/*
@@ -6873,7 +6861,9 @@ ApplyWindowAttributeFlagChanges(
* window. To work around this we make the max size equal
* to the screen size. (For 10.11 and up, only)
*/
- if ([NSApp macMinorVersion] > 10) {
+
+ if (@available(macOS 10.11, *)) {
+ NSSize screenSize = [[macWindow screen] frame].size;
[macWindow setMaxFullScreenContentSize:screenSize];
}
}
@@ -6895,7 +6885,7 @@ ApplyWindowAttributeFlagChanges(
if ((wmPtr->flags & WM_TOPMOST) != (oldFlags & WM_TOPMOST)) {
[macWindow setLevel:(wmPtr->flags & WM_TOPMOST) ?
kCGUtilityWindowLevel : ([macWindow isKindOfClass:
- [NSPanel class]] && [macWindow isFloatingPanel] ?
+ [TKPanel class]] && [macWindow isFloatingPanel] ?
kCGFloatingWindowLevel : kCGNormalWindowLevel)];
}
@@ -6916,9 +6906,9 @@ ApplyWindowAttributeFlagChanges(
/*
*----------------------------------------------------------------------
*
- * ApplyMasterOverrideChanges --
+ * ApplyContainerOverrideChanges --
*
- * This procedure applies changes to override_redirect or master.
+ * This procedure applies changes to override_redirect or container.
*
* Results:
* None.
@@ -6930,7 +6920,7 @@ ApplyWindowAttributeFlagChanges(
*/
static void
-ApplyMasterOverrideChanges(
+ApplyContainerOverrideChanges(
TkWindow *winPtr,
NSWindow *macWindow)
{
@@ -6943,7 +6933,7 @@ ApplyMasterOverrideChanges(
if (!macWindow && winPtr->window != None &&
TkMacOSXHostToplevelExists(winPtr)) {
- macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ macWindow = TkMacOSXGetNSWindowForDrawable(winPtr->window);
}
styleMask = [macWindow styleMask];
@@ -6957,20 +6947,20 @@ ApplyMasterOverrideChanges(
wmPtr->attributes = macClassAttrs[kSimpleWindowClass].defaultAttrs;
}
wmPtr->attributes |= kWindowNoActivatesAttribute;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
styleMask = 0;
} else {
styleMask &= ~NSTitledWindowMask;
}
} else {
if (wmPtr->macClass == kSimpleWindowClass &&
- oldAttributes == kWindowNoActivatesAttribute) {
+ (oldAttributes & kWindowNoActivatesAttribute)) {
wmPtr->macClass = kDocumentWindowClass;
wmPtr->attributes =
macClassAttrs[kDocumentWindowClass].defaultAttrs;
}
wmPtr->attributes &= ~kWindowNoActivatesAttribute;
- if ([NSApp macMinorVersion] == 6) {
+ if ([NSApp macOSVersion] == 100600) {
styleMask = NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
@@ -6996,9 +6986,9 @@ ApplyMasterOverrideChanges(
[macWindow setExcludedFromWindowsMenu:YES];
[macWindow setStyleMask:styleMask];
if (wmPtr->hints.initial_state == NormalState) {
- [macWindow orderFront:nil];
+ [macWindow orderFront:NSApp];
}
- if (wmPtr->master != NULL) {
+ if (wmPtr->container != NULL) {
wmPtr->flags |= WM_TOPMOST;
} else {
wmPtr->flags &= ~WM_TOPMOST;
@@ -7014,24 +7004,24 @@ ApplyMasterOverrideChanges(
[macWindow setExcludedFromWindowsMenu:NO];
wmPtr->flags &= ~WM_TOPMOST;
}
- if (wmPtr->master != None) {
- TkWindow *masterWinPtr = (TkWindow *) wmPtr->master;
+ if (wmPtr->container != None) {
+ TkWindow *containerWinPtr = (TkWindow *)wmPtr->container;
- if (masterWinPtr && (masterWinPtr->window != None)
- && TkMacOSXHostToplevelExists(masterWinPtr)) {
- NSWindow *masterMacWin = TkMacOSXDrawableWindow(
- masterWinPtr->window);
+ if (containerWinPtr && (containerWinPtr->window != None)
+ && TkMacOSXHostToplevelExists(containerWinPtr)) {
+ NSWindow *containerMacWin = TkMacOSXGetNSWindowForDrawable(
+ containerWinPtr->window);
/*
* Try to add the transient window as a child window of the
- * master. A child NSWindow retains its relative position with
- * respect to the parent when the parent is moved. This is
- * pointless if the parent is offscreen, and adding a child to
- * an offscreen window causes the parent to be displayed as a
- * zombie. So we only do this if the parent is visible.
+ * container. A child NSWindow retains its relative position
+ * with respect to the parent when the parent is moved. This
+ * is pointless if the parent is offscreen, and adding a child
+ * to an offscreen window causes the parent to be displayed as
+ * a zombie. So we only do this if the parent is visible.
*/
- if (masterMacWin && [masterMacWin isVisible]
+ if (containerMacWin && [containerMacWin isVisible]
&& (winPtr->flags & TK_MAPPED)) {
/*
* If the transient is already a child of some other window,
@@ -7039,12 +7029,12 @@ ApplyMasterOverrideChanges(
*/
parentWindow = [macWindow parentWindow];
- if (parentWindow && parentWindow != masterMacWin) {
+ if (parentWindow && parentWindow != containerMacWin) {
[parentWindow removeChildWindow:macWindow];
}
-
- [masterMacWin addChildWindow:macWindow
- ordered:NSWindowAbove];
+ [macWindow orderFront:NSApp];
+ [containerMacWin addChildWindow:macWindow
+ ordered:NSWindowAbove];
}
}
} else {
@@ -7243,7 +7233,7 @@ RemapWindows(
*/
if (winPtr->window != None) {
- MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ MacDrawable *macWin = (MacDrawable *)winPtr->window;
macWin->toplevel->referenceCount--;
macWin->toplevel = parentWin->toplevel;
@@ -7260,7 +7250,7 @@ RemapWindows(
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
- RemapWindows(childPtr, (MacDrawable *) winPtr->window);
+ RemapWindows(childPtr, (MacDrawable *)winPtr->window);
}
}
diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h
index 20bbb6d..c648292 100644
--- a/macosx/tkMacOSXWm.h
+++ b/macosx/tkMacOSXWm.h
@@ -37,7 +37,7 @@ typedef struct ProtocolHandler {
} ProtocolHandler;
/* The following data structure is used in the TkWmInfo to maintain a list of all of the
- * transient windows belonging to a given master.
+ * transient windows belonging to a given container.
*/
typedef struct Transient {
@@ -46,7 +46,7 @@ typedef struct Transient {
struct Transient *nextPtr;
} Transient;
-#define WITHDRAWN_BY_MASTER 0x1
+#define WITHDRAWN_BY_CONTAINER 0x1
/*
* A data structure of the following type holds window-manager-related
@@ -65,8 +65,8 @@ typedef struct TkWmInfo {
Tk_Uid titleUid; /* Title to display in window caption. If NULL,
* use name of widget. */
char *iconName; /* Name to display in icon. */
- Tk_Window master; /* Master window for TRANSIENT_FOR property, or
- * None. */
+ Tk_Window container; /* Container 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
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 4912583..25d9f96 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -256,8 +256,8 @@ XkbOpenDisplay(
*/
screen->root = ROOT_ID;
screen->display = display;
- screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24;
- screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
+ screen->black_pixel = 0x00000000;
+ screen->white_pixel = 0x00FFFFFF;
screen->ext_data = (XExtData *) &maxBounds;
screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
@@ -308,7 +308,6 @@ XkbOpenDisplay(
return display;
}
-
/*
*----------------------------------------------------------------------
@@ -488,7 +487,7 @@ XGetGeometry(
unsigned int *border_width_return,
unsigned int *depth_return)
{
- TkWindow *winPtr = ((MacDrawable *) d)->winPtr;
+ TkWindow *winPtr = ((MacDrawable *)d)->winPtr;
display->request++;
*root_return = ROOT_ID;
@@ -500,7 +499,7 @@ XGetGeometry(
*border_width_return = winPtr->changes.border_width;
*depth_return = Tk_Depth(winPtr);
} else {
- CGSize size = ((MacDrawable *) d)->size;
+ CGSize size = ((MacDrawable *)d)->size;
*x_return = 0;
*y_return = 0;
*width_return = size.width;
@@ -878,8 +877,7 @@ XForceScreenSaver(
display->request++;
return Success;
}
-
-#if 0
+
int
XSetClipRectangles(
Display *d,
@@ -888,24 +886,22 @@ XSetClipRectangles(
int clip_y_origin,
XRectangle* rectangles,
int n,
- int ordering)
+ TCL_UNUSED(int))
{
- Region clipRgn = XCreateRegion();
+ TkRegion clipRgn = TkCreateRegion();
while (n--) {
- XRectangle rect = *rectangles;
+ XRectangle rect = *rectangles;
- rect.x += clip_x_origin;
- rect.y += clip_y_origin;
- XUnionRectWithRegion(&rect, clipRgn, clipRgn);
- rectangles++;
+ rect.x += clip_x_origin;
+ rect.y += clip_y_origin;
+ TkUnionRectWithRegion(&rect, clipRgn, clipRgn);
+ rectangles++;
}
- XSetRegion(d, gc, clipRgn);
- XDestroyRegion(clipRgn);
+ TkSetRegion(d, gc, clipRgn);
+ TkDestroyRegion(clipRgn);
return 1;
}
-#endif
-
/*
*----------------------------------------------------------------------
*
@@ -1084,7 +1080,7 @@ XSynchronize(
Display *display,
TCL_UNUSED(Bool))
{
- display->request++;
+ display->request++;
return NULL;
}
@@ -1190,7 +1186,7 @@ Tk_GetUserInactiveTime(
uint64_t time;
IOReturn result;
- regEntry = IOServiceGetMatchingService(kIOMasterPortDefault,
+ regEntry = IOServiceGetMatchingService(0,
IOServiceMatching("IOHIDSystem"));
if (regEntry == 0) {
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 72649f6..8437aa6 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -39,7 +39,7 @@
#define BEGIN_DRAWING(d) { \
TkMacOSXDrawingContext dc; \
- if (!TkMacOSXSetupDrawingContext((d), NULL, 1, &dc)) {return;}
+ if (!TkMacOSXSetupDrawingContext((d), NULL, &dc)) {return;}
#define END_DRAWING \
TkMacOSXRestoreDrawingContext(&dc);}
@@ -153,7 +153,7 @@ static inline CGRect BoxToRect(
Drawable d,
Ttk_Box b)
{
- MacDrawable *md = (MacDrawable *) d;
+ MacDrawable *md = (MacDrawable *)d;
CGRect rect;
rect.origin.y = b.y + md->yOff;
@@ -232,52 +232,51 @@ static CGRect NormalizeButtonBounds(
* support Dark Mode anyway.
*/
-static CGFloat windowBackground[4] = {
+static const CGFloat WINDOWBACKGROUND[4] = {
235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0
};
-static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0};
-static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0};
+static const CGFloat WHITERGBA[4] = {1.0, 1.0, 1.0, 1.0};
+static const CGFloat BLACKRGBA[4] = {0.0, 0.0, 0.0, 1.0};
/*----------------------------------------------------------------------
* GetBackgroundColor --
*
* Fills the array rgba with the color coordinates for a background color.
- * Start with the background color of a window's geometry master, or the
- * standard ttk window background if there is no master. If the contrast
- * parameter is nonzero, modify this color to be darker, for the aqua
- * appearance, or lighter for the DarkAqua appearance. This is primarily
- * used by the Fill and Background elements.
+ * Start with the background color of a window's geometry container, or
+ * the standard ttk window background if there is no container. If the
+ * contrast parameter is nonzero, modify this color to be darker, for the
+ * aqua appearance, or lighter for the DarkAqua appearance. This is
+ * primarily used by the Fill and Background elements.
*/
static void GetBackgroundColor(
- CGContextRef context,
+ TCL_UNUSED(CGContextRef),
Tk_Window tkwin,
int contrast,
CGFloat *rgba)
{
- TkWindow *winPtr = (TkWindow *) tkwin;
- TkWindow *masterPtr = (TkWindow *) TkGetGeomMaster(tkwin);
- (void)context;
+ TkWindow *winPtr = (TkWindow *)tkwin;
+ TkWindow *containerPtr = (TkWindow *)TkGetContainer(tkwin);
- while (masterPtr && masterPtr->privatePtr) {
- if (masterPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) {
+ while (containerPtr && containerPtr->privatePtr) {
+ if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) {
break;
}
- masterPtr = (TkWindow *) TkGetGeomMaster(masterPtr);
+ containerPtr = (TkWindow *)TkGetContainer(containerPtr);
}
- if (masterPtr && masterPtr->privatePtr) {
+ if (containerPtr && containerPtr->privatePtr) {
for (int i = 0; i < 4; i++) {
- rgba[i] = masterPtr->privatePtr->fillRGBA[i];
+ rgba[i] = containerPtr->privatePtr->fillRGBA[i];
}
} else {
- if ([NSApp macMinorVersion] > 13) {
+ if ([NSApp macOSVersion] > 101300) {
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *windowColor = [[NSColor windowBackgroundColor]
colorUsingColorSpace: deviceRGB];
[windowColor getComponents: rgba];
} else {
for (int i = 0; i < 4; i++) {
- rgba[i] = windowBackground[i];
+ rgba[i] = WINDOWBACKGROUND[i];
}
}
}
@@ -304,9 +303,10 @@ static void GetBackgroundColor(
/*----------------------------------------------------------------------
- * +++ Single Arrow Buttons --
+ * +++ Single Arrow Images --
*
- * Used in ListHeaders and Comboboxes.
+ * Used in ListHeaders and Comboboxes as well as disclosure triangles in
+ * macOS 11.
*/
static void DrawDownArrow(
@@ -314,7 +314,7 @@ static void DrawDownArrow(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -336,7 +336,7 @@ static void DrawUpArrow(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -353,6 +353,48 @@ static void DrawUpArrow(
CGContextStrokePath(context);
}
+static void DrawClosedDisclosure(
+ CGContextRef context,
+ CGRect bounds,
+ CGFloat inset,
+ CGFloat size,
+ CGFloat *rgba)
+{
+ CGFloat x, y;
+
+ CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]);
+ CGContextSetLineWidth(context, 1.5);
+ x = bounds.origin.x + inset;
+ y = bounds.origin.y + trunc(bounds.size.height / 2);
+ CGContextBeginPath(context);
+ CGPoint arrow[3] = {
+ {x, y - size / 4 - 1}, {x + size / 2, y}, {x, y + size / 4 + 1}
+ };
+ CGContextAddLines(context, arrow, 3);
+ CGContextStrokePath(context);
+}
+
+static void DrawOpenDisclosure(
+ CGContextRef context,
+ CGRect bounds,
+ CGFloat inset,
+ CGFloat size,
+ CGFloat *rgba)
+{
+ CGFloat x, y;
+
+ CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]);
+ CGContextSetLineWidth(context, 1.5);
+ x = bounds.origin.x + inset;
+ y = bounds.origin.y + trunc(bounds.size.height / 2);
+ CGContextBeginPath(context);
+ CGPoint arrow[3] = {
+ {x, y - size / 4}, {x + size / 2, y + size / 2}, {x + size, y - size / 4}
+ };
+ CGContextAddLines(context, arrow, 3);
+ CGContextStrokePath(context);
+}
+
/*----------------------------------------------------------------------
* +++ Double Arrow Buttons --
*
@@ -364,7 +406,7 @@ static void DrawUpDownArrows(
CGRect bounds,
CGFloat inset,
CGFloat size,
- CGFloat *rgba)
+ const CGFloat *rgba)
{
CGFloat x, y;
@@ -502,10 +544,13 @@ static void SolidFillRoundedRectangle(
NSColor *color)
{
CGPathRef path;
- CHECK_RADIUS(radius, bounds)
- CGContextSetFillColorWithColor(context, CGCOLOR(color));
+ CHECK_RADIUS(radius, bounds)
path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL);
+ if (!path) {
+ return;
+ }
+ CGContextSetFillColorWithColor(context, CGCOLOR(color));
CGContextBeginPath(context);
CGContextAddPath(context, path);
CGContextFillPath(context);
@@ -548,7 +593,7 @@ static void DrawListHeader(
* So we have to query the Apple window manager.
*/
- NSWindow *win = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
+ NSWindow *win = TkMacOSXGetNSWindowForDrawable(Tk_WindowId(tkwin));
CGFloat *bgRGBA = [win isKeyWindow] ? activeBgRGBA : inactiveBgRGBA;
CGFloat x = bounds.origin.x, y = bounds.origin.y;
CGFloat w = bounds.size.width, h = bounds.size.height;
@@ -588,9 +633,9 @@ static void DrawListHeader(
arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16;
arrowBounds.size.width = 16;
if (state & TTK_STATE_ALTERNATE) {
- DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA);
+ DrawUpArrow(context, arrowBounds, 3, 8, BLACKRGBA);
} else if (state & TTK_STATE_SELECTED) {
- DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA);
+ DrawDownArrow(context, arrowBounds, 3, 8, BLACKRGBA);
}
}
}
@@ -712,9 +757,9 @@ static void DrawDarkButton(
darkSelectedGradient, 2);
}
if (kind == kThemePopupButton) {
- DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA);
+ DrawUpDownArrows(context, arrowBounds, 3, 7, WHITERGBA);
} else {
- DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA);
+ DrawDownArrow(context, arrowBounds, 4, 8, WHITERGBA);
}
}
@@ -773,7 +818,7 @@ static void DrawDarkIncDecButton(
darkSelectedGradient, 2);
CGContextRestoreGState(context);
}
- DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA);
+ DrawUpDownArrows(context, bounds, 3, 5, WHITERGBA);
HighlightButtonBorder(context, bounds);
}
@@ -1040,14 +1085,13 @@ static void DrawDarkTab(
static void DrawDarkSeparator(
CGRect bounds,
CGContextRef context,
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
static CGFloat fill[4] = {1.0, 1.0, 1.0, 0.3};
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *fillColor = [NSColor colorWithColorSpace: deviceRGB
components: fill
count:4];
- (void)tkwin;
CGContextSetFillColorWithColor(context, CGCOLOR(fillColor));
CGContextFillRect(context, bounds);
@@ -1167,20 +1211,19 @@ static void DrawDarkFrame(
static void DrawDarkListHeader(
CGRect bounds,
CGContextRef context,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
int state)
{
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *stroke;
- (void)tkwin;
CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace);
CGFloat x = bounds.origin.x, y = bounds.origin.y;
CGFloat w = bounds.size.width, h = bounds.size.height;
- CGPoint top[2] = {{x, y}, {x + w, y}};
- CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
- CGPoint separator[2] = {{x + w, y + 3}, {x + w, y + h - 3}};
+ CGPoint top[2] = {{x, y + 1}, {x + w, y + 1}};
+ CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
+ CGPoint separator[2] = {{x + w - 1, y + 3}, {x + w - 1, y + h - 3}};
CGContextSaveGState(context);
CGContextSetShouldAntialias(context, false);
stroke = [NSColor colorWithColorSpace: deviceRGB
@@ -1202,9 +1245,9 @@ static void DrawDarkListHeader(
arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16;
arrowBounds.size.width = 16;
if (state & TTK_STATE_ALTERNATE) {
- DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA);
+ DrawUpArrow(context, arrowBounds, 3, 8, WHITERGBA);
} else if (state & TTK_STATE_SELECTED) {
- DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA);
+ DrawDownArrow(context, arrowBounds, 3, 8, WHITERGBA);
}
}
}
@@ -1412,7 +1455,7 @@ static void ButtonElementDraw(
} else if (info.kind == kThemePushButton &&
(state & TTK_STATE_PRESSED)) {
bounds.size.height += 2;
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
GradientFillRoundedRectangle(dc.context, bounds, 4,
pressedPushButtonGradient, 2);
}
@@ -1606,7 +1649,7 @@ static void PaneElementDraw(
bounds.origin.y -= kThemeMetricTabFrameOverlap;
bounds.size.height += kThemeMetricTabFrameOverlap;
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
DrawGroupBox(bounds, dc.context, tkwin);
} else {
HIThemeTabPaneDrawInfo info = {
@@ -1665,7 +1708,7 @@ static void GroupElementDraw(
CGRect bounds = BoxToRect(d, b);
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
DrawGroupBox(bounds, dc.context, tkwin);
} else {
const HIThemeGroupBoxDrawInfo info = {
@@ -1705,7 +1748,7 @@ static Ttk_ElementOptionSpec EntryElementOptions[] = {
offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND},
{"-fieldbackground", TK_OPTION_BORDER,
offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND},
- {0}
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void EntryElementSize(
@@ -1788,7 +1831,7 @@ static void EntryElementDraw(
}
BEGIN_DRAWING(d)
if (backgroundPtr == NULL) {
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
background = [NSColor textBackgroundColor];
CGContextSetFillColorWithColor(dc.context, CGCOLOR(background));
} else {
@@ -1866,7 +1909,7 @@ static void ComboboxElementDraw(
if (TkMacOSXInDarkMode(tkwin)) {
bounds.size.height += 1;
DrawDarkButton(bounds, info.kind, state, dc.context);
- } else if ([NSApp macMinorVersion] > 8) {
+ } else if ([NSApp macOSVersion] > 100800) {
if ((state & TTK_STATE_BACKGROUND) &&
!(state & TTK_STATE_DISABLED)) {
NSColor *background = [NSColor textBackgroundColor];
@@ -2065,7 +2108,7 @@ static Ttk_ElementOptionSpec TrackElementOptions[] = {
{"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj), NULL},
{"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj), NULL},
{"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj), NULL},
- {0, 0, 0, NULL}
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void TrackElementSize(
void *clientData,
@@ -2094,6 +2137,7 @@ static void TrackElementDraw(
TrackElement *elem = elementRecord;
Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
double from = 0, to = 100, value = 0, factor;
+ CGRect bounds;
TtkGetOrientFromObj(NULL, elem->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
@@ -2101,10 +2145,16 @@ static void TrackElementDraw(
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
factor = RangeToFactor(to);
+ /*
+ * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate
+ * bounds variable avoids UBSan (-fsanitize=alignment) complaints.
+ */
+
+ bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind = data->kind,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = from * factor,
.max = to * factor,
.value = value * factor,
@@ -2126,7 +2176,7 @@ static void TrackElementDraw(
}
BEGIN_DRAWING(d)
if (TkMacOSXInDarkMode(tkwin)) {
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB
components: darkTrack
@@ -2205,7 +2255,7 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = {
offsetof(PbarElement, phaseObj), "0"},
{"-mode", TK_OPTION_STRING,
offsetof(PbarElement, modeObj), "determinate"},
- {0, 0, 0, 0}
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void PbarElementSize(
TCL_UNUSED(void *),
@@ -2233,6 +2283,7 @@ static void PbarElementDraw(
Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL;
int phase = 0;
double value = 0, maximum = 100, factor;
+ CGRect bounds;
TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation);
Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
@@ -2240,13 +2291,19 @@ static void PbarElementDraw(
Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
factor = RangeToFactor(maximum);
+ /*
+ * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate
+ * bounds variable avoids UBSan (-fsanitize=alignment) complaints.
+ */
+
+ bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind =
(!strcmp("indeterminate",
Tcl_GetString(pbar->modeObj)) && value) ?
kThemeIndeterminateBar : kThemeProgressBar,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = 0,
.max = maximum * factor,
.value = value * factor,
@@ -2259,7 +2316,7 @@ static void PbarElementDraw(
BEGIN_DRAWING(d)
if (TkMacOSXInDarkMode(tkwin)) {
- CGRect bounds = BoxToRect(d, b);
+ bounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB
components: darkTrack
@@ -2295,7 +2352,7 @@ typedef struct
static Ttk_ElementOptionSpec ScrollbarElementOptions[] = {
{"-orient", TK_OPTION_STRING,
offsetof(ScrollbarElement, orientObj), "horizontal"},
- {0, 0, 0, 0}
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void TroughElementSize(
TCL_UNUSED(void *),
@@ -2313,12 +2370,12 @@ static void TroughElementSize(
ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness);
if (orientation == TTK_ORIENT_HORIZONTAL) {
*minHeight = thickness;
- if ([NSApp macMinorVersion] > 7) {
+ if ([NSApp macOSVersion] > 100700) {
*paddingPtr = Ttk_MakePadding(4, 4, 4, 3);
}
} else {
*minWidth = thickness;
- if ([NSApp macMinorVersion] > 7) {
+ if ([NSApp macOSVersion] > 100700) {
*paddingPtr = Ttk_MakePadding(4, 4, 3, 4);
}
}
@@ -2363,7 +2420,7 @@ static void TroughElementDraw(
components: rgba
count: 4];
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
CGContextSetFillColorWithColor(dc.context, CGCOLOR(troughColor));
} else {
ChkErr(HIThemeSetFill, kThemeBrushDocumentWindowBackground, NULL,
@@ -2426,7 +2483,7 @@ static void ThumbElementDraw(
* draw the thumb directly.
*/
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
CGRect thumbBounds = BoxToRect(d, b);
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *thumbColor;
@@ -2452,7 +2509,7 @@ static void ThumbElementDraw(
END_DRAWING
} else {
double thumbSize, trackSize, visibleSize, factor, fraction;
- MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin);
+ MacDrawable *macWin = (MacDrawable *)Tk_WindowId(tkwin);
CGRect troughBounds = {{macWin->xOff, macWin->yOff},
{Tk_Width(tkwin), Tk_Height(tkwin)}};
@@ -2486,7 +2543,7 @@ static void ThumbElementDraw(
visibleSize = (thumbSize / trackSize) * factor;
info.max = factor - visibleSize;
info.trackInfo.scrollbar.viewsize = visibleSize;
- if ([NSApp macMinorVersion] < 8 ||
+ if ([NSApp macOSVersion] < 100800 ||
orientation == TTK_ORIENT_HORIZONTAL) {
info.value = factor * fraction;
} else {
@@ -2524,7 +2581,7 @@ static void ArrowElementSize(
int *minHeight,
TCL_UNUSED(Ttk_Padding *))
{
- if ([NSApp macMinorVersion] < 8) {
+ if ([NSApp macOSVersion] < 100800) {
*minHeight = *minWidth = 14;
} else {
*minHeight = *minWidth = -1;
@@ -2708,7 +2765,7 @@ static void FillElementDraw(
{
CGRect bounds = BoxToRect(d, b);
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
NSColor *bgColor;
CGFloat fill[4];
@@ -2813,7 +2870,7 @@ typedef struct {
static Ttk_ElementOptionSpec FieldElementOptions[] = {
{"-fieldbackground", TK_OPTION_BORDER,
offsetof(FieldElement, backgroundObj), "white"},
- {NULL, 0, 0, NULL}
+ {NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
static void FieldElementDraw(
@@ -2880,7 +2937,7 @@ static void TreeAreaElementSize (
* widget expects the heading to be the same height as a row.
*/
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
paddingPtr->top = 4;
}
}
@@ -2900,7 +2957,7 @@ static void TreeHeaderElementSize(
int *minHeight,
Ttk_Padding *paddingPtr)
{
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
*minHeight = 24;
} else {
ButtonElementSize(clientData, elementRecord, tkwin, minWidth,
@@ -2927,7 +2984,7 @@ static void TreeHeaderElementDraw(
};
BEGIN_DRAWING(d)
- if ([NSApp macMinorVersion] > 8) {
+ if ([NSApp macOSVersion] > 100800) {
/*
* Compensate for the padding added in TreeHeaderElementSize, so
@@ -3002,8 +3059,21 @@ static void DisclosureElementDraw(
};
BEGIN_DRAWING(d)
- ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation,
+ if ([NSApp macOSVersion] >= 110000) {
+ CGFloat rgba[4];
+ NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
+ NSColor *stroke = [[NSColor textColor]
+ colorUsingColorSpace: deviceRGB];
+ [stroke getComponents: rgba];
+ if (state & TTK_TREEVIEW_STATE_OPEN) {
+ DrawOpenDisclosure(dc.context, bounds, 2, 8, rgba);
+ } else {
+ DrawClosedDisclosure(dc.context, bounds, 2, 12, rgba);
+ }
+ } else {
+ ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation,
NULL);
+ }
END_DRAWING
}
}
@@ -3053,20 +3123,20 @@ TTK_LAYOUT("TCombobox",
/* 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))))
+ TTK_GROUP("Notebook.padding", TTK_FILL_BOTH,
+ TTK_NODE("Notebook.label", TTK_FILL_BOTH))))
/* Spinbox -- buttons 2px to the right of the field. */
TTK_LAYOUT("TSpinbox",
TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT,
TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E)
TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E))
- TTK_GROUP("Spinbox.field", TTK_EXPAND | TTK_FILL_X,
- TTK_NODE("Spinbox.textarea", TTK_EXPAND | TTK_FILL_X)))
+ TTK_GROUP("Spinbox.field", TTK_FILL_X,
+ TTK_NODE("Spinbox.textarea", TTK_FILL_X)))
/* Progress bars -- track only */
TTK_LAYOUT("TProgressbar",
- TTK_NODE("Progressbar.track", TTK_EXPAND | TTK_FILL_BOTH))
+ TTK_NODE("Progressbar.track", TTK_FILL_BOTH))
/* Treeview -- no border. */
TTK_LAYOUT("Treeview",
@@ -3091,15 +3161,13 @@ TTK_LAYOUT("Item",
TTK_LAYOUT("Vertical.TScrollbar",
TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y,
- TTK_NODE("Vertical.Scrollbar.thumb",
- TTK_PACK_TOP | TTK_EXPAND | TTK_FILL_BOTH)
+ TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH)
TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM)
TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM)))
TTK_LAYOUT("Horizontal.TScrollbar",
TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
- TTK_NODE("Horizontal.Scrollbar.thumb",
- TTK_PACK_LEFT | TTK_EXPAND | TTK_FILL_BOTH)
+ TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH)
TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT)
TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT)))
diff --git a/tests/all.tcl b/tests/all.tcl
index d15e5ca..46721a2 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -4,7 +4,7 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,6 +14,8 @@ package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::configure -testdir [file normalize [file dirname [info script]]]
tcltest::configure -loadfile \
- [file join [tcltest::testsDirectory] constraints.tcl]
+ [file join [tcltest::testsDirectory] constraints.tcl]
tcltest::configure -singleproc 1
-tcltest::runAllTests
+set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+encoding system utf-8
+if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/bell.test b/tests/bell.test
index bbafeac..da264d7 100644
--- a/tests/bell.test
+++ b/tests/bell.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "bell" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1998-2000 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/bgerror.test b/tests/bgerror.test
index fd9594a..a69fceb 100644
--- a/tests/bgerror.test
+++ b/tests/bgerror.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the bgerror command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/bind.test b/tests/bind.test
index adc628a..b84f777 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -2,9 +2,9 @@
# commands plus the procedures in tkBind.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,6 +13,9 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
tk useinputmethods 0
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
+
toplevel .t -width 100 -height 50
wm geom .t +0+0
update idletasks
@@ -971,7 +974,7 @@ test bind-13.35 {Tk_BindEvent procedure: execute binding} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-13.38 {Tk_BindEvent procedure: binding gets to run} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1054,7 +1057,7 @@ test bind-15.1 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1072,7 +1075,7 @@ test bind-15.2 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1087,7 +1090,7 @@ test bind-15.3 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1103,7 +1106,7 @@ test bind-15.4 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1119,7 +1122,7 @@ test bind-15.5 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.6 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1136,7 +1139,7 @@ test bind-15.6 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.7 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1153,7 +1156,7 @@ test bind-15.7 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1168,7 +1171,7 @@ test bind-15.8 {MatchPatterns procedure, ignoring type mismatches} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.9 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1181,7 +1184,7 @@ test bind-15.9 {MatchPatterns procedure, modifier checks} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.10 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1194,7 +1197,7 @@ test bind-15.10 {MatchPatterns procedure, modifier checks} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.11 {MatchPatterns procedure, modifier checks} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1207,7 +1210,7 @@ test bind-15.11 {MatchPatterns procedure, modifier checks} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.12 {MatchPatterns procedure, ignore modifier presses and releases} -constraints {
nonPortable
} -setup {
@@ -1226,7 +1229,7 @@ test bind-15.12 {MatchPatterns procedure, ignore modifier presses and releases}
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.13 {MatchPatterns procedure, checking detail} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1240,7 +1243,7 @@ test bind-15.13 {MatchPatterns procedure, checking detail} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.14 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1257,7 +1260,7 @@ test bind-15.14 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.15 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1274,7 +1277,7 @@ test bind-15.15 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.16 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1291,7 +1294,7 @@ test bind-15.16 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.17 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1308,7 +1311,7 @@ test bind-15.17 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.18 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1325,7 +1328,7 @@ test bind-15.18 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.19 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1342,7 +1345,7 @@ test bind-15.19 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.20 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1359,7 +1362,7 @@ test bind-15.20 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.21 {MatchPatterns procedure, checking "nearby"} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1376,7 +1379,7 @@ test bind-15.21 {MatchPatterns procedure, checking "nearby"} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1391,7 +1394,7 @@ test bind-15.22 {MatchPatterns procedure, time wrap-around} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.23 {MatchPatterns procedure, time wrap-around} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1406,7 +1409,7 @@ test bind-15.23 {MatchPatterns procedure, time wrap-around} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.24 {MatchPatterns procedure, virtual event} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1479,7 +1482,7 @@ test bind-15.27 {MatchPatterns procedure, conflict resolution} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1493,7 +1496,7 @@ test bind-15.28 {MatchPatterns procedure, conflict resolution} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {0}
+} -result 0
test bind-15.29 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1525,7 +1528,7 @@ test bind-15.30 {MatchPatterns procedure, conflict resolution} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1539,7 +1542,7 @@ test bind-15.31 {MatchPatterns procedure, conflict resolution} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1553,7 +1556,7 @@ test bind-15.32 {MatchPatterns procedure, conflict resolution} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-15.33 {MatchPatterns procedure, conflict resolution} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1601,7 +1604,7 @@ test bind-16.2 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1234}
+} -result 1234
test bind-16.3 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1628,7 +1631,7 @@ test bind-16.4 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {3}
+} -result 3
test bind-16.5 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1641,7 +1644,7 @@ test bind-16.5 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {47}
+} -result 47
test bind-16.6 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1745,7 +1748,7 @@ test bind-16.13 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.14 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1784,7 +1787,7 @@ test bind-16.16 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {146}
+} -result 146
test bind-16.17 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1850,7 +1853,7 @@ test bind-16.21 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.22 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1863,7 +1866,7 @@ test bind-16.22 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.23 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1876,7 +1879,7 @@ test bind-16.23 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.24 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1916,7 +1919,7 @@ test bind-16.26 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1402}
+} -result 1402
test bind-16.27 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1929,7 +1932,7 @@ test bind-16.27 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1023}
+} -result 1023
test bind-16.28 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -1982,7 +1985,7 @@ test bind-16.31 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {4294}
+} -result 4294
test bind-16.32 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2048,7 +2051,7 @@ test bind-16.35 {ExpandPercents procedure} -constraints {
set x
} -cleanup {
destroy .t.f
-} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \u00e9}
+} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \xE9}
test bind-16.36 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2061,7 +2064,7 @@ test bind-16.36 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {24}
+} -result 24
test bind-16.37 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2074,7 +2077,7 @@ test bind-16.37 {ExpandPercents procedure} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-16.38 {ExpandPercents procedure} -constraints {
nonPortable
} -setup {
@@ -2109,7 +2112,7 @@ test bind-16.39 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {32}
+} -result 32
test bind-16.40 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2135,7 +2138,7 @@ test bind-16.41 {ExpandPercents procedure} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {2}
+} -result 2
test bind-16.42 {ExpandPercents procedure} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2321,7 +2324,7 @@ test bind-17.16 {event command: generate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-17.17 {event command: generate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2463,7 +2466,7 @@ test bind-19.11 {DeleteVirtualEvent procedure: owned by 1, only} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {101}
+} -result 101
test bind-19.12 {DeleteVirtualEvent procedure: owned by 1, first in chain} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2801,7 +2804,7 @@ test bind-22.11 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.12 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2814,7 +2817,7 @@ test bind-22.12 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {4}
+} -result 4
test bind-22.13 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2828,7 +2831,7 @@ test bind-22.13 {HandleEventGenerate} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.14 {HandleEventGenerate} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -2984,7 +2987,7 @@ test bind-22.25 {HandleEventGenerate: options <Configure> -borderwidth 2i} -setu
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.26 {HandleEventGenerate: options <Key> -borderwidth 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3078,7 +3081,7 @@ test bind-22.32 {HandleEventGenerate: options <Expose> -count 20} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {20}
+} -result 20
test bind-22.33 {HandleEventGenerate: options <Key> -count 20} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3186,7 +3189,7 @@ test bind-22.39 {HandleEventGenerate: options <Enter> -focus 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.40 {HandleEventGenerate: options <Key> -focus 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3226,7 +3229,7 @@ test bind-22.42 {HandleEventGenerate: options <Expose> -height 2i} -setup {
expr {$x eq [winfo pixels .t.f 2i]}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.43 {HandleEventGenerate: options <Configure> -height 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3240,7 +3243,7 @@ test bind-22.43 {HandleEventGenerate: options <Configure> -height 2i} -setup {
expr {$x eq [winfo pixels .t.f 2i]}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.44 {HandleEventGenerate: options <Key> -height 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3280,7 +3283,7 @@ test bind-22.46 {HandleEventGenerate: options <Key> -keycode 20} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {20}
+} -result 20
test bind-22.47 {HandleEventGenerate: options <Button> -keycode 20} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3413,7 +3416,7 @@ test bind-22.56 {HandleEventGenerate: options <Map> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.57 {HandleEventGenerate: options <Reparent> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3427,7 +3430,7 @@ test bind-22.57 {HandleEventGenerate: options <Reparent> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.58 {HandleEventGenerate: options <Configure> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3441,7 +3444,7 @@ test bind-22.58 {HandleEventGenerate: options <Configure> -override 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.59 {HandleEventGenerate: options <Key> -override 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3521,7 +3524,7 @@ test bind-22.64 {HandleEventGenerate: options <Key> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.65 {HandleEventGenerate: options <Key> -root xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3548,7 +3551,7 @@ test bind-22.66 {HandleEventGenerate: options <Key> -root [winfo id .t]} -setup
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.67 {HandleEventGenerate: options <Button> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3562,7 +3565,7 @@ test bind-22.67 {HandleEventGenerate: options <Button> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.68 {HandleEventGenerate: options <ButtonRelease> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3576,7 +3579,7 @@ test bind-22.68 {HandleEventGenerate: options <ButtonRelease> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.69 {HandleEventGenerate: options <Motion> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3590,7 +3593,7 @@ test bind-22.69 {HandleEventGenerate: options <Motion> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.70 {HandleEventGenerate: options <<Paste>> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3604,7 +3607,7 @@ test bind-22.70 {HandleEventGenerate: options <<Paste>> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.71 {HandleEventGenerate: options <Enter> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3618,7 +3621,7 @@ test bind-22.71 {HandleEventGenerate: options <Enter> -root .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.72 {HandleEventGenerate: options <Configure> -root .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3658,7 +3661,7 @@ test bind-22.74 {HandleEventGenerate: options <Key> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.75 {HandleEventGenerate: options <Button> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3672,7 +3675,7 @@ test bind-22.75 {HandleEventGenerate: options <Button> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.76 {HandleEventGenerate: options <ButtonRelease> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3686,7 +3689,7 @@ test bind-22.76 {HandleEventGenerate: options <ButtonRelease> -rootx 2i} -setup
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.77 {HandleEventGenerate: options <Motion> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3700,7 +3703,7 @@ test bind-22.77 {HandleEventGenerate: options <Motion> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.78 {HandleEventGenerate: options <<Paste>> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3714,7 +3717,7 @@ test bind-22.78 {HandleEventGenerate: options <<Paste>> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.79 {HandleEventGenerate: options <Enter> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3728,7 +3731,7 @@ test bind-22.79 {HandleEventGenerate: options <Enter> -rootx 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.80 {HandleEventGenerate: options <Configure> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3768,7 +3771,7 @@ test bind-22.82 {HandleEventGenerate: options <Key> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.83 {HandleEventGenerate: options <Button> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3782,7 +3785,7 @@ test bind-22.83 {HandleEventGenerate: options <Button> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.84 {HandleEventGenerate: options <ButtonRelease> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3796,7 +3799,7 @@ test bind-22.84 {HandleEventGenerate: options <ButtonRelease> -rooty 2i} -setup
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.85 {HandleEventGenerate: options <Motion> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3810,7 +3813,7 @@ test bind-22.85 {HandleEventGenerate: options <Motion> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.86 {HandleEventGenerate: options <<Paste>> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3824,7 +3827,7 @@ test bind-22.86 {HandleEventGenerate: options <<Paste>> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.87 {HandleEventGenerate: options <Enter> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3838,7 +3841,7 @@ test bind-22.87 {HandleEventGenerate: options <Enter> -rooty 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.88 {HandleEventGenerate: options <Configure> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3878,7 +3881,7 @@ test bind-22.90 {HandleEventGenerate: options <Key> -sendevent 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.91 {HandleEventGenerate: options <Key> -sendevent yes} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3892,7 +3895,7 @@ test bind-22.91 {HandleEventGenerate: options <Key> -sendevent yes} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.92 {HandleEventGenerate: options <Key> -sendevent 43} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3906,7 +3909,7 @@ test bind-22.92 {HandleEventGenerate: options <Key> -sendevent 43} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.93 {HandleEventGenerate: options <Key> -serial xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3933,7 +3936,7 @@ test bind-22.94 {HandleEventGenerate: options <Key> -serial 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.95 {HandleEventGenerate: options <Key> -state xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3960,7 +3963,7 @@ test bind-22.96 {HandleEventGenerate: options <Key> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.97 {HandleEventGenerate: options <Button> -state 1025} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3974,7 +3977,7 @@ test bind-22.97 {HandleEventGenerate: options <Button> -state 1025} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1025}
+} -result 1025
test bind-22.98 {HandleEventGenerate: options <ButtonRelease> -state 1025} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -3988,7 +3991,7 @@ test bind-22.98 {HandleEventGenerate: options <ButtonRelease> -state 1025} -setu
return $x
} -cleanup {
destroy .t.f
-} -result {1025}
+} -result 1025
test bind-22.99 {HandleEventGenerate: options <Motion> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4002,7 +4005,7 @@ test bind-22.99 {HandleEventGenerate: options <Motion> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.100 {HandleEventGenerate: options <<Paste>> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4016,7 +4019,7 @@ test bind-22.100 {HandleEventGenerate: options <<Paste>> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.101 {HandleEventGenerate: options <Enter> -state 1} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4030,7 +4033,7 @@ test bind-22.101 {HandleEventGenerate: options <Enter> -state 1} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.102 {HandleEventGenerate: options <Visibility> -state xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4097,7 +4100,7 @@ test bind-22.106 {HandleEventGenerate: options <Key> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.107 {HandleEventGenerate: options <Key> -subwindow xyz} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4124,7 +4127,7 @@ test bind-22.108 {HandleEventGenerate: options <Key> -subwindow [winfo id .t]} -
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.109 {HandleEventGenerate: options <Button> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4138,7 +4141,7 @@ test bind-22.109 {HandleEventGenerate: options <Button> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.110 {HandleEventGenerate: options <ButtonRelease> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4152,7 +4155,7 @@ test bind-22.110 {HandleEventGenerate: options <ButtonRelease> -subwindow .t} -s
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.111 {HandleEventGenerate: options <Motion> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4166,7 +4169,7 @@ test bind-22.111 {HandleEventGenerate: options <Motion> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.112 {HandleEventGenerate: options <<Paste>> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4180,7 +4183,7 @@ test bind-22.112 {HandleEventGenerate: options <<Paste>> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.113 {HandleEventGenerate: options <Enter> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4194,7 +4197,7 @@ test bind-22.113 {HandleEventGenerate: options <Enter> -subwindow .t} -setup {
expr {[winfo id .t] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.114 {HandleEventGenerate: options <Configure> -subwindow .t} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4234,7 +4237,7 @@ test bind-22.116 {HandleEventGenerate: options <Key> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.117 {HandleEventGenerate: options <Button> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4248,7 +4251,7 @@ test bind-22.117 {HandleEventGenerate: options <Button> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.118 {HandleEventGenerate: options <ButtonRelease> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4262,7 +4265,7 @@ test bind-22.118 {HandleEventGenerate: options <ButtonRelease> -time 100} -setup
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.119 {HandleEventGenerate: options <Motion> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4276,7 +4279,7 @@ test bind-22.119 {HandleEventGenerate: options <Motion> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.120 {HandleEventGenerate: options <<Paste>> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4290,7 +4293,7 @@ test bind-22.120 {HandleEventGenerate: options <<Paste>> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.121 {HandleEventGenerate: options <Enter> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4304,7 +4307,7 @@ test bind-22.121 {HandleEventGenerate: options <Enter> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.122 {HandleEventGenerate: options <Property> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4318,7 +4321,7 @@ test bind-22.122 {HandleEventGenerate: options <Property> -time 100} -setup {
return $x
} -cleanup {
destroy .t.f
-} -result {100}
+} -result 100
test bind-22.123 {HandleEventGenerate: options <Configure> -time 100} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4358,7 +4361,7 @@ test bind-22.125 {HandleEventGenerate: options <Expose> -width 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.126 {HandleEventGenerate: options <Configure> -width 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4372,7 +4375,7 @@ test bind-22.126 {HandleEventGenerate: options <Configure> -width 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.127 {HandleEventGenerate: options <Key> -width 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4563,7 +4566,7 @@ test bind-22.140 {HandleEventGenerate: options <Key> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.141 {HandleEventGenerate: options <Button> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4577,7 +4580,7 @@ test bind-22.141 {HandleEventGenerate: options <Button> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.142 {HandleEventGenerate: options <ButtonRelease> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4591,7 +4594,7 @@ test bind-22.142 {HandleEventGenerate: options <ButtonRelease> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.143 {HandleEventGenerate: options <Motion> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4605,7 +4608,7 @@ test bind-22.143 {HandleEventGenerate: options <Motion> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.144 {HandleEventGenerate: options <<Paste>> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4619,7 +4622,7 @@ test bind-22.144 {HandleEventGenerate: options <<Paste>> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.145 {HandleEventGenerate: options <Enter> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4633,7 +4636,7 @@ test bind-22.145 {HandleEventGenerate: options <Enter> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.146 {HandleEventGenerate: options <Expose> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4647,7 +4650,7 @@ test bind-22.146 {HandleEventGenerate: options <Expose> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.147 {HandleEventGenerate: options <Configure> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4661,7 +4664,7 @@ test bind-22.147 {HandleEventGenerate: options <Configure> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.148 {HandleEventGenerate: options <Gravity> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4675,7 +4678,7 @@ test bind-22.148 {HandleEventGenerate: options <Gravity> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.149 {HandleEventGenerate: options <Reparent> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4689,7 +4692,7 @@ test bind-22.149 {HandleEventGenerate: options <Reparent> -x 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.150 {HandleEventGenerate: options <Map> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4729,7 +4732,7 @@ test bind-22.152 {HandleEventGenerate: options <Key> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.153 {HandleEventGenerate: options <Button> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4743,7 +4746,7 @@ test bind-22.153 {HandleEventGenerate: options <Button> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.154 {HandleEventGenerate: options <ButtonRelease> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4757,7 +4760,7 @@ test bind-22.154 {HandleEventGenerate: options <ButtonRelease> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.155 {HandleEventGenerate: options <Motion> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4771,7 +4774,7 @@ test bind-22.155 {HandleEventGenerate: options <Motion> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.156 {HandleEventGenerate: options <<Paste>> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4785,7 +4788,7 @@ test bind-22.156 {HandleEventGenerate: options <<Paste>> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.157 {HandleEventGenerate: options <Enter> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4799,7 +4802,7 @@ test bind-22.157 {HandleEventGenerate: options <Enter> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.158 {HandleEventGenerate: options <Expose> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4813,7 +4816,7 @@ test bind-22.158 {HandleEventGenerate: options <Expose> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.159 {HandleEventGenerate: options <Configure> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4827,7 +4830,7 @@ test bind-22.159 {HandleEventGenerate: options <Configure> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.160 {HandleEventGenerate: options <Gravity> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4841,7 +4844,7 @@ test bind-22.160 {HandleEventGenerate: options <Gravity> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.161 {HandleEventGenerate: options <Reparent> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -4855,7 +4858,7 @@ test bind-22.161 {HandleEventGenerate: options <Reparent> -y 2i} -setup {
expr {[winfo pixels .t.f 2i] eq $x}
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-22.162 {HandleEventGenerate: options <Map> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -5541,13 +5544,13 @@ test bind-26.6 {event names: ButtonPress} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <ButtonPress> "set x {event ButtonPress}"
+ bind .t.f <Button> "set x {event Button}"
set x xyzzy
- event generate .t.f <ButtonPress>
+ event generate .t.f <Button>
list $x [bind .t.f]
} -cleanup {
destroy .t.f
-} -result {{event ButtonPress} <Button>}
+} -result {{event Button} <Button>}
test bind-26.7 {event names: ButtonRelease} -setup {
frame .t.f -class Test -width 150 -height 100
@@ -5639,9 +5642,9 @@ test bind-26.13 {event names: KeyPress} -setup {
focus -force .t.f
update
} -body {
- bind .t.f <KeyPress> "set x {event KeyPress}"
+ bind .t.f <Key> "set x {event KeyPress}"
set x xyzzy
- event generate .t.f <KeyPress>
+ event generate .t.f <Key>
list $x [bind .t.f]
} -cleanup {
destroy .t.f
@@ -6017,7 +6020,7 @@ test bind-28.9 {keysym names, Eth -> ETH} -body {
} -cleanup {
destroy .t.f
} -result {<Key-ETH>}
-test bind-28.10 {keysym names, Ooblique -> Oslash} -body {
+test bind-28.10 {keysym names, Ooblique -> Oslash} -constraints nodeprecated -body {
frame .t.f -class Test -width 150 -height 100
bind .t.f <Ooblique> foo
bind .t.f
@@ -6118,7 +6121,7 @@ test bind-30.2 {MouseWheel events} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {120}
+} -result 120
test bind-30.3 {MouseWheel events} -setup {
frame .t.f -class Test -width 150 -height 100
pack .t.f
@@ -6229,6 +6232,8 @@ test bind-31.7 {virtual event user_data field - unshared, asynch} -setup {
} -result {{} {} {TestUserData >b<}}
test bind-32.1 {-warp, window was destroyed before the idle callback DoWarp} -setup {
+ # note: this test is now essentially useless
+ # since DoWarp no longer exist, not even as an idle callback
frame .t.f
pack .t.f
focus -force .t.f
@@ -6414,7 +6419,7 @@ test bind-32.12 {don't detect repetition when window has changed} -setup {
} -cleanup {
destroy .t.f
destroy .t.g
-} -result {1}
+} -result 1
test bind-32.13 {don't detect repetition when window has changed} -setup {
pack [frame .t.f]
pack [frame .t.g]
@@ -6446,7 +6451,7 @@ test bind-32.14 {don't detect repetition when window has changed} -setup {
} -cleanup {
destroy .t.f
destroy .t.g
-} -result {1}
+} -result 1
test bind-32.15 {reset button state when destroying window} -setup {
set x {}
} -body {
@@ -6461,7 +6466,7 @@ test bind-32.15 {reset button state when destroying window} -setup {
event generate .t.f <Button-1>
destroy .t.f
set x
-} -result {1}
+} -result 1
test bind-33.1 {prefer longest match} -setup {
pack [frame .t.f]
@@ -6521,7 +6526,7 @@ test bind-33.4 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {11}
+} -result 11
test bind-33.5 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6535,7 +6540,7 @@ test bind-33.5 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {11}
+} -result 11
test bind-33.6 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6553,7 +6558,7 @@ test bind-33.6 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1111}
+} -result 1111
test bind-33.7 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6567,7 +6572,7 @@ test bind-33.7 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-33.8 {prefer most specific event} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6582,7 +6587,7 @@ test bind-33.8 {prefer most specific event} -setup {
set x
} -cleanup {
destroy .t.f
-} -result {1}
+} -result 1
test bind-33.9 {prefer last in case of homogeneous equal patterns} -setup {
pack [frame .t.f]
focus -force .t.f
@@ -6704,6 +6709,104 @@ test bind-33.15 {prefer last in case of homogeneous equal patterns} -setup {
# because both bindings are homogeneous equal, so the most recently defined
# must be preferred.
} -result {last}
+test bind-33.16 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
+ event generate .t.f <Escape>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control-c>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {Esc_Control-c}
+test bind-33.17 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
+ bind .t.f <Escape><Control_L><Control-c> { lappend x "Esc_Ctrl_L_Control-c" }
+ event generate .t.f <Escape>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control-c>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {Esc_Ctrl_L_Control-c}
+test bind-33.18 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
+ bind .t.f <Escape><Control_L><Control-c> { lappend x "Esc_Ctrl_L_Control-c" }
+ bind .t.f <Escape><Control_L><Control_L><Control-c> { lappend x "Esc_Ctrl_L(2)_Control-c" }
+ event generate .t.f <Escape>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control-c>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {Esc_Ctrl_L(2)_Control-c}
+test bind-33.19 {simulate use of the keyboard to trigger a pattern sequence with modifier - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Escape><Control-c> { lappend x "Esc_Control-c" }
+ bind .t.f <Escape><Key><Key><Control-c> { lappend x "Esc_Key(2)_Control-c" }
+ event generate .t.f <Escape>
+ event generate .t.f <Alt_L>
+ event generate .t.f <Control_L>
+ event generate .t.f <Control-c>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {Esc_Key(2)_Control-c}
+test bind-33.20 {simulate use of the keyboard to trigger a pattern sequence with mixed Key and Button types - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Key-1><Button-1> { lappend x "1_Button1" }
+ event generate .t.f <Key-1>
+ event generate .t.f <KeyRelease-1>
+ event generate .t.f <Button-1>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {1_Button1}
+test bind-33.21 {simulate use of the keyboard to trigger a pattern sequence with mixed Key and Button types - bug [16ef161925]} -setup {
+ pack [frame .t.f]
+ focus -force .t.f
+ update
+ set x {}
+} -body {
+ bind .t.f <Key-1><Button-1> { lappend x "1_Button1" }
+ bind .t.f <Key-1><Button-1><Key-2> { lappend x "1_Button1_2" }
+ event generate .t.f <Key-1>
+ event generate .t.f <KeyRelease-1>
+ event generate .t.f <Button-1>
+ event generate .t.f <Key-2>
+ event generate .t.f <KeyRelease-2>
+ set x
+} -cleanup {
+ destroy .t.f
+} -result {1_Button1 1_Button1_2}
test bind-34.1 {-warp works relatively to a window} -setup {
toplevel .top
@@ -6717,15 +6820,11 @@ test bind-34.1 {-warp works relatively to a window} -setup {
wm geometry .top +200+200
update
event generate .top <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
- set pointerPos1 [winfo pointerxy .t]
+ set pointerPos1 [winfo pointerxy .top]
wm geometry .top +600+600
update
event generate .top <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
- set pointerPos2 [winfo pointerxy .t]
+ set pointerPos2 [winfo pointerxy .top]
# from the first warped position to the second one, the mouse
# pointer should have moved the same amount as the window moved
set res 1
@@ -6737,17 +6836,13 @@ test bind-34.1 {-warp works relatively to a window} -setup {
set res
} -cleanup {
destroy .top
-} -result {1}
+} -result 1
test bind-34.2 {-warp works relatively to the screen} -setup {
} -body {
# Contrary to bind-34.1, we're directly checking screen coordinates
event generate {} <Motion> -x 20 -y 20 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
set res [winfo pointerxy .]
event generate {} <Motion> -x 200 -y 200 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
lappend res {*}[winfo pointerxy .]
} -cleanup {
} -result {20 20 200 200}
@@ -6765,8 +6860,6 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup {
set res {}
} -body {
event generate {} <Motion> -x 0 -y 0 -warp 1
- update idletasks ; # DoWarp is an idle callback
- after 50 ; # Win specific - wait for SendInput to be executed
foreach dim [winfo pointerxy .] {
if {$dim <= $halo} {
lappend res ok
@@ -6775,9 +6868,7 @@ test bind-34.3 {-warp works with null or negative coordinates} -setup {
}
}
event generate {} <Motion> -x 100 -y 100 -warp 1
- update idletasks ; after 50
event generate {} <Motion> -x -1 -y -1 -warp 1
- update idletasks ; after 50
foreach dim [winfo pointerxy .] {
if {$dim <= $halo} {
lappend res ok
@@ -6795,7 +6886,7 @@ proc testKey {window event type mods} {
global keyInfo numericKeysym
set keyInfo {}
set numericKeysym {}
- bind $window <KeyPress> {
+ bind $window <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericKeysym %N
}
@@ -6869,8 +6960,8 @@ test bind-35.1 {Key events agree for entry widgets} -constraints {aqua} -setup {
test bind-35.2 {Can bind to function keys} -constraints {aqua} -body {
global keyInfo numericKeysym
- bind . <KeyPress> {}
- bind . <KeyPress> {
+ bind . <Key> {}
+ bind . <Key> {
lappend keyInfo %K
set numericKeysym %N
}
@@ -6888,7 +6979,7 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -body {
global keyInfo numericalKeysym
set result {}
- bind . <KeyPress> {
+ bind . <Key> {
set keyInfo [format "%K,0x%%X,0x%%X,%A" %N %k]
set numericalKeysym [format "0x%x" %N]
}
@@ -6920,6 +7011,37 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup {
} -cleanup {
} -result pass
+test bind-36.1 {pointer warp with grab on toplevel, bug [e3888d5820]} -setup {
+ event generate {} <Motion> -warp 1 -x 50 -y 50
+ toplevel .top
+ grab release .top
+ wm geometry .top 200x200+300+300
+ label .top.l -height 5 -width 20 -highlightthickness 2 \
+ -highlightbackground black -bg yellow -text "My label"
+ pack .top.l -side bottom
+ update
+ # On KDE/Plasma _with_the_Aurorae_theme_ (at least), setting up the toplevel
+ # and the label will not be finished after the above 'update'. The WM still
+ # needs some time before the window is fully ready. For me 50 ms is enough,
+ # but let's wait more (it depends on computer performance).
+ after 100 ; update
+} -body {
+ grab .top
+ event generate .top.l <Motion> -warp 1 -x 10 -y 10
+ foreach {x1 y1} [winfo pointerxy .top.l] {}
+ event generate {} <Motion> -warp 1 -x 50 -y 50
+ grab release .top
+ event generate .top.l <Motion> -warp 1 -x 10 -y 10
+ foreach {x2 y2} [winfo pointerxy .top.l] {}
+ # success if the coords are the same with or without the grab, and if they
+ # are at (10,10) inside the label widget as requested by the warping
+ expr {$x1==$x2 && $y1==$y2 && $x1==[winfo rootx .top.l]+10 \
+ && $y1==[winfo rooty .top.l]+10}
+} -cleanup {
+ destroy .top
+ unset x1 y1 x2 y2
+} -result 1
+
# cleanup
cleanupTests
return
diff --git a/tests/bitmap.test b/tests/bitmap.test
index 6996f88..6ad0213 100644
--- a/tests/bitmap.test
+++ b/tests/bitmap.test
@@ -2,8 +2,8 @@
# tkBitmap.c. It is organized in the standard white-box fashion for
# Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/border.test b/tests/border.test
index d6ff5c7..f0d0efd 100644
--- a/tests/border.test
+++ b/tests/border.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the procedures in the file
# tkBorder.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/busy.test b/tests/busy.test
index 001bb6c..6c110a9 100644
--- a/tests/busy.test
+++ b/tests/busy.test
@@ -4,9 +4,9 @@
# commands. Sourcing this file runs the tests and generates output for errors.
# No output means no errors were found.
#
-# Copyright (c) 1998-2000 by Jos Decoster. All rights reserved.
+# Copyright © 1998-2000 by Jos Decoster. All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
@@ -17,11 +17,11 @@ namespace import -force tcltest::test
test busy-1.1 {Tk_BusyObjCmd} -returnCodes error -body {
tk busy
-} -result {wrong # args: should be "tk busy options ?arg arg ...?"}
+} -result {wrong # args: should be "tk busy options ?arg ...?"}
test busy-2.1 {tk busy hold} -returnCodes error -body {
tk busy hold
-} -result {wrong # args: should be "tk busy hold window ?option value ...?"}
+} -result {wrong # args: should be "tk busy hold window ?-option value ...?"}
test busy-2.2 {tk busy hold root window} -body {
set res [tk busy hold .]
update
@@ -182,7 +182,7 @@ test busy-3.7 {tk busy cget unix} -setup {
test busy-4.1 {tk busy configure no window} -returnCodes error -body {
tk busy configure
-} -result {wrong # args: should be "tk busy configure window ?option? ?value ...?"}
+} -result {wrong # args: should be "tk busy configure window ?-option value ...?"}
test busy-4.2 {tk busy configure invalid window} -body {
tk busy configure .f
@@ -350,14 +350,14 @@ test busy-6.1 {tk busy status} -returnCodes error -body {
} -result {wrong # args: should be "tk busy status window"}
test busy-6.2 {tk busy status non existing window} -body {
tk busy status .f
-} -result {0}
+} -result 0
test busy-6.3 {tk busy status non busy window} -setup {
pack [frame .f]
} -body {
tk busy status .f
} -cleanup {
destroy .f
-} -result {0}
+} -result 0
test busy-6.4 {tk busy status busy window} -setup {
pack [frame .f]
tk busy hold .f
@@ -367,7 +367,7 @@ test busy-6.4 {tk busy status busy window} -setup {
} -cleanup {
tk busy forget .f
destroy .f
-} -result {1}
+} -result 1
test busy-6.5 {tk busy status forgotten busy window} -setup {
pack [frame .f]
tk busy hold .f
@@ -377,7 +377,7 @@ test busy-6.5 {tk busy status forgotten busy window} -setup {
tk busy status .f
} -cleanup {
destroy .f
-} -result {0}
+} -result 0
test busy-7.1 {tk busy current no busy} -body {
tk busy current
diff --git a/tests/button.test b/tests/button.test
index f3292b31..41cf290 100644
--- a/tests/button.test
+++ b/tests/button.test
@@ -2,9 +2,9 @@
# radiobuttons in Tk (i.e., all the widgets defined in tkButton.c). It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -334,7 +334,7 @@ test button-1.33 {configuration option: "bd" for label} -setup {
.l cget -bd
} -cleanup {
destroy .l
-} -result {4}
+} -result 4
test button-1.34 {configuration option: "bd" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -353,7 +353,7 @@ test button-1.35 {configuration option: "bd" for button} -setup {
.b cget -bd
} -cleanup {
destroy .b
-} -result {4}
+} -result 4
test button-1.36 {configuration option: "bd" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -372,7 +372,7 @@ test button-1.37 {configuration option: "bd" for checkbutton} -setup {
.c cget -bd
} -cleanup {
destroy .c
-} -result {4}
+} -result 4
test button-1.38 {configuration option: "bd" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -391,7 +391,7 @@ test button-1.39 {configuration option: "bd" for radiobutton} -setup {
.r cget -bd
} -cleanup {
destroy .r
-} -result {4}
+} -result 4
test button-1.40 {configuration option: "bd" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1165,7 +1165,7 @@ test button-1.119 {configuration option: "height" for label} -setup {
.l cget -height
} -cleanup {
destroy .l
-} -result {18}
+} -result 18
test button-1.120 {configuration option: "height" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -1184,7 +1184,7 @@ test button-1.121 {configuration option: "height" for button} -setup {
.b cget -height
} -cleanup {
destroy .b
-} -result {18}
+} -result 18
test button-1.122 {configuration option: "height" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -1203,7 +1203,7 @@ test button-1.123 {configuration option: "height" for checkbutton} -setup {
.c cget -height
} -cleanup {
destroy .c
-} -result {18}
+} -result 18
test button-1.124 {configuration option: "height" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -1222,7 +1222,7 @@ test button-1.125 {configuration option: "height" for radiobutton} -setup {
.r cget -height
} -cleanup {
destroy .r
-} -result {18}
+} -result 18
test button-1.126 {configuration option: "height" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1566,7 +1566,7 @@ test button-1.159 {configuration option: "indicatoron" for checkbutton} -setup {
.c cget -indicatoron
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-1.160 {configuration option: "indicatoron" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -1585,7 +1585,7 @@ test button-1.161 {configuration option: "indicatoron" for radiobutton} -setup {
.r cget -indicatoron
} -cleanup {
destroy .r
-} -result {1}
+} -result 1
test button-1.162 {configuration option: "indicatoron" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -1955,7 +1955,7 @@ test button-1.199 {configuration option: "repeatdelay" for button} -setup {
.b cget -repeatdelay
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.200 {configuration option: "repeatdelay" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -1975,7 +1975,7 @@ test button-1.201 {configuration option: "repeatinterval" for button} -setup {
.b cget -repeatinterval
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.202 {configuration option: "repeatinterval" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2405,7 +2405,7 @@ test button-1.243 {configuration option: "underline" for label} -setup {
.l cget -underline
} -cleanup {
destroy .l
-} -result {5}
+} -result 5
test button-1.244 {configuration option: "underline" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2424,7 +2424,7 @@ test button-1.245 {configuration option: "underline" for button} -setup {
.b cget -underline
} -cleanup {
destroy .b
-} -result {5}
+} -result 5
test button-1.246 {configuration option: "underline" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2443,7 +2443,7 @@ test button-1.247 {configuration option: "underline" for checkbutton} -setup {
.c cget -underline
} -cleanup {
destroy .c
-} -result {5}
+} -result 5
test button-1.248 {configuration option: "underline" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2462,7 +2462,7 @@ test button-1.249 {configuration option: "underline" for radiobutton} -setup {
.r cget -underline
} -cleanup {
destroy .r
-} -result {5}
+} -result 5
test button-1.250 {configuration option: "underline" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2514,7 +2514,7 @@ test button-1.254 {configuration option: "width" for label} -setup {
.l cget -width
} -cleanup {
destroy .l
-} -result {402}
+} -result 402
test button-1.255 {configuration option: "width" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2533,7 +2533,7 @@ test button-1.256 {configuration option: "width" for button} -setup {
.b cget -width
} -cleanup {
destroy .b
-} -result {402}
+} -result 402
test button-1.257 {configuration option: "width" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2552,7 +2552,7 @@ test button-1.258 {configuration option: "width" for checkbutton} -setup {
.c cget -width
} -cleanup {
destroy .c
-} -result {402}
+} -result 402
test button-1.259 {configuration option: "width" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2571,7 +2571,7 @@ test button-1.260 {configuration option: "width" for radiobutton} -setup {
.r cget -width
} -cleanup {
destroy .r
-} -result {402}
+} -result 402
test button-1.261 {configuration option: "width" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2591,7 +2591,7 @@ test button-1.262 {configuration option: "wraplength" for label} -setup {
.l cget -wraplength
} -cleanup {
destroy .l
-} -result {100}
+} -result 100
test button-1.263 {configuration option: "wraplength" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .l
@@ -2610,7 +2610,7 @@ test button-1.264 {configuration option: "wraplength" for button} -setup {
.b cget -wraplength
} -cleanup {
destroy .b
-} -result {100}
+} -result 100
test button-1.265 {configuration option: "wraplength" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
@@ -2629,7 +2629,7 @@ test button-1.266 {configuration option: "wraplength" for checkbutton} -setup {
.c cget -wraplength
} -cleanup {
destroy .c
-} -result {100}
+} -result 100
test button-1.267 {configuration option: "wraplength" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
@@ -2648,7 +2648,7 @@ test button-1.268 {configuration option: "wraplength" for radiobutton} -setup {
.r cget -wraplength
} -cleanup {
destroy .r
-} -result {100}
+} -result 100
test button-1.269 {configuration option: "wraplength" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
@@ -2834,13 +2834,13 @@ test button-3.13 {ButtonWidgetCmd procedure, "configure" option} -body {
lindex [.b configure -highlightthickness] 4
} -cleanup {
destroy .b
-} -result {3}
+} -result 3
test button-3.14 {ButtonWidgetCmd procedure, "configure" option} -body {
checkbutton .c
llength [.c configure]
} -cleanup {
destroy .c
-} -result {41}
+} -result 41
test button-3.15 {ButtonWidgetCmd procedure, "configure" option} -body {
button .b
.b configure -gorp
@@ -2889,7 +2889,7 @@ test button-3.21 {ButtonWidgetCmd procedure, "deselect" option} -body {
return $checkvar
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-3.22 {ButtonWidgetCmd procedure, "deselect" option} -body {
radiobutton .r -variable radiovar -value red
set radiovar green
@@ -3249,7 +3249,7 @@ test button-5.4 {ConfigureButton - variable trace} -body { ;# ex 6.2a
return $y
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-5.5 {ConfigureButton - image handling} -constraints {
testImageType
@@ -3282,7 +3282,7 @@ test button-5.7 {ConfigureButton - setting selected state from variable} -body {
return $y
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-5.8 {ConfigureButton - setting selected state from variable} -setup {
unset -nocomplain x
} -body {
@@ -3487,7 +3487,7 @@ test button-5.25 {ConfigureButton - computing geometry} -setup {
expr {$old == $new}
} -cleanup {
destroy .b
-} -result {0}
+} -result 0
test button-6.1 {ButtonEventProc procedure} -body {
button .b -text "Test Button" -command {
@@ -3554,7 +3554,7 @@ test button-8.3 {TkInvokeButton procedure} -setup {
} -cleanup {
destroy .c
trace vdelete x w bogusTrace
-} -result {1}
+} -result 1
test button-8.4 {TkInvokeButton procedure} -setup {
set x 1
} -body {
@@ -3575,7 +3575,7 @@ test button-8.5 {TkInvokeButton procedure} -setup {
} -cleanup {
destroy .c
trace vdelete x w bogusTrace
-} -result {0}
+} -result 0
test button-8.6 {TkInvokeButton procedure} -setup {
set x 0
@@ -3665,7 +3665,7 @@ test button-9.2 {ButtonVarProc procedure} -body {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.3 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3675,7 +3675,7 @@ test button-9.3 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.4 {ButtonVarProc procedure} -setup {
set x 0
} -body {
@@ -3685,7 +3685,7 @@ test button-9.4 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-9.5 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3695,7 +3695,7 @@ test button-9.5 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {0}
+} -result 0
test button-9.6 {ButtonVarProc procedure} -setup {
set x 0
} -body {
@@ -3705,7 +3705,7 @@ test button-9.6 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.7 {ButtonVarProc procedure} -setup {
set x 1
} -body {
@@ -3715,7 +3715,7 @@ test button-9.7 {ButtonVarProc procedure} -setup {
return $x
} -cleanup {
destroy .c
-} -result {1}
+} -result 1
test button-9.8 {ButtonVarProc procedure, can't read variable} -setup {
# This test does nothing but produce a core dump if there's a prbblem.
unset -nocomplain a
@@ -3751,7 +3751,7 @@ test button-10.2 {ButtonTextVarProc procedure} -setup {
expr {$old == $new}
} -cleanup {
destroy .b
-} -result {0}
+} -result 0
test button-11.1 {ButtonImageProc procedure} -constraints {
testImageType
@@ -3780,7 +3780,7 @@ test button-12.1 {button widget vs hidden commands} -body {
expr {$res1 == $res2}
} -cleanup {
destroy .b
-} -result {1}
+} -result 1
test button-13.1 {size behavior: label} -setup {
label .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
diff --git a/tests/canvImg.test b/tests/canvImg.test
index d6ed9a8..0e4acd7 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -2,9 +2,9 @@
# which implement canvas "image" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -174,7 +174,7 @@ test canvImg-4.2 {ConfigureImage procedure} -constraints testImageType -setup {
while {"timed out" ni $y && [lindex $y end 1] ne "display"} {
vwait y
}
- after cancel timer
+ after cancel $timer
list $x $y [.c bbox i1]
} -cleanup {
.c delete all
@@ -727,12 +727,6 @@ test canvImg-9.1 {DisplayImage procedure} -constraints testImageType -setup {
image delete foo
} -result {75 150 105 165}
-if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
- # Aqua >= 10.14 will redraw the entire image.
- set result_10_1 {{foo display 0 0 30 15}}
-} else {
- set result_10_1 {{foo display 2 4 6 8}}
-}
test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
.c delete all
update
@@ -745,12 +739,11 @@ test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
foo changed 2 4 6 8 30 15
vwait x
after cancel $timer
- update
return $x
} -cleanup {
.c delete all
image delete foo
-} -result $result_10_1
+} -result {{foo display 2 4 6 8}}
test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
.c delete all
@@ -762,7 +755,7 @@ test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
set x {}
set timer [after 500 {lappend x "timed out"}]
foo changed 2 4 6 8 40 50
- vwait x
+ vwait x
after cancel $timer
update
return $x
@@ -785,17 +778,12 @@ test canvImg-11.2 {ImageChangedProc procedure} -constraints {
.c delete all
image delete foo
} -result {30 75 70 125}
-if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
- # Aqua >= 10.14 will redraw the entire image.
- set result_11_3 {{foo2 display 0 0 80 60}}
-} else {
- set result_11_3 {{foo2 display 0 0 20 40}}
-}
+
test canvImg-11.3 {ImageChangedProc procedure} -constraints {
testImageType
} -setup {
.c delete all
- update
+ update idletasks
} -body {
image create test foo -variable x
image create test foo2 -variable z
@@ -803,17 +791,16 @@ test canvImg-11.3 {ImageChangedProc procedure} -constraints {
foo2 changed 0 0 0 0 80 60
.c create image 50 100 -image foo -tags image -anchor nw
.c create image 70 110 -image foo2 -anchor nw
- update idletasks
set z {}
set timer [after 500 {lappend z "timed out"}]
- image create test foo -variable x
- vwait x
+ image delete foo
+ vwait z
after cancel $timer
return $z
} -cleanup {
.c delete all
- image delete foo foo2
-} -result $result_11_3
+ image delete foo2
+} -result {{foo2 display 0 0 80 60}}
# cleanup
imageFinish
diff --git a/tests/canvMoveto.test b/tests/canvMoveto.test
index 60eb6f3..0344db7 100644
--- a/tests/canvMoveto.test
+++ b/tests/canvMoveto.test
@@ -1,12 +1,12 @@
# This file is a Tcl script to test out the canvas "moveto" command. It is
# derived from canvRect.test.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2004 Neil McKay.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 2004 Neil McKay.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/canvPs.test b/tests/canvPs.test
index eb09af9..1c90b12 100644
--- a/tests/canvPs.test
+++ b/tests/canvPs.test
@@ -2,8 +2,8 @@
# for canvases to files and channels. It exercises the procedure
# TkCanvPostscriptCmd in generic/tkCanvPs.c
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -158,7 +158,7 @@ test canvPs-3.1 {test ps generation with an embedded window} -constraints {
destroy .c
imageCleanup
removeFile bar.ps
-} -result {1}
+} -result 1
test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
set bar [makeFile {} bar.ps]
file delete $bar
@@ -172,7 +172,7 @@ test canvPs-3.2 {test ps generation with an embedded window not mapped} -setup {
} -cleanup {
destroy .c
removeFile bar.ps
-} -result {1}
+} -result 1
test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} -body {
diff --git a/tests/canvRect.test b/tests/canvRect.test
index ec59e8b..0b59230 100644
--- a/tests/canvRect.test
+++ b/tests/canvRect.test
@@ -2,8 +2,8 @@
# which implement canvas "rectangle" and "oval" items. It is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvText.test b/tests/canvText.test
index 20cbff4..d68e60f 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -2,8 +2,8 @@
# which implement canvas "text" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,6 +11,9 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# Canvas used in 1.* - 17.* tests
canvas .c -width 400 -height 300 -bd 2 -relief sunken
pack .c
@@ -250,7 +253,7 @@ test canvText-4.6 {ConfigureText procedure: adjust cursor} -setup {
.c index test insert
} -cleanup {
.c delete test
-} -result {4}
+} -result 4
test canvText-5.1 {ConfigureText procedure: adjust cursor} -body {
@@ -573,7 +576,7 @@ test canvText-8.8 {TextInsert procedure: inserting before cursor} -setup {
.c icursor test 3
.c insert test 2 "xyz"
.c index test insert
-} -result {6}
+} -result 6
test canvText-8.9 {TextInsert procedure: inserting after cursor} -setup {
.c create text 20 20 -tag test
focus .c
@@ -583,7 +586,7 @@ test canvText-8.9 {TextInsert procedure: inserting after cursor} -setup {
.c icursor test 3
.c insert test 4 "xyz"
.c index test insert
-} -result {3}
+} -result 3
# Item used in 9.* tests
.c create text 20 20 -tag test
@@ -673,19 +676,19 @@ test canvText-9.13 {TextInsert procedure: move cursor} -body {
.c icursor test 6
.c dchars test 2 4
.c index test insert
-} -result {3}
+} -result 3
test canvText-9.14 {TextInsert procedure: keep cursor >= first} -body {
.c itemconfig test -text "abcdefghijk"
.c icursor test 6
.c dchars test 2 10
.c index test insert
-} -result {2}
+} -result 2
test canvText-9.15 {TextInsert procedure: cursor doesn't move} -body {
.c itemconfig test -text "abcdefghijk"
.c icursor test 5
.c dchars test 7 9
.c index test insert
-} -result {5}
+} -result 5
.c delete test
@@ -695,7 +698,7 @@ test canvText-10.1 {TextToPoint procedure} -body {
.c index test @0,0
} -cleanup {
.c delete test
-} -result {0}
+} -result 0
test canvText-11.1 {TextToArea procedure} -setup {
@@ -834,7 +837,7 @@ test canvText-15.1 {SetTextCursor procedure} -setup {
.c index test insert
} -cleanup {
.c delete test
-} -result {3}
+} -result 3
test canvText-16.1 {GetSelText procedure} -setup {
.c create text 0 0 -tag test
@@ -940,7 +943,7 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup
destroy .c
} -result {{Yeah } Yeah- 4 4}
-test canvText-20.1 {angled text bounding box} -setup {
+test canvText-20.1 {angled text bounding box} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
destroy .c
canvas .c
proc transpose {bbox} {
diff --git a/tests/canvWind.test b/tests/canvWind.test
index 436ee2c..2d7a470 100644
--- a/tests/canvWind.test
+++ b/tests/canvWind.test
@@ -2,8 +2,8 @@
# which implement canvas "window" items. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/canvas.test b/tests/canvas.test
index 5086389..5e4f851 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -2,12 +2,12 @@
# implements generic code for canvases. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 Ajuba Solutions.
-# Copyright (c) 2008 Donal K. Fellows
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 2008 Donal K. Fellows
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
imageInit
@@ -37,14 +37,14 @@ test canvas-1.4 {configuration options: bad value for "bg"} -body {
test canvas-1.5 {configuration options: good value for "bd"} -body {
.c configure -bd 4
.c cget -bd
-} -result {4}
+} -result 4
test canvas-1.6 {configuration options: bad value for "bd"} -body {
.c configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test canvas-1.7 {configuration options: good value for "borderwidth"} -body {
.c configure -borderwidth 1.3
.c cget -borderwidth
-} -result {1}
+} -result 1
test canvas-1.8 {configuration options: bad value for "borderwidth"} -body {
.c configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -58,7 +58,7 @@ test canvas-1.10 {configuration options: bad value for "closeenough"} -body {
test canvas-1.11 {configuration options: good value for "confine"} -body {
.c configure -confine true
.c cget -confine
-} -result {1}
+} -result 1
test canvas-1.12 {configuration options: bad value for "confine"} -body {
.c configure -confine silly
} -returnCodes error -result {expected boolean value but got "silly"}
@@ -72,7 +72,7 @@ test canvas-1.14 {configuration options: bad value for "cursor"} -body {
test canvas-1.15 {configuration options: good value for "height"} -body {
.c configure -height 2.1
.c cget -height
-} -result {2}
+} -result 2
test canvas-1.16 {configuration options: bad value for "height"} -body {
.c configure -height x42
} -returnCodes error -result {bad screen distance "x42"}
@@ -93,7 +93,7 @@ test canvas-1.20 {configuration options: bad value for "highlightcolor"} -body {
test canvas-1.21 {configuration options: good value for "highlightthickness"} -body {
.c configure -highlightthickness 18
.c cget -highlightthickness
-} -result {18}
+} -result 18
test canvas-1.22 {configuration options: bad value for "highlightthickness"} -body {
.c configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -107,28 +107,28 @@ test canvas-1.24 {configuration options: bad value for "insertbackground"} -body
test canvas-1.25 {configuration options: good value for "insertborderwidth"} -body {
.c configure -insertborderwidth 1.3
.c cget -insertborderwidth
-} -result {1}
+} -result 1
test canvas-1.26 {configuration options: bad value for "insertborderwidth"} -body {
.c configure -insertborderwidth 2.6x
} -returnCodes error -result {bad screen distance "2.6x"}
test canvas-1.27 {configuration options: good value for "insertofftime"} -body {
.c configure -insertofftime 100
.c cget -insertofftime
-} -result {100}
+} -result 100
test canvas-1.28 {configuration options: bad value for "insertofftime"} -body {
.c configure -insertofftime 3.2
} -returnCodes error -result {expected integer but got "3.2"}
test canvas-1.29 {configuration options: good value for "insertontime"} -body {
.c configure -insertontime 100
.c cget -insertontime
-} -result {100}
+} -result 100
test canvas-1.30 {configuration options: bad value for "insertontime"} -body {
.c configure -insertontime 3.2
} -returnCodes error -result {expected integer but got "3.2"}
test canvas-1.31 {configuration options: good value for "insertwidth"} -body {
.c configure -insertwidth 1.3
.c cget -insertwidth
-} -result {1}
+} -result 1
test canvas-1.32 {configuration options: bad value for "insertwidth"} -body {
.c configure -insertwidth 6x
} -returnCodes error -result {bad screen distance "6x"}
@@ -149,7 +149,7 @@ test canvas-1.36 {configuration options: bad value for "selectbackground"} -body
test canvas-1.37 {configuration options: good value for "selectborderwidth"} -body {
.c configure -selectborderwidth 1.3
.c cget -selectborderwidth
-} -result {1}
+} -result 1
test canvas-1.38 {configuration options: bad value for "selectborderwidth"} -body {
.c configure -selectborderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -167,7 +167,7 @@ test canvas-1.41 {configuration options: good value for "takefocus"} -body {
test canvas-1.42 {configuration options: good value for "width"} -body {
.c configure -width 402
.c cget -width
-} -result {402}
+} -result 402
test canvas-1.43 {configuration options: bad value for "width"} -body {
.c configure -width xyz
} -returnCodes error -result {bad screen distance "xyz"}
@@ -354,6 +354,22 @@ test canvas-8.1 {canvas arc bbox} -setup {
set arcSegBox [.c bbox arc4]
list $arcBox $coordBox $pieBox $arcSegBox
} -result {{48 21 100 94} {248 21 300 94} {398 21 500 112} {98 171 302 202}}
+test canvas-8.2 {canvas very small arc} -setup {
+ catch {destroy .c}
+ canvas .c
+} -body {
+ # no Inf or NaN must be generated even for very small arcs
+ .c create arc 0 100 0 100 -height 100 -style arc -outline "" -tags arc1
+ set arcBox [.c bbox arc1]
+ .c create arc 0 100 0 100 -height 100 -style arc -outline blue -tags arc2
+ set outlinedArcBox [.c bbox arc2]
+ set coords [.c coords arc1]
+ set start [.c itemcget arc1 -start]
+ set extent [.c itemcget arc1 -extent]
+ set width [.c itemcget arc1 -width]
+ set height [.c itemcget arc1 -height]
+ list $arcBox $outlinedArcBox $coords $start $extent $width $height
+} -result {{-1 99 1 101} {-2 98 2 102} {0.0 100.0 0.0 100.0} 0.0 0.0 1.0 0.0}
test canvas-9.1 {canvas id creation and deletion} -setup {
catch {destroy .c}
@@ -741,7 +757,7 @@ test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setu
} -body {
set id [.c create rect 0 0 1cm 1cm]
expr {[lindex [.c coords $id] 2]>1}
-} -result {1}
+} -result 1
destroy .c
test canvas-16.1 {arc coords check} -setup {
@@ -1004,112 +1020,6 @@ test canvas-20.3 {tag deletion - all tags match} -setup {
destroy .c
} -result {{tagA tagA tagA tagA tagA tagA} {}}
-# Procedure used in test cases 20.1 20.2 20.3
-proc matchPixels {pixels expected} {
- set matched 1
- foreach pline $pixels eline $expected {
- foreach ppixel $pline epixel $eline {
- if {$ppixel != $epixel} {
- set matched 0
- break
- }
- }
- }
- return $matched
-}
-
-test canvas-20.1 {canvas image} -setup {
- canvas .c
- image create photo testimage
-} -body {
- .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
- .c create rectangle 0 0 0 9 -fill #000080 -outline #000080
- .c image testimage
- matchPixels [testimage data] { \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
-} -cleanup {
- destroy .c
- image delete testimage
-} -result 1
-
-test canvas-20.2 {canvas image with subsample} -setup {
- canvas .c
- image create photo testimage
-} -body {
- .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
- .c create rectangle 0 0 1 9 -fill #008000 -outline #008000
- .c image testimage 2
- matchPixels [testimage data] { \
- {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
-} -cleanup {
- destroy .c
- image delete testimage
-} -result 1
-
-test canvas-20.3 {canvas image with subsample and zoom} -setup {
- canvas .c
- image create photo testimage
-} -body {
- .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
- .c create rectangle 0 0 9 0 -fill #800000 -outline #800000
- .c image testimage 1 2
- matchPixels [testimage data] { \
- {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
- {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
- {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
-} -cleanup {
- destroy .c
- image delete testimage
-} -result 1
-
-test canvas-21.1 {canvas very small arc} -setup {
- catch {destroy .c}
- canvas .c
-} -body {
- # no Inf or NaN must be generated even for very small arcs
- .c create arc 0 100 0 100 -height 100 -style arc -outline "" -tags arc1
- set arcBox [.c bbox arc1]
- .c create arc 0 100 0 100 -height 100 -style arc -outline blue -tags arc2
- set outlinedArcBox [.c bbox arc2]
- set coords [.c coords arc1]
- set start [.c itemcget arc1 -start]
- set extent [.c itemcget arc1 -extent]
- set width [.c itemcget arc1 -width]
- set height [.c itemcget arc1 -height]
- list $arcBox $outlinedArcBox $coords $start $extent $width $height
-} -result {{-1 99 1 101} {-2 98 2 102} {0.0 100.0 0.0 100.0} 0.0 0.0 1.0 0.0}
-
-
destroy .c
test canvas-21.1 {canvas rotate} -setup {
pack [canvas .c]
@@ -1292,7 +1202,95 @@ test canvas-22.9 {canvas rotate: window item rotation behaviour} -setup {
} -cleanup {
destroy .c
} -result {{50.00 150.00} {} {25 125 50 150}}
-
+
+# Procedure used in test cases 23.1 23.2 23.3
+proc matchPixels {pixels expected} {
+ set matched 1
+ foreach pline $pixels eline $expected {
+ foreach ppixel $pline epixel $eline {
+ if {$ppixel != $epixel} {
+ set matched 0
+ break
+ }
+ }
+ }
+ return $matched
+}
+
+test canvas-23.1 {canvas image} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 0 9 -fill #000080 -outline #000080
+ .c image testimage
+ matchPixels [testimage data] { \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
+test canvas-23.2 {canvas image with subsample} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 1 9 -fill #008000 -outline #008000
+ .c image testimage 2
+ matchPixels [testimage data] { \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
+test canvas-23.3 {canvas image with subsample and zoom} -setup {
+ canvas .c
+ image create photo testimage
+} -body {
+ .c configure -background #c0c0c0 -scrollregion {0 0 9 9}
+ .c create rectangle 0 0 9 0 -fill #800000 -outline #800000
+ .c image testimage 1 2
+ matchPixels [testimage data] { \
+ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
+ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \
+ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}}
+} -cleanup {
+ destroy .c
+ image delete testimage
+} -result 1
+
# cleanup
imageCleanup
cleanupTests
diff --git a/tests/choosedir.test b/tests/choosedir.test
index c6cc632..b90cea8 100644
--- a/tests/choosedir.test
+++ b/tests/choosedir.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_chooseDir" and
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/clipboard.test b/tests/clipboard.test
index 81534d5..1b6b4ca 100644
--- a/tests/clipboard.test
+++ b/tests/clipboard.test
@@ -2,8 +2,8 @@
# especially the "clipboard" command. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
@@ -21,6 +21,8 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# set up a very large buffer to test INCR retrievals
set longValue ""
foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} {
@@ -233,7 +235,7 @@ test clipboard-6.1 {Tk_ClipboardAppend procedure} -setup {
} -cleanup {
clipboard clear
} -returnCodes ok -result {first chunk second chunk}
-test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints x11 -setup {
+test clipboard-6.2 {Tk_ClipboardAppend procedure} -constraints {x11 failsOnXQuarz} -setup {
clipboard clear
} -body {
setupbg
diff --git a/tests/clrpick.test b/tests/clrpick.test
index 0900962..1aeb18b 100644
--- a/tests/clrpick.test
+++ b/tests/clrpick.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_chooseColor" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/cmds.test b/tests/cmds.test
index caf5afe..88cf0c0 100644
--- a/tests/cmds.test
+++ b/tests/cmds.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the procedures in the file
# tkCmds.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/color.test b/tests/color.test
index 4cdaf23..fa43765 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -1,11 +1,11 @@
# This file is a Tcl script to test out the procedures in the file
# tkColor.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995-1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -162,7 +162,7 @@ test color-1.4 {Tk_AllocColorFromObj - try other colors in list} colorsFree {
test color-1.5 {Color table} nonPortable {
set fd [open ../xlib/rgb.txt]
set result {}
- while {[gets $fd line] != -1} {
+ while {[gets $fd line] >= 0} {
if {[string index $line 0] == "!"} continue
set rgb [c255 [winfo rgb . [lrange $line 3 end]]]
if {$rgb != [lrange $line 0 2] } {
diff --git a/tests/config.test b/tests/config.test
index 9fd048a..2128020 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -2,8 +2,8 @@
# which comprise the new new option configuration system. It is
# organized in the standard "white-box" fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -235,7 +235,7 @@ test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup {
.foo cget -boolean
} -cleanup {
killTables
-} -returnCodes ok -result {0}
+} -returnCodes ok -result 0
test config-4.3 {DoObjConfig - boolean} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -259,7 +259,7 @@ test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup {
.foo cget -boolean
} -cleanup {
killTables
-} -returnCodes ok -result {1}
+} -returnCodes ok -result 1
test config-4.6 {DoObjConfig - boolean} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -287,7 +287,7 @@ test config-4.8 {DoObjConfig - boolean internal value} -constraints {
.foo cget -boolean
} -cleanup {
killTables
-} -result {0}
+} -result 0
test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup {
catch {rename .foo {}}
@@ -303,7 +303,7 @@ test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup {
.foo cget -integer
} -cleanup {
killTables
-} -returnCodes ok -result {3}
+} -returnCodes ok -result 3
test config-4.11 {DoObjConfig - integer} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -333,7 +333,7 @@ test config-4.13 {DoObjConfig - integer internal value} -constraints {
.foo cget -integer
} -cleanup {
killTables
-} -result {421}
+} -result 421
test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup {
catch {rename .foo {}}
@@ -472,7 +472,7 @@ test config-4.30 {DoObjConfig - new string table} -constraints {
.foo configure -stringtable three
} -cleanup {
killTables
-} -returnCodes ok -result {16}
+} -returnCodes ok -result 16
test config-4.31 {DoObjConfig - new string table} -constraints {
testobjconfig
} -body {
@@ -564,7 +564,7 @@ test config-4.42 {DoObjConfig - getting rid of old color} -constraints {
.foo configure -color #444444
} -cleanup {
killTables
-} -returnCodes ok -result {32}
+} -returnCodes ok -result 32
test config-4.43 {DoObjConfig - getting rid of old color} -constraints {
testobjconfig
} -body {
@@ -607,7 +607,7 @@ test config-4.47 {DoObjConfig - new font} -constraints testobjconfig -setup {
.foo configure -font {Helvetica 72}
} -cleanup {
killTables
-} -returnCodes ok -result {64}
+} -returnCodes ok -result 64
test config-4.48 {DoObjConfig - new font} -constraints testobjconfig -setup {
catch {rename .foo {}}
} -body {
@@ -668,7 +668,7 @@ test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body {
.foo configure -bitmap gray50
} -cleanup {
killTables
-} -returnCodes ok -result {128}
+} -returnCodes ok -result 128
test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body {
testobjconfig alltypes .foo -bitmap gray75
.foo configure -bitmap gray50
@@ -751,7 +751,7 @@ test config-4.67 {DoObjConfig - getting rid of old border} -constraints {
.foo configure -border #444444
} -cleanup {
killTables
-} -returnCodes ok -result {256}
+} -returnCodes ok -result 256
test config-4.68 {DoObjConfig - getting rid of old border} -constraints {
testobjconfig
} -body {
@@ -793,7 +793,7 @@ test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body {
.foo configure -relief flat
} -cleanup {
killTables
-} -returnCodes ok -result {512}
+} -returnCodes ok -result 512
test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body {
testobjconfig alltypes .foo -relief raised
.foo configure -relief flat
@@ -838,7 +838,7 @@ test config-4.80 {DoObjConfig - new cursor} -constraints testobjconfig -body {
.foo configure -cursor arrow
} -cleanup {
killTables
-} -returnCodes ok -result {1024}
+} -returnCodes ok -result 1024
test config-4.81 {DoObjConfig - new cursor} -constraints testobjconfig -body {
testobjconfig alltypes .foo -cursor xterm
.foo configure -cursor arrow
@@ -878,7 +878,7 @@ test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body {
.foo configure -justify right
} -cleanup {
killTables
-} -returnCodes ok -result {2048}
+} -returnCodes ok -result 2048
test config-4.87 {DoObjConfig - new justify} -constraints testobjconfig -body {
testobjconfig alltypes .foo -justify left
.foo configure -justify right
@@ -918,7 +918,7 @@ test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body {
.foo configure -anchor n
} -cleanup {
killTables
-} -returnCodes ok -result {4096}
+} -returnCodes ok -result 4096
test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body {
testobjconfig alltypes .foo -anchor e
.foo configure -anchor n
@@ -946,7 +946,7 @@ test config-4.96 {DoObjConfig - pixel} -constraints testobjconfig -body {
.foo cget -pixel
} -cleanup {
killTables
-} -returnCodes ok -result {42}
+} -returnCodes ok -result 42
test config-4.97 {DoObjConfig - invalid pixel} -constraints testobjconfig -body {
testobjconfig alltypes .foo -pixel foo
} -cleanup {
@@ -957,7 +957,7 @@ test config-4.98 {DoObjConfig - new pixel} -constraints testobjconfig -body {
.foo configure -pixel 3c
} -cleanup {
killTables
-} -returnCodes ok -result {8192}
+} -returnCodes ok -result 8192
test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body {
testobjconfig alltypes .foo -pixel 42m
.foo configure -pixel 3c
@@ -976,7 +976,7 @@ test config-4.100 {DoObjConfig - pixel internal value} -constraints {
expr {$screenW eq $result}
} -cleanup {
killTables
-} -result {1}
+} -result 1
test config-4.101 {DoObjConfig - window} -constraints testobjconfig -body {
toplevel .bar
@@ -1017,7 +1017,7 @@ test config-4.106 {DoObjConfig - new window} -constraints testobjconfig -body {
.foo configure -window .blamph
} -cleanup {
killTables
-} -returnCodes ok -result {0}
+} -returnCodes ok -result 0
test config-4.107 {DoObjConfig - new window} -constraints testobjconfig -body {
toplevel .bar
toplevel .blamph
@@ -1258,7 +1258,7 @@ test config-7.11 {Tk_SetOptions - synonym name in error message} -constraints {
".a configure -synonym bogus"}
test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body {
format %x [.a configure -color red -int 7 -relief raised -double 3.14159]
-} -result {226}
+} -result 226
test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints {
testobjconfig
} -body {
@@ -1304,7 +1304,7 @@ test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints {
.a csave -color green -color black -color blue -color #ffff00 -color #ff00ff
} -cleanup {
killTables
-} -result {32}
+} -result 32
test config-8.4 {Tk_RestoreSavedOptions - boolean internal form} -constraints {
testobjconfig
} -body {
@@ -1321,7 +1321,7 @@ test config-8.5 {Tk_RestoreSavedOptions - boolean internal form} -constraints {
.a cget -boolean
} -cleanup {
killTables
-} -result {1}
+} -result 1
test config-8.6 {Tk_RestoreSavedOptions - integer internal form} -constraints {
testobjconfig
} -body {
@@ -1338,7 +1338,7 @@ test config-8.7 {Tk_RestoreSavedOptions - integer internal form} -constraints {
.a cget -integer
} -cleanup {
killTables
-} -result {148962237}
+} -result 148962237
test config-8.8 {Tk_RestoreSavedOptions - double internal form} -constraints {
testobjconfig
} -body {
@@ -1620,11 +1620,11 @@ if {[testConstraint testobjconfig]} {
test config-12.1 {GetObjectForOption - boolean} -constraints testobjconfig -body {
.a configure -boolean 0
.a cget -boolean
-} -result {0}
+} -result 0
test config-12.2 {GetObjectForOption - integer} -constraints testobjconfig -body {
.a configure -integer 1247
.a cget -integer
-} -result {1247}
+} -result 1247
test config-12.3 {GetObjectForOption - double} -constraints testobjconfig -body {
.a configure -double -88.82
.a cget -double
@@ -1680,7 +1680,7 @@ test config-12.13 {GetObjectForOption - anchor} -constraints testobjconfig -body
test config-12.14 {GetObjectForOption - pixels} -constraints testobjconfig -body {
.a configure -pixel 193.2
.a cget -pixel
-} -result {193}
+} -result 193
test config-12.15 {GetObjectForOption - window} -constraints testobjconfig -body {
.a configure -window .a
.a cget -window
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index c77fb00..ee073cf 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -5,7 +5,7 @@ if {[namespace exists tk::test]} {
return
}
-package require Tk 8.4
+package require Tk
tk appname tktest
wm title . tktest
# If the main window isn't already mapped (e.g. because the tests are
@@ -17,7 +17,7 @@ if {![winfo ismapped .]} {
update
}
-package require tcltest 2.1
+package require tcltest 2.2
namespace eval tk {
namespace eval test {
@@ -37,7 +37,7 @@ namespace eval tk {
namespace eval bg {
# Manage a background process.
- # Replace with slave interp or thread?
+ # Replace with child interp or thread?
namespace import ::tcltest::interpreter
namespace import ::tk::test::loadTkCommand
namespace export setup cleanup do
@@ -197,8 +197,8 @@ testConstraint noExceed [expr {
}]
# constraints for testing facilities defined in the tktest executable...
-testConstraint testImageType [expr {[lsearch [image types] test] >= 0}]
-testConstraint testOldImageType [expr {[lsearch [image types] oldtest] >= 0}]
+testConstraint testImageType [expr {"test" in [image types]}]
+testConstraint testOldImageType [expr {"oldtest" in [image types]}]
testConstraint testbitmap [llength [info commands testbitmap]]
testConstraint testborder [llength [info commands testborder]]
testConstraint testcbind [llength [info commands testcbind]]
@@ -247,10 +247,10 @@ testConstraint pseudocolor8 [expr {
}]
destroy .t
testConstraint haveTruecolor24 [expr {
- [lsearch -exact [winfo visualsavailable .] {truecolor 24}] >= 0
+ {truecolor 24} in [winfo visualsavailable .]
}]
testConstraint haveGrayscale8 [expr {
- [lsearch -exact [winfo visualsavailable .] {grayscale 8}] >= 0
+ {grayscale 8} in [winfo visualsavailable .]
}]
testConstraint defaultPseudocolor8 [expr {
([winfo visual .] eq "pseudocolor") && ([winfo depth .] == 8)
diff --git a/tests/cursor.test b/tests/cursor.test
index 8d7ebb0..eb4f168 100644
--- a/tests/cursor.test
+++ b/tests/cursor.test
@@ -2,8 +2,8 @@
# tkCursor.c. It is organized in the standard white-box fashion for
# Tcl tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/dialog.test b/tests/dialog.test
index 2d88103..692d928 100644
--- a/tests/dialog.test
+++ b/tests/dialog.test
@@ -36,7 +36,7 @@ test dialog-2.1 {tk_dialog operation} -setup {
return $res
} -cleanup {
destroy .d
-} -result {0}
+} -result 0
test dialog-2.2 {tk_dialog operation} -setup {
proc HitReturn {w} {
event generate $w <Enter>
@@ -51,7 +51,7 @@ test dialog-2.2 {tk_dialog operation} -setup {
return $res
} -cleanup {
destroy .d
-} -result {1}
+} -result 1
test dialog-2.3 {tk_dialog operation} -body {
set x [after 5000 [list set tk::Priv(button) "no response"]]
after 100 destroy .d
@@ -60,7 +60,7 @@ test dialog-2.3 {tk_dialog operation} -body {
return $res
} -cleanup {
destroy .b
-} -result {-1}
+} -result -1
cleanupTests
return
diff --git a/tests/embed.test b/tests/embed.test
index 1fe73ef..ed1abdd 100644
--- a/tests/embed.test
+++ b/tests/embed.test
@@ -1,7 +1,7 @@
# This file is a Tcl script to test out embedded Windows.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/entry.test b/tests/entry.test
index b92c894..cb6dda4 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,7 +11,12 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# For xscrollcommand
+set scrollInfo {}
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -69,7 +74,7 @@ test entry-1.3 {configuration option: "bd" for entry} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-1.4 {configuration option: "bd" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -109,7 +114,7 @@ test entry-1.7 {configuration option: "borderwidth" for entry} -setup {
.e cget -borderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-1.8 {configuration option: "borderwidth" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -189,7 +194,7 @@ test entry-1.15 {configuration option: "exportselection" for entry} -setup {
.e cget -exportselection
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-1.16 {configuration option: "exportselection" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -309,7 +314,7 @@ test entry-1.27 {configuration option: "highlightthickness" for entry} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test entry-1.28 {configuration option: "highlightthickness" for entry} -setup {
entry .e -borderwidth 2 -font {Helvetica -12 bold}
pack .e
@@ -319,7 +324,7 @@ test entry-1.28 {configuration option: "highlightthickness" for entry} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-1.29 {configuration option: "highlightthickness" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -359,7 +364,7 @@ test entry-1.32 {configuration option: "insertborderwidth" for entry} -setup {
.e cget -insertborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-1.33 {configuration option: "insertborderwidth" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -379,7 +384,7 @@ test entry-1.34 {configuration option: "insertofftime" for entry} -setup {
.e cget -insertofftime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test entry-1.35 {configuration option: "insertofftime" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -399,7 +404,7 @@ test entry-1.36 {configuration option: "insertontime" for entry} -setup {
.e cget -insertontime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test entry-1.37 {configuration option: "insertontime" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -512,7 +517,7 @@ test entry-1.47 {configuration option: "selectborderwidth" for entry} -setup {
.e cget -selectborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-1.48 {configuration option: "selectborderwidth" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -605,7 +610,7 @@ test entry-1.56 {configuration option: "width" for entry} -setup {
.e cget -width
} -cleanup {
destroy .e
-} -result {402}
+} -result 402
test entry-1.57 {configuration option: "width" for entry} -setup {
entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .e
@@ -748,7 +753,7 @@ test entry-3.7 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
update
} -body {
# Tcl_UtfAtIndex(): utf at end
- .e insert 0 "ab\u4e4e"
+ .e insert 0 "ab乎"
.e bbox end
} -cleanup {
destroy .e
@@ -761,7 +766,7 @@ test entry-3.8 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
update
} -body {
# Tcl_UtfAtIndex(): utf before index
- .e insert 0 "ab\u4e4ec"
+ .e insert 0 "ab乎c"
.e bbox 3
} -cleanup {
destroy .e
@@ -783,7 +788,7 @@ test entry-3.10 {EntryWidgetCmd procedure, "bbox" widget command} -constraints {
pack .e
update
} -body {
- .e insert 0 "abcdefghij\u4e4eklmnop"
+ .e insert 0 "abcdefghij乎klmnop"
list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end]
} -cleanup {
destroy .e
@@ -816,7 +821,7 @@ test entry-3.14 {EntryWidgetCmd procedure, "cget" widget command} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup {
entry .e
pack .e
@@ -825,7 +830,7 @@ test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup {
llength [.e configure]
} -cleanup {
destroy .e
-} -result {38}
+} -result 38
test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup {
entry .e
} -body {
@@ -841,7 +846,7 @@ test entry-3.17 {EntryWidgetCmd procedure, "configure" widget command} -setup {
lindex [.e configure -bd] 4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-3.18 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
} -body {
@@ -880,7 +885,7 @@ test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {014567890}
+} -result 014567890
test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
} -body {
@@ -889,7 +894,7 @@ test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {0123457890}
+} -result 0123457890
test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e
@@ -897,20 +902,20 @@ test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup {
set x {}
} -body {
# UTF
- .e insert end "01234\u4e4e67890"
+ .e insert end "01234乎67890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "012345\u4e4e7890"
+ .e insert end "012345乎7890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "0123456\u4e4e890"
+ .e insert end "0123456乎890"
.e delete 6
lappend x [.e get]
} -cleanup {
destroy .e
-} -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"]
+} -result [list "01234乎7890" "0123457890" "012345乎890"]
test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e
@@ -921,7 +926,7 @@ test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e
@@ -934,7 +939,7 @@ test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup {
entry .e
pack .e
@@ -947,7 +952,7 @@ test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test entry-3.27 {EntryWidgetCmd procedure, "get" widget command} -setup {
entry .e
} -body {
@@ -977,7 +982,7 @@ test entry-3.30 {EntryWidgetCmd procedure, "icursor" widget command} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-3.31 {EntryWidgetCmd procedure, "index" widget command} -setup {
entry .e
} -body {
@@ -1014,7 +1019,7 @@ test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -setup {
update
} -body {
# UTF
- .e insert 0 abc\u4e4e\u0153def
+ .e insert 0 abc乎œdef
list [.e index 3] [.e index 4] [.e index end]
} -cleanup {
destroy .e
@@ -1063,7 +1068,7 @@ test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup {
entry .e
pack .e
@@ -1076,7 +1081,7 @@ test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} -setup {
entry .e
} -body {
@@ -1136,7 +1141,7 @@ test entry-3.46 {EntryWidgetCmd procedure, "scan" widget command} -constraints {
.e index @0
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test entry-3.47 {EntryWidgetCmd procedure, "select" widget command} -setup {
entry .e
} -body {
@@ -1205,7 +1210,7 @@ test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} -
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -setup {
entry .e
pack .e
@@ -1218,7 +1223,7 @@ test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -setup {
entry .e
pack .e
@@ -1231,7 +1236,7 @@ test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -
.e selection present
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-3.55 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup {
entry .e
} -body {
@@ -1259,7 +1264,7 @@ test entry-3.57 {EntryWidgetCmd procedure, "selection adjust" widget command} -s
selection get
} -cleanup {
destroy .e
-} -result {123}
+} -result 123
test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -setup {
entry .e
pack .e
@@ -1273,7 +1278,7 @@ test entry-3.58 {EntryWidgetCmd procedure, "selection adjust" widget command} -s
selection get
} -cleanup {
destroy .e
-} -result {234}
+} -result 234
test entry-3.59 {EntryWidgetCmd procedure, "selection from" widget command} -setup {
entry .e
} -body {
@@ -1446,7 +1451,7 @@ test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll gorp units
} -cleanup {
destroy .e
-} -returnCodes error -result {expected integer but got "gorp"}
+} -returnCodes error -result {expected floating-point number but got "gorp"}
test entry-3.73 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1487,7 +1492,7 @@ test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {32}
+} -result 32
test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1501,7 +1506,7 @@ test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {29}
+} -result 29
test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1533,11 +1538,11 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e insert end "runs off the end of the window quite a bit."
.e xview 0
update
- .e xview -4
+ .e xview -1
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1549,14 +1554,14 @@ test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {73}
+} -result 73
test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup {
entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
} -body {
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
- .e insert 10 \u4e4e
+ .e insert 10 乎
update
# UTF
# If Tcl_NumUtfChars wasn't used, wrong answer would be:
@@ -1600,7 +1605,7 @@ test entry-5.1 {ConfigureEntry procedure, -textvariable} -body {
.e get
} -cleanup {
destroy .e
-} -result {12345}
+} -result 12345
test entry-5.2 {ConfigureEntry procedure, -textvariable} -body {
set x 12345
entry .e -textvariable x
@@ -1617,7 +1622,7 @@ test entry-5.3 {ConfigureEntry procedure, -textvariable} -setup {
} -body {
.e insert 0 "Some text"
.e configure -textvariable x
- return $x
+ set x
} -cleanup {
destroy .e
} -result {Some text}
@@ -1652,7 +1657,7 @@ test entry-5.5 {ConfigureEntry procedure} -setup {
lappend x [selection get]
.e1 configure -exportselection 1
lappend x [selection get]
- return $x
+ set x
} -cleanup {
destroy .e1 .e2
} -result {{This is so} {This is so} 1234}
@@ -1688,9 +1693,10 @@ test entry-5.7 {ConfigureEntry procedure} -setup {
} -body {
.e configure -font {Courier -12} -width 4 -xscrollcommand scroll
.e insert end "01234567890"
- set timeout [after 500 {set $scrollInfo "timeout"}]
- vwait scrollInfo
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e configure -width 5
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
@@ -1699,7 +1705,7 @@ test entry-5.7 {ConfigureEntry procedure} -setup {
test entry-5.8 {ConfigureEntry procedure} -constraints {
- fonts
+ fonts failsOnXQuarz
} -setup {
entry .e -borderwidth 2 -highlightthickness 2
pack .e
@@ -1806,7 +1812,7 @@ test entry-6.4 {EntryComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test entry-6.5 {EntryComputeGeometry procedure} -setup {
entry .e -highlightthickness 2
pack .e
@@ -1818,7 +1824,7 @@ test entry-6.5 {EntryComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test entry-6.6 {EntryComputeGeometry procedure} -constraints {
fonts
} -setup {
@@ -1933,9 +1939,9 @@ test entry-7.1 {InsertChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e insert 2 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -1950,9 +1956,9 @@ test entry-7.2 {InsertChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e insert 500 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2026,7 +2032,7 @@ test entry-7.7 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test entry-7.8 {InsertChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2037,7 +2043,7 @@ test entry-7.8 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-7.9 {InsertChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2049,7 +2055,7 @@ test entry-7.9 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test entry-7.10 {InsertChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2061,7 +2067,7 @@ test entry-7.10 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-7.11 {InsertChars procedure} -constraints {
fonts
@@ -2075,7 +2081,7 @@ test entry-7.11 {InsertChars procedure} -constraints {
winfo reqwidth .e
} -cleanup {
destroy .e
-} -result {59}
+} -result 59
test entry-8.1 {DeleteChars procedure} -setup {
unset -nocomplain contents
@@ -2084,9 +2090,9 @@ test entry-8.1 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e delete 2 4
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2100,9 +2106,9 @@ test entry-8.2 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
- .e delete -2 2
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ .e delete -1 2
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2116,9 +2122,9 @@ test entry-8.3 {DeleteChars procedure} -setup {
focus .e
} -body {
.e configure -textvariable contents -xscrollcommand scroll
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcde
.e delete 3 1000
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2260,7 +2266,7 @@ test entry-8.12 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-8.13 {DeleteChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2273,7 +2279,7 @@ test entry-8.13 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-8.14 {DeleteChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2286,7 +2292,7 @@ test entry-8.14 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-8.15 {DeleteChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2299,7 +2305,7 @@ test entry-8.15 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-8.16 {DeleteChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2312,7 +2318,7 @@ test entry-8.16 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-8.17 {DeleteChars procedure} -setup {
entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2325,8 +2331,8 @@ test entry-8.17 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
-test entry-8.18 {DeleteChars procedure} -setup {
+} -result 4
+test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup {
entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
focus .e
@@ -2347,7 +2353,7 @@ test entry-8.18 {DeleteChars procedure} -setup {
} -cleanup {
destroy .e
unset XPAD expected
-} -result {1}
+} -result 1
test entry-9.1 {EntryValueChanged procedure} -setup {
unset -nocomplain x
@@ -2428,7 +2434,7 @@ test entry-10.5 {EntrySetValue procedure, updating display position} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-10.6 {EntrySetValue procedure, updating display position} -setup {
unset -nocomplain x
entry .e -highlightthickness 2 -bd 2
@@ -2444,7 +2450,7 @@ test entry-10.6 {EntrySetValue procedure, updating display position} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {10}
+} -result 10
test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
entry .e -highlightthickness 2 -bd 2
@@ -2459,7 +2465,7 @@ test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {3}
+} -result 3
test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
entry .e -highlightthickness 2 -bd 2
@@ -2473,7 +2479,7 @@ test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test entry-11.1 {EntryEventProc procedure} -setup {
entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12}
@@ -2517,7 +2523,7 @@ test entry-13.1 {GetEntryIndex procedure} -setup {
.e index end
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
test entry-13.2 {GetEntryIndex procedure} -body {
entry .e
.e index abogus
@@ -2536,7 +2542,7 @@ test entry-13.3 {GetEntryIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-13.4 {GetEntryIndex procedure} -setup {
entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2549,7 +2555,7 @@ test entry-13.4 {GetEntryIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-13.5 {GetEntryIndex procedure} -setup {
entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2563,7 +2569,7 @@ test entry-13.5 {GetEntryIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {15}
+} -result 15
test entry-13.6 {GetEntryIndex procedure} -setup {
entry .e
} -body {
@@ -2582,7 +2588,7 @@ test entry-13.7 {GetEntryIndex procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test entry-13.8 {GetEntryIndex procedure} -setup {
entry .e
} -body {
@@ -2647,7 +2653,7 @@ test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body {
.e index sel.first
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body {
# Previous settings:
@@ -2761,7 +2767,7 @@ test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body {
.e index @4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2772,7 +2778,7 @@ test entry-13.17 {GetEntryIndex procedure} -constraints fonts -body {
.e index @11
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2783,7 +2789,7 @@ test entry-13.18 {GetEntryIndex procedure} -constraints fonts -body {
.e index @12
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2794,7 +2800,7 @@ test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 6}]
} -cleanup {
destroy .e
-} -result {8}
+} -result 8
test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2805,7 +2811,7 @@ test entry-13.20 {GetEntryIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 5}]
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test entry-13.21 {GetEntryIndex procedure} -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2816,7 +2822,7 @@ test entry-13.21 {GetEntryIndex procedure} -body {
.e index @1000
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test entry-13.22 {GetEntryIndex procedure} -setup {
entry .e
pack .e
@@ -2833,10 +2839,10 @@ test entry-13.23 {GetEntryIndex procedure} -body {
.e insert 0 012345678901234567890
.e xview 4
update
- .e index -10
+ .e index -1
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-13.24 {GetEntryIndex procedure} -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2847,7 +2853,7 @@ test entry-13.24 {GetEntryIndex procedure} -body {
.e index 12
} -cleanup {
destroy .e
-} -result {12}
+} -result 12
test entry-13.25 {GetEntryIndex procedure} -body {
entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\
-font {Courier -12}
@@ -2858,7 +2864,7 @@ test entry-13.25 {GetEntryIndex procedure} -body {
.e index 49
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
test entry-13.26 {GetEntryIndex procedure} -constraints fonts -body {
entry .e -highlightthickness 2 -bd 2 -font {Helvetica -12}
selection clear .e
@@ -2905,7 +2911,7 @@ test entry-14.3 {EntryFetchSelection procedure} -setup {
string compare [selection get] $x
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-15.1 {EntryLostSelection} -body {
entry .e
@@ -2964,9 +2970,10 @@ test entry-16.4 {EntryVisibleRange procedure} -body {
test entry-17.1 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 0 end
.e insert 0 123
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -2976,9 +2983,9 @@ test entry-17.1 {EntryUpdateScrollbar procedure} -body {
test entry-17.2 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 0123456789abcdef
.e xview 3
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -2988,9 +2995,9 @@ test entry-17.2 {EntryUpdateScrollbar procedure} -body {
test entry-17.3 {EntryUpdateScrollbar procedure} -body {
entry .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcdefghijklmnopqrs
.e xview 6
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3003,8 +3010,10 @@ test entry-17.4 {EntryUpdateScrollbar procedure} -setup {
set x $msg
}
} -body {
- entry .e -width 5 -xscrollcommand thisisnotacommand
+ entry .e -width 5
pack .e
+ update idletasks
+ .e configure -xscrollcommand thisisnotacommand
vwait x
list $x $errorInfo
} -cleanup {
@@ -3025,7 +3034,7 @@ test entry-18.1 {Entry widget vs hiding} -setup {
set res1 [list [winfo children .] [interp hidden]]
set res2 [list {} $l]
expr {$res1 == $res2}
-} -result {1}
+} -result 1
##
## Entry widget VALIDATION tests
@@ -3047,7 +3056,7 @@ test entry-19.1 {entry widget validation} -setup {
-background red -foreground white
pack .e
.e insert 0 a
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 1 0 a {} a all key}
@@ -3079,7 +3088,7 @@ test entry-19.3 {entry widget validation} -setup {
pack .e
.e insert 0 ab ;# previous settings
.e insert end c
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 1 2 abc ab c all key}
@@ -3111,7 +3120,7 @@ test entry-19.5 {entry widget validation} -setup {
pack .e
.e insert 0 a123bc ;# previous settings
.e delete 2
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 0 2 a13bc a123bc 2 all key}
@@ -3128,7 +3137,7 @@ test entry-19.6 {entry widget validation} -setup {
.e insert 0 a13bc ;# previous settings
.e configure -validate key
.e delete 1 3
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e 0 1 abc a13bc 13 key key}
@@ -3145,7 +3154,7 @@ test entry-19.7 {entry widget validation} -setup {
.e insert end abc ;# previous settings
set ::vVals {}
.e insert end d
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3164,7 +3173,7 @@ test entry-19.8 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusin}
@@ -3185,7 +3194,7 @@ test entry-19.9 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focus focusout}
@@ -3203,7 +3212,7 @@ test entry-19.10 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusin}
@@ -3224,7 +3233,7 @@ test entry-19.11 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} all focusout}
@@ -3242,7 +3251,7 @@ test entry-19.12 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusin focusin}
@@ -3261,7 +3270,7 @@ test entry-19.13 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3280,7 +3289,7 @@ test entry-19.14 {entry widget validation} -setup {
focus -force .e
# update necessary to process FocusIn event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {}
@@ -3302,7 +3311,7 @@ test entry-19.15 {entry widget validation} -setup {
focus -force .
# update necessary to process FocusOut event
update
- return $::vVals
+ set ::vVals
} -cleanup {
destroy .e
} -result {.e -1 -1 abcd abcd {} focusout focusout}
@@ -3385,7 +3394,7 @@ test entry-19.19 {entry widget validation} -setup {
list [.e cget -validate] [.e get] $::vVals
} -cleanup {
destroy .e
-} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
@@ -3411,6 +3420,26 @@ test entry-19.20 {entry widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+test entry-19.21 {entry widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ entry .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##
@@ -3424,7 +3453,7 @@ test entry-20.1 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.2 {widget deletion while active} -body {
entry .e -validate all \
@@ -3434,7 +3463,7 @@ test entry-20.2 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.3 {widget deletion while active} -body {
entry .e -validate all \
@@ -3443,7 +3472,7 @@ test entry-20.3 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.4 {widget deletion while active} -body {
entry .e -validate all \
@@ -3453,7 +3482,7 @@ test entry-20.4 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.5 {widget deletion while active} -body {
entry .e -validatecommand { destroy .e ; return 0 }
@@ -3461,7 +3490,7 @@ test entry-20.5 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.6 {widget deletion while active} -body {
pack [entry .e]
@@ -3471,7 +3500,7 @@ test entry-20.6 {widget deletion while active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-20.7 {widget deletion with textvariable active} -body {
# SF bugs 607390 and 617446
@@ -3483,7 +3512,7 @@ test entry-20.7 {widget deletion with textvariable active} -body {
winfo exists .e
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test entry-21.1 {selection present while disabled, bug 637828} -body {
diff --git a/tests/event.test b/tests/event.test
index 2e53196..68cbe9d 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in tkEvent.c. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/filebox.test b/tests/filebox.test
index ee00160..c6cc69b 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -2,11 +2,11 @@
# "tk_getSaveFile" commands. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/focus.test b/tests/focus.test
index 7da289d..626576d 100644
--- a/tests/focus.test
+++ b/tests/focus.test
@@ -2,8 +2,8 @@
# other procedures in the file tkFocus.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,6 +11,9 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
proc focusSetup {} {
destroy .t
toplevel .t
@@ -308,7 +311,7 @@ in .t.b1 NotifyNonlinear
} .t.b1}
test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints {
- unix testwrapper
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
focus .t.b1
focus .
@@ -320,7 +323,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints {
list $x $focusInfo
} -result {.t.b1 {press .t.b1 x}}
test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
- unix testwrapper
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
set result {}
foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear
@@ -341,7 +344,7 @@ test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
focus
} -result {.t.b1}
test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} -constraints {
- unix testwrapper
+ unix testwrapper failsOnUbuntu failsOnXQuarz
} -body {
focus .t.b1
event gen [testwrapper .] <FocusOut> -detail NotifyAncestor
@@ -599,7 +602,7 @@ cleanupbg
# Test 5.1 fails (before and after update)
test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constraints {
- unix testwrapper secureserver
+ unix testwrapper secureserver failsOnUbuntu failsOnXQuarz
} -body {
setupbg
focusSetup
diff --git a/tests/focusTcl.test b/tests/focusTcl.test
index 0e457a6..e1a36a3 100644
--- a/tests/focusTcl.test
+++ b/tests/focusTcl.test
@@ -3,8 +3,8 @@
# tk_focusPrev, among other things. This file is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/font.test b/tests/font.test
index 9f279dd..e58de1e 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -2,8 +2,8 @@
# plus the procedures in tkFont.c. It is organized in the
# standard white-box fashion for Tcl tests.
#
-# Copyright (c) 1996-1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -14,6 +14,8 @@ tcltest::loadTestedCommands
# Some tests require support for 4-byte UTF-8 sequences
testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}]
testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
set defaultfontlist [font names]
@@ -61,9 +63,9 @@ test font-1.1 {TkFontPkgInit} -setup {
} -body {
interp create foo
foo eval {
- load {} Tk
- wm geometry . +0+0
- update
+ load {} Tk
+ wm geometry . +0+0
+ update
}
interp delete foo
} -result {}
@@ -77,25 +79,25 @@ test font-2.1 {TkFontPkgFree} -setup {
# Makes sure that named font was visible only to child interp.
foo eval {
- load {} Tk
- wm geometry . +0+0
- button .b -font {times 16} -text "hi"
- pack .b
- font create wiggles -family courier -underline 1
- update
+ load {} Tk
+ wm geometry . +0+0
+ button .b -font {times 16} -text "hi"
+ pack .b
+ font create wiggles -family courier -underline 1
+ update
}
lappend x [catch {font configure wiggles} msg; set msg]
# Tests cancelling the idle handler for TheWorldHasChanged,
# because app goes away before idle serviced.
foo eval {
- .b config -font wiggles
- font config wiggles -size 24
- destroy .
+ .b config -font wiggles
+ font config wiggles -size 24
+ destroy .
}
lappend x [foo eval {catch {font families} msg; set msg}]
} -cleanup {
- interp delete foo
+ interp delete foo
} -result {{named font "wiggles" doesn't exist} {can't invoke "font" command: application has been destroyed}}
@@ -114,21 +116,21 @@ test font-4.1 {font command: actual: arguments} -body {
test font-4.2 {font command: actual: arguments} -body {
# (objc < 3)
font actual
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.3 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 0
font actual xyz abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.4 {font command: actual: displayof specified, so skip to next} -body {
catch {font actual xyz -displayof . -size}
-} -result {0}
+} -result 0
test font-4.5 {font command: actual: displayof specified, so skip to next} -body {
lindex [font actual xyz -displayof .] 0
} -result {-family}
test font-4.6 {font command: actual: arguments} -body {
# (objc - skip > 4) when skip == 2
font actual xyz -displayof . abc def
-} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"}
+} -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"}
test font-4.7 {font command: actual: arguments} -constraints noExceed -body {
# (tkfont == NULL)
font actual "\{xyz"
@@ -137,7 +139,7 @@ test font-4.8 {font command: actual: all attributes} -body {
# not (objc > 3) so objPtr = NULL
lindex [font actual {-family times}] 0
} -result {-family}
-test font-4.9 {font command: actual} -constraints {unix noExceed} -body {
+test font-4.9 {font command: actual} -constraints {unix noExceed failsOnUbuntu} -body {
# (objc > 3) so objPtr = objv[3 + skip]
string tolower [font actual {-family times} -family]
} -result {times}
@@ -149,16 +151,16 @@ test font-4.11 {font command: bad option} -body {
font actual xyz -style
} -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike}
test font-4.12 {font command: actual} -body {
- font actual {-family times} -- \ud800
+ font actual {-family times} -- \uD800
} -match glob -result {*}
test font-4.13 {font command: actual} -body {
- font actual {-family times} -- \udc00
+ font actual {-family times} -- \uDC00
} -match glob -result {*}
test font-4.14 {font command: actual} -constraints {utfcompat win} -body {
font actual {-family times} -family -- \uD800\uDC00
} -result {times}
test font-4.15 {font command: actual} -body {
- font actual {-family times} -- \udc00\ud800
+ font actual {-family times} -- \uDC00\uD800
} -returnCodes 1 -match glob -result {expected a single character but got "*"}
test font-4.16 {font command: actual} -constraints {fullutf win} -body {
font actual {-family times} -family -- \U10000
@@ -194,7 +196,7 @@ test font-5.4 {font command: configure: get all options} -setup {
font create xyz -family xyz
lindex [font configure xyz] 1
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.5 {font command: configure: get one option} -setup {
clearnondefaultfonts
@@ -202,9 +204,9 @@ test font-5.5 {font command: configure: get one option} -setup {
# (objc == 4) so objPtr = objv[3]
font create xyz -family xyz
font configure xyz -family
- getnondefaultfonts
+ getnondefaultfonts
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.6 {font command: configure: update existing font} -setup {
catch {font delete xyz}
@@ -215,7 +217,7 @@ test font-5.6 {font command: configure: update existing font} -setup {
update
font configure xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result xyz
test font-5.7 {font command: configure: bad option} -setup {
catch {font delete xyz}
@@ -223,7 +225,7 @@ test font-5.7 {font command: configure: bad option} -setup {
font create xyz
font configure xyz -style
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike}
@@ -243,7 +245,7 @@ test font-6.2 {font command: create: name specified} -setup {
font create xyz
getnondefaultfonts
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
test font-6.3 {font command: create: name not really specified} -setup {
clearnondefaultfonts
@@ -285,7 +287,7 @@ test font-6.7 {font command: create: already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-7.1 {font command: delete: arguments} -body {
@@ -294,7 +296,7 @@ test font-7.1 {font command: delete: arguments} -body {
} -returnCodes error -result {wrong # args: should be "font delete fontname ?fontname ...?"}
test font-7.2 {font command: delete: loop test} -setup {
clearnondefaultfonts
- set x {}
+ set x {}
} -body {
# for (i = 2; i < objc; i++)
font create a -underline 1
@@ -310,7 +312,7 @@ test font-7.2 {font command: delete: loop test} -setup {
} -result {{a b c d e} d}
test font-7.3 {font command: delete: loop test} -setup {
clearnondefaultfonts
- set x {}
+ set x {}
} -body {
# (namedHashPtr == NULL) in middle of loop
font create a -underline 1
@@ -343,7 +345,7 @@ test font-7.5 {font command: delete: mark for later deletion} -setup {
font actual xyz
font configure xyz
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -returnCodes error -result {named font "xyz" doesn't exist}
test font-7.6 {font command: delete: mark for later deletion} -setup {
destroy .t.f
@@ -357,7 +359,7 @@ test font-7.6 {font command: delete: mark for later deletion} -setup {
font delete xyz
font actual xyz
catch {font configure xyz}
- .t.f cget -font
+ .t.f cget -font
} -cleanup {
destroy .t.f
} -result xyz
@@ -383,7 +385,7 @@ test font-8.3 {font command: families: arguments} -body {
# (objc - skip != 2) when skip == 2
font families -displayof . xyz
} -returnCodes error -result {wrong # args: should be "font families ?-displayof window?"}
-test font-8.4 {font command: families} -body {
+test font-8.4 {font command: families} -constraints failsOnUbuntu -body {
# TkpGetFontFamilies()
regexp -nocase times [font families]
} -result 1
@@ -430,11 +432,11 @@ test font-10.2 {font command: metrics: arguments} -body {
test font-10.3 {font command: metrics: arguments} -body {
# (objc < 3)
font metrics
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.4 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 0
font metrics xyz abc def
-} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"}
+} -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?-option?"}
test font-10.5 {font command: metrics: arguments} -body {
# (objc - skip) > 4) when skip == 2
font metrics xyz -displayof . abc
@@ -515,7 +517,7 @@ test font-12.1 {UpdateDependantFonts procedure: no users} -setup {
font create xyz
font configure xyz -family times
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {}
test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
destroy .t.f
@@ -534,21 +536,21 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
set b2 [winfo reqwidth .t.f]
expr {$a1==$b1 && $a2==$b2}
} -cleanup {
- destroy .t.f
+ destroy .t.f
font delete xyz
-} -result {1}
+} -result 1
test font-13.1 {CreateNamedFont: new named font} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
# not (new == 0)
lappend x [getnondefaultfonts]
font create xyz
lappend x [getnondefaultfonts]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {{} xyz}
test font-13.2 {CreateNamedFont: named font already exists} -setup {
catch {font delete xyz}
@@ -557,7 +559,7 @@ test font-13.2 {CreateNamedFont: named font already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-13.3 {CreateNamedFont: named font already exists} -setup {
catch {font delete xyz}
@@ -566,7 +568,7 @@ test font-13.3 {CreateNamedFont: named font already exists} -setup {
font create xyz
font create xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes error -result {named font "xyz" already exists}
test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup {
destroy .t.f
@@ -581,8 +583,8 @@ test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup {
font create xyz -family courier
font configure xyz -family
} -cleanup {
- font delete xyz
- destroy .t.f
+ font delete xyz
+ destroy .t.f
} -result {courier}
@@ -591,7 +593,7 @@ test font-14.1 {Tk_GetFont procedure} -body {
test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
} -body {
@@ -604,7 +606,7 @@ test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints {
destroy .b1 .b2
} -result {{1 0}}
test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
set result {}
@@ -619,7 +621,7 @@ test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints {
destroy .b2
} -result {{} {{1 1}}}
test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints {
- testfont
+ testfont
} -setup {
destroy .b1 .b2
set result {}
@@ -642,7 +644,7 @@ test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup {
.t.f config -font {-family fixed}
lindex [font actual {-family fixed}] 0
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family}
test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup {
destroy .t.f
@@ -654,7 +656,7 @@ test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup {
font create xyz
.t.f config -font xyz
} -cleanup {
- destroy .t.f
+ destroy .t.f
font delete xyz
} -result {}
test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup {
@@ -665,7 +667,7 @@ test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup {
# not (namedHashPtr != NULL)
.t.f config -font {times 20}
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family} -result {}
test font-15.7 {Tk_AllocFontFromObj procedure: get native font} -constraints {
unix
@@ -709,7 +711,7 @@ test font-15.11 {Tk_AllocFontFromObj procedure: get attribute font} -body {
lindex [font actual {plan 9}] 0
} -result {-family}
test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup {
- destroy .l
+ destroy .l
} -body {
# Tk_MeasureChars(fontPtr, "0", ...)
label .l -bd 0 -padx 0 -highlightthickness 0 -font $fixed -text "a\tb"
@@ -718,7 +720,7 @@ test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup {
set res2 [expr [font measure $fixed "0"]*9]
expr {$res1 eq $res2}
} -cleanup {
- destroy .l
+ destroy .l
} -result 1
test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup {
destroy .t.f
@@ -729,7 +731,7 @@ test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup {
.t.f config -text "underline" -font "times -8 underline"
update
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
@@ -741,7 +743,7 @@ test font-16.1 {Tk_NameOfFont procedure} -setup {
.t.f config -font -family\ fixed
.t.f cget -font
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {-family fixed}
@@ -927,7 +929,7 @@ test font-21.5 {Tk_PostscriptFontName procedure: spaces} -constraints {
}
} -result {LucidaBright}
test font-21.6 {Tk_PostscriptFontName procedure: spaces} -constraints {
- x11
+ x11 failsOnUbuntu
} -body {
psfontname "{new century schoolbook} 10"
} -result {NewCenturySchlbk-Roman}
@@ -1449,20 +1451,20 @@ test font-21.66 {Tk_PostscriptFontName procedure: exhaustive} -constraints {
test font-22.1 {Tk_TextWidth procedure} -setup {
- destroy .t.l
+ destroy .t.l
} -body {
- label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
- -text "0" -font "Courier -12"
- pack .t.l
- set ax [winfo reqwidth .t.l]
+ label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \
+ -text "0" -font "Courier -12"
+ pack .t.l
+ set ax [winfo reqwidth .t.l]
expr {[font measure [.t.l cget -font] "000"] eq $ax*3}
} -cleanup {
- destroy .t.l
+ destroy .t.l
} -result 1
test font-23.1 {Tk_UnderlineChars procedure} -setup {
- destroy .t.t
+ destroy .t.t
} -body {
text .t.t
.t.t insert 1.0 abc\tdefg
@@ -1470,7 +1472,7 @@ test font-23.1 {Tk_UnderlineChars procedure} -setup {
.t.t tag add sel 1.0 end
update
} -cleanup {
- destroy .t.t
+ destroy .t.t
} -result {}
@@ -1487,27 +1489,27 @@ test font-24.1 {Tk_ComputeTextLayout: empty string} -body {
} -result {}
test font-24.2 {Tk_ComputeTextLayout: simple string} -body {
.t.l config -text "000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq $ay}]
} -result {1 1}
test font-24.3 {Tk_ComputeTextLayout: find special chars} -body {
.t.l config -text "000\n000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.4 {Tk_ComputeTextLayout: calls Tk_MeasureChars} -body {
.t.l config -text "000\n000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.5 {Tk_ComputeTextLayout: break line} -body {
.t.l config -text "000\t00000" -wrap [expr 9 * $ax]
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -cleanup {
.t.l config -wrap 0
} -result {1 1}
@@ -1516,26 +1518,26 @@ test font-24.6 {Tk_ComputeTextLayout: normal ended on special char} -body {
} -result {}
test font-24.7 {Tk_ComputeTextLayout: special char was \n} -body {
.t.l config -text "000\n0000"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
} -result {1 1}
test font-24.8 {Tk_ComputeTextLayout: special char was \t} -body {
.t.l config -text "000\t00"
- update
- list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \
- [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \
+ [expr {[winfo reqheight .t.l] eq $ay}]
} -result {1 1}
test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body {
set x {}
.t.l config -text "000\t000"
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
.t.l config -text "000\t000" -wrap [expr 100 * $ax]
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1543,13 +1545,13 @@ test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body {
test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body {
set x {}
.t.l config -text "000\t"
- update
+ update
lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
.t.l config -text "000\t00" -wrap [expr $ax * 6]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1557,13 +1559,13 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body {
test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body {
set x {}
.t.l config -text "000 000" -wrap [expr {$ax * 5}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
.t.l config -text "000 "
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
return $x
} -cleanup {
.t.l config -wrap 0
@@ -1571,44 +1573,44 @@ test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body {
test font-24.12 {Tk_ComputeTextLayout: append non-printing spaces to chunk} -body {
set x {}
.t.l config -text "000 0000" -wrap [expr {$ax * 5}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
.t.l config -text "000\t00 0000" -wrap [expr {$ax * 12}]
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
return $x
} -cleanup {
.t.l config -wrap 0
} -result {1 1 1 1}
test font-24.13 {Tk_ComputeTextLayout: many lines -> realloc line array} -body {
.t.l config -text "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
- update
- list [expr {[winfo reqwidth .t.l] eq 1}] \
- [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}]
+ update
+ list [expr {[winfo reqwidth .t.l] eq 1}] \
+ [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}]
} -result {1 1}
test font-24.14 {Tk_ComputeTextLayout: text ended with \n} -body {
set x {}
- .t.l config -text "0000"
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq $ay}]
- .t.l config -text "0000\n"
- update
- lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
- lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
- return $x
+ .t.l config -text "0000"
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq $ay}]
+ .t.l config -text "0000\n"
+ update
+ lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}]
+ lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}]
+ set x
} -result {1 1 1 1}
destroy .t.l
test font-24.15 {Tk_ComputeTextLayout: justification} -setup {
set x {}
- destroy .t.c
- canvas .t.c -closeenough 0
- .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
- pack .t.c
- update
+ destroy .t.c
+ canvas .t.c -closeenough 0
+ .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
+ pack .t.c
+ update
} -body {
csetup "000\n00000"
.t.c itemconfig text -just left
@@ -1620,7 +1622,7 @@ test font-24.15 {Tk_ComputeTextLayout: justification} -setup {
.t.c itemconfig text -just left
return $x
} -cleanup {
- destroy .t.c
+ destroy .t.c
} -result {2 1 0}
@@ -1632,7 +1634,7 @@ test font-25.1 {Tk_FreeTextLayout procedure} -setup {
.t.f config -text foo
.t.f config -text boo
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
@@ -1649,7 +1651,7 @@ test font-26.1 {Tk_DrawTextLayout procedure: auto-detect last char} -setup {
} -body {
.t.f config -text foo
} -cleanup {
- destroy .t.f
+ destroy .t.f
} -result {}
test font-26.2 {Tk_DrawTextLayout procedure: multiple chunks} -body {
csetup "000\t00\n000"
@@ -1681,14 +1683,14 @@ destroy .t.f
pack [label .t.f]
update
test font-27.1 {Tk_UnderlineTextLayout procedure: no underline chosen} -body {
- .t.f config -text "foo" -under -1
+ .t.f config -text "foo" -underline -1
} -result {}
test font-27.2 {Tk_UnderlineTextLayout procedure: underline not visible} -body {
.t.f config -text "000 00000" -wrap [expr $ax*7] -under 10
} -result {}
test font-27.3 {Tk_UnderlineTextLayout procedure: underline is visible} -body {
.t.f config -text "000 00000" -wrap [expr $ax*7] -under 5
- .t.f config -wrap -1 -under -1
+ .t.f config -wrap -1 -underline -1
} -result {}
destroy .t.f
@@ -1703,7 +1705,7 @@ update
test font-28.1 {Tk_PointToChar procedure: above all lines} -body {
csetup "000"
.t.c index text @-1,0
-} -result {0}
+} -result 0
test font-28.2 {Tk_PointToChar procedure: no chars} -body {
# After fixing the following bug:
#
@@ -1715,46 +1717,46 @@ test font-28.2 {Tk_PointToChar procedure: no chars} -body {
csetup ""
.t.c index text @100,100
-} -result {0}
+} -result 0
test font-28.3 {Tk_PointToChar procedure: loop test} -body {
csetup "000\n000\n000\n000"
.t.c index text @10000,0
-} -result {3}
+} -result 3
test font-28.4 {Tk_PointToChar procedure: intersect line} -body {
csetup "000\n000\n000"
.t.c index text @0,$ay
-} -result {4}
+} -result 4
test font-28.5 {Tk_PointToChar procedure: to the left of all chunks} -body {
csetup "000\n000\n000"
.t.c index text @-100,$ay
-} -result {4}
+} -result 4
test font-28.6 {Tk_PointToChar procedure: past any possible chunk} -body {
csetup "000\n000\n000"
.t.c index text @100000,$ay
-} -result {7}
+} -result 7
test font-28.7 {Tk_PointToChar procedure: which chunk on this line} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*2],$ay
-} -result {6}
+} -result 6
test font-28.8 {Tk_PointToChar procedure: which chunk on this line} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*10],$ay
-} -result {10}
+} -result 10
test font-28.9 {Tk_PointToChar procedure: in special chunk} -body {
csetup "000\n000\t000\t000\n000"
.t.c index text @[expr $ax*6],$ay
-} -result {7}
+} -result 7
test font-28.10 {Tk_PointToChar procedure: past all chars in chunk} -body {
csetup "000 0000000"
.t.c itemconfig text -width [expr $ax*5]
set x [.t.c index text @[expr $ax*5],0]
.t.c itemconfig text -width 0
return $x
-} -result {3}
+} -result 3
test font-28.11 {Tk_PointToChar procedure: below all chunks} -body {
csetup "000 0000000"
.t.c index text @0,1000000
-} -result {11}
+} -result 11
destroy .t.c
@@ -1794,110 +1796,110 @@ pack .t.c
update
test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body {
csetup "000\n000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
-} -result {0}
+ bind all <Enter> {}
+} -result 0
test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body {
csetup "000\n000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
-} -result {5}
+ bind all <Enter> {}
+} -result 5
test font-30.3 {Tk_DistanceToTextLayout procedure: loop to end} -body {
csetup "000\n0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.4 {Tk_DistanceToTextLayout procedure: hit a special char (tab)} -body {
csetup "000\t000\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*6] -y 0
return $x
} -cleanup {
- bind all <Enter> {}
-} -result {3}
+ bind all <Enter> {}
+} -result 3
test font-30.5 {Tk_DistanceToTextLayout procedure: ignore newline} -body {
csetup "000\n0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y $ay
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.6 {Tk_DistanceToTextLayout procedure: ignore spaces at eol} -body {
csetup "000\n000 000000000"
.t.c itemconfig text -width [expr $ax*10]
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*5] -y $ay
.t.c itemconfig text -width 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
.t.c itemconfig text -justify center
test font-30.7 {Tk_DistanceToTextLayout procedure: on left side} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.8 {Tk_DistanceToTextLayout procedure: on right side} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x [expr $ax*2] -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.9 {Tk_DistanceToTextLayout procedure: inside line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y 0
return $x
} -cleanup {
- bind all <Enter> {}
-} -result {0}
+ bind all <Enter> {}
+} -result 0
test font-30.10 {Tk_DistanceToTextLayout procedure: above line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y 0
return $x
} -cleanup {
- bind all <Enter> {}
+ bind all <Enter> {}
} -result {}
test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body {
csetup "000\n0"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x 0 -y $ay
@@ -1907,25 +1909,25 @@ test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body {
} -result {}
test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body {
csetup "0\n000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y $ay
return $x
} -cleanup {
bind all <Enter> {}
-} -result {3}
+} -result 3
.t.c itemconfig text -justify left
test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body {
csetup "000"
- .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
+ .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]}
set x {}
event generate .t.c <Leave>
event generate .t.c <Enter> -x $ax -y 0
return $x
} -cleanup {
- bind all <Enter> {}
-} -result {1}
+ bind all <Enter> {}
+} -result 1
destroy .t.c
@@ -1971,16 +1973,16 @@ test font-31.7 {TkIntersectAngledTextLayout procedure: bug [514ff64dd0]} -body {
# The text has been rotated 90 degrees around it's upper left corner,
# so it's enough to check with a small rectangle with small negative y coords.
.t.c find overlapping 5 -7 7 -5
-} -result {1}
+} -result 1
destroy .t.c
test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup {
- destroy .t.c
- canvas .t.c -closeenough 0
- .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
- pack .t.c
- update
+ destroy .t.c
+ canvas .t.c -closeenough 0
+ .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12"
+ pack .t.c
+ update
} -body {
# If there were a whole bunch of returns or tabs in a row, then the
# temporary buffer could overflow and write on the stack.
@@ -1993,7 +1995,7 @@ test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setu
set i [string first "(qwerty" $x]
string range $x $i [expr {$i + 278}]
} -cleanup {
- destroy .t.c
+ destroy .t.c
} -result {(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)]
[(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)]
[()]
@@ -2051,85 +2053,85 @@ test font-34.2 {ConfigAttributesObj procedure: arguments} -setup {
test font-34.3 {ConfigAttributesObj procedure: family} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -family xyz
- lappend x [font config xyz -family]
- font config xyz -family times
- lappend x [font config xyz -family]
+ font create xyz -family xyz
+ lappend x [font config xyz -family]
+ font config xyz -family times
+ lappend x [font config xyz -family]
} -cleanup {
font delete xyz
} -result {xyz times}
test font-34.4 {ConfigAttributesObj procedure: size} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -size 20
- lappend x [font config xyz -size]
- font config xyz -size 40
- lappend x [font config xyz -size]
+ font create xyz -size 20
+ lappend x [font config xyz -size]
+ font config xyz -size 40
+ lappend x [font config xyz -size]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {20 40}
test font-34.5 {ConfigAttributesObj procedure: weight} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -weight normal
- lappend x [font config xyz -weight]
- font config xyz -weight bold
- lappend x [font config xyz -weight]
+ font create xyz -weight normal
+ lappend x [font config xyz -weight]
+ font config xyz -weight bold
+ lappend x [font config xyz -weight]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {normal bold}
test font-34.6 {ConfigAttributesObj procedure: slant} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -slant roman
- lappend x [font config xyz -slant]
- font config xyz -slant italic
- lappend x [font config xyz -slant]
+ font create xyz -slant roman
+ lappend x [font config xyz -slant]
+ font config xyz -slant italic
+ lappend x [font config xyz -slant]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {roman italic}
test font-34.7 {ConfigAttributesObj procedure: underline} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -underline 0
- lappend x [font config xyz -underline]
- font config xyz -underline 1
- lappend x [font config xyz -underline]
+ font create xyz -underline 0
+ lappend x [font config xyz -underline]
+ font config xyz -underline 1
+ lappend x [font config xyz -underline]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {0 1}
test font-34.8 {ConfigAttributesObj procedure: overstrike} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -overstrike 0
- lappend x [font config xyz -overstrike]
- font config xyz -overstrike 1
- lappend x [font config xyz -overstrike]
+ font create xyz -overstrike 0
+ lappend x [font config xyz -overstrike]
+ font config xyz -overstrike 1
+ lappend x [font config xyz -overstrike]
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {0 1}
test font-34.9 {ConfigAttributesObj procedure: size} -body {
- font create xyz -size xyz
+ font create xyz -size xyz
} -returnCodes error -result {expected integer but got "xyz"}
test font-34.10 {ConfigAttributesObj procedure: weight} -body {
- font create xyz -weight xyz
+ font create xyz -weight xyz
} -returnCodes error -result {bad -weight value "xyz": must be normal, or bold}
test font-34.11 {ConfigAttributesObj procedure: slant} -body {
- font create xyz -slant xyz
+ font create xyz -slant xyz
} -returnCodes error -result {bad -slant value "xyz": must be roman, or italic}
test font-34.12 {ConfigAttributesObj procedure: underline} -body {
- font create xyz -underline xyz
+ font create xyz -underline xyz
} -returnCodes error -result {expected boolean value but got "xyz"}
test font-34.13 {ConfigAttributesObj procedure: overstrike} -body {
- font create xyz -overstrike xyz
+ font create xyz -overstrike xyz
} -returnCodes error -result {expected boolean value but got "xyz"}
@@ -2140,7 +2142,7 @@ test font-35.1 {GetAttributeInfoObj procedure: one attribute} -setup {
font create xyz -family xyz
font config xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
@@ -2151,7 +2153,7 @@ test font-36.1 {GetAttributeInfoObj procedure: unknown attribute} -setup {
font create xyz
font config xyz -xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -returnCodes {
error
} -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike}
@@ -2164,61 +2166,61 @@ test font-37.1 {GetAttributeInfoObj procedure: all attributes} -setup {
font create xyz -family xyz
font config xyz
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {-family xyz -size 0 -weight normal -slant roman -underline 0 -overstrike 0}
test font-37.2 {GetAttributeInfo procedure: family} -setup {
catch {font delete xyz}
} -body {
- font create xyz -family xyz
- font config xyz -family
+ font create xyz -family xyz
+ font config xyz -family
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {xyz}
test font-37.3 {GetAttributeInfo procedure: size} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -size 20
- font config xyz -size
+ font create xyz -size 20
+ font config xyz -size
} -cleanup {
- font delete xyz
-} -result {20}
+ font delete xyz
+} -result 20
test font-37.4 {GetAttributeInfo procedure: weight} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -weight normal
- font config xyz -weight
+ font create xyz -weight normal
+ font config xyz -weight
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {normal}
test font-37.5 {GetAttributeInfo procedure: slant} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -slant italic
- font config xyz -slant
+ font create xyz -slant italic
+ font config xyz -slant
} -cleanup {
- font delete xyz
+ font delete xyz
} -result {italic}
test font-37.6 {GetAttributeInfo procedure: underline} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -underline yes
- font config xyz -underline
+ font create xyz -underline yes
+ font config xyz -underline
} -cleanup {
- font delete xyz
-} -result {1}
+ font delete xyz
+} -result 1
test font-37.7 {GetAttributeInfo procedure: overstrike} -setup {
catch {font delete xyz}
- set x {}
+ set x {}
} -body {
- font create xyz -overstrike no
- font config xyz -overstrike
+ font create xyz -overstrike no
+ font config xyz -overstrike
} -cleanup {
- font delete xyz
-} -result {0}
+ font delete xyz
+} -result 0
# In tests below, one field is set to "xyz" so that font name doesn't
@@ -2256,7 +2258,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body {
font actual {times xyz xyz}
} -returnCodes error -result {expected integer but got "xyz"}
test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints {
- unixOrWin
+ unixOrWin failsOnUbuntuNoXft
} -body {
lrange [font actual {times 12 bold italic overstrike underline}] 4 end
} -result {-weight bold -slant italic -underline 1 -overstrike 1}
@@ -2338,22 +2340,22 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body {
} -result [font actual {times 0} -family]
-test font-44.1 {TkFontGetPixels: size < 0} -setup {
- set oldscale [tk scaling]
+test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntuNoXft -setup {
+ set oldscale [tk scaling]
} -body {
- tk scaling 0.5
+ tk scaling 0.5
font actual {times -12} -size
} -cleanup {
- tk scaling $oldscale
-} -result {24}
-test font-44.2 {TkFontGetPoints: size >= 0} -constraints noExceed -setup {
- set oldscale [tk scaling]
+ tk scaling $oldscale
+} -result 24
+test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup {
+ set oldscale [tk scaling]
} -body {
- tk scaling 0.5
+ tk scaling 0.5
font actual {times 12} -size
} -cleanup {
- tk scaling $oldscale
-} -result {12}
+ tk scaling $oldscale
+} -result 12
test font-45.1 {TkFontGetAliasList: no match} -body {
@@ -2370,16 +2372,16 @@ test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body {
set res [expr {[font actual {{times new roman} 10} -family] eq \
[font actual {times 10} -family]} ]
}
-} -result {1}
+} -result 1
test font-46.1 {font actual, with character, no option, no --} -body {
- font actual {times 10} a
+ font actual {times 10} a
} -match glob -result [list -family [font actual {times 10} -family] -size *\
-slant roman -underline 0 -overstrike 0]
test font-46.2 {font actual, with character introduced by --} -body {
- font actual {times 10} -- -
+ font actual {times 10} -- -
} -match glob -result [list -family [font actual {times 10} -family] -size *\
-slant roman -underline 0 -overstrike 0]
diff --git a/tests/fontchooser.test b/tests/fontchooser.test
index 4dad5da..a149ccb 100644
--- a/tests/fontchooser.test
+++ b/tests/fontchooser.test
@@ -1,14 +1,17 @@
# Test the "tk::fontchooser" command
#
-# Copyright (c) 2008 Pat Thoyts
+# Copyright © 2008 Pat Thoyts
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
# the following helper functions are related to the functions used
# in winDialog.test where they are used to send messages to the win32
-# dialog (hence the wierdness).
+# dialog (hence the weirdness).
proc start {cmd} {
set ::tk_dialog {}
@@ -79,7 +82,7 @@ test fontchooser-1.7 {tk fontchooser: usage} -returnCodes error -body {
test fontchooser-1.8 {tk fontchooser: usage} -returnCodes ok -body {
tk fontchooser configure -visible
-} -result {0}
+} -result 0
test fontchooser-1.9 {tk fontchooser: usage} -returnCodes error -body {
tk fontchooser configure -visible 1
@@ -109,7 +112,7 @@ test fontchooser-2.0 {fontchooser -title} -constraints scriptImpl -body {
test fontchooser-2.1 {fontchooser -title (cyrillic)} -constraints scriptImpl -body {
start {
tk::fontchooser::Configure \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"
+ -title "Привет"
tk::fontchooser::Show
}
then {
@@ -117,7 +120,7 @@ test fontchooser-2.1 {fontchooser -title (cyrillic)} -constraints scriptImpl -bo
Click cancel
}
set x
-} -result "\u041f\u0440\u0438\u0432\u0435\u0442"
+} -result "Привет"
test fontchooser-3.0 {fontchooser -parent} -constraints scriptImpl -body {
start {
@@ -155,7 +158,7 @@ test fontchooser-4.1 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
test fontchooser-4.2 {fontchooser -font} -constraints scriptImpl -body {
start {
@@ -166,7 +169,7 @@ test fontchooser-4.2 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
start {
@@ -177,9 +180,9 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body {
Click ok
}
expr {$::testfont ne {}}
-} -result {1}
+} -result 1
-test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body {
+test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl failsOnUbuntuNoXft} -body {
start {
tk::fontchooser::Configure -command ApplyFont -font {times 14 bold}
tk::fontchooser::Show
@@ -190,6 +193,12 @@ test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body {
lrange $::testfont 1 end
} -result {14 bold}
+test fontchooser-5.1 {fontchooser multiple configure} -constraints {scriptImpl} -body {
+ tk fontchooser configure -title TestTitle -command foo
+ tk fontchooser configure -command bar
+ tk fontchooser configure -title
+} -result {TestTitle}
+
# -------------------------------------------------------------------------
cleanupTests
diff --git a/tests/frame.test b/tests/frame.test
index bdeb2e9..7d8dce2 100644
--- a/tests/frame.test
+++ b/tests/frame.test
@@ -2,9 +2,9 @@
# "toplevel" commands of Tk. It is organized in the standard fashion for Tcl
# tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -195,7 +195,7 @@ test frame-1.15 {frame configuration options} -body {
lindex [.f configure -bd] 4
} -cleanup {
.f configure -bd [lindex [.f configure -bd] 3]
-} -result {4}
+} -result 4
test frame-1.16 {frame configuration options} -body {
.f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -213,7 +213,7 @@ test frame-1.19 {frame configuration options} -body {
lindex [.f configure -borderwidth] 4
} -cleanup {
.f configure -borderwidth [lindex [.f configure -borderwidth] 3]
-} -result {1}
+} -result 1
test frame-1.20 {frame configuration options} -body {
.f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -231,7 +231,7 @@ test frame-1.23 {frame configuration options} -body {
lindex [.f configure -height] 4
} -cleanup {
.f configure -height [lindex [.f configure -height] 3]
-} -result {100}
+} -result 100
test frame-1.24 {frame configuration options} -body {
.f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
@@ -258,7 +258,7 @@ test frame-1.29 {frame configuration options} -body {
lindex [.f configure -highlightthickness] 4
} -cleanup {
.f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
-} -result {6}
+} -result 6
test frame-1.30 {frame configuration options} -body {
.f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -267,7 +267,7 @@ test frame-1.31 {frame configuration options} -body {
lindex [.f configure -padx] 4
} -cleanup {
.f configure -padx [lindex [.f configure -padx] 3]
-} -result {3}
+} -result 3
test frame-1.32 {frame configuration options} -body {
.f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -276,7 +276,7 @@ test frame-1.33 {frame configuration options} -body {
lindex [.f configure -pady] 4
} -cleanup {
.f configure -pady [lindex [.f configure -pady] 3]
-} -result {4}
+} -result 4
test frame-1.34 {frame configuration options} -body {
.f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -300,7 +300,7 @@ test frame-1.38 {frame configuration options} -body {
lindex [.f configure -width] 4
} -cleanup {
.f configure -width [lindex [.f configure -width] 3]
-} -result {32}
+} -result 32
test frame-1.39 {frame configuration options} -body {
.f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -500,7 +500,7 @@ test frame-2.21 {toplevel configuration options} -body {
test frame-2.22 {toplevel configuration options} -body {
.t configure -bd 4
lindex [.t configure -bd] 4
-} -result {4}
+} -result 4
test frame-2.23 {toplevel configuration options} -body {
.t configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -514,7 +514,7 @@ test frame-2.25 {toplevel configuration options} -body {
test frame-2.26 {toplevel configuration options} -body {
.t configure -borderwidth 1.3
lindex [.t configure -borderwidth] 4
-} -result {1}
+} -result 1
test frame-2.27 {toplevel configuration options} -body {
.t configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -528,7 +528,7 @@ test frame-2.29 {toplevel configuration options} -body {
test frame-2.30 {toplevel configuration options} -body {
.t configure -height 100
lindex [.t configure -height] 4
-} -result {100}
+} -result 100
test frame-2.31 {toplevel configuration options} -body {
.t configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
@@ -542,21 +542,21 @@ test frame-2.33 {toplevel configuration options} -body {
test frame-2.34 {toplevel configuration options} -body {
.t configure -highlightthickness 3
lindex [.t configure -highlightthickness] 4
-} -result {3}
+} -result 3
test frame-2.35 {toplevel configuration options} -body {
.t configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.36 {toplevel configuration options} -body {
.t configure -padx 3
lindex [.t configure -padx] 4
-} -result {3}
+} -result 3
test frame-2.37 {toplevel configuration options} -body {
.t configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.38 {toplevel configuration options} -body {
.t configure -pady 4
lindex [.t configure -pady] 4
-} -result {4}
+} -result 4
test frame-2.39 {toplevel configuration options} -body {
.t configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -570,7 +570,7 @@ test frame-2.41 {toplevel configuration options} -returnCodes error -body {
test frame-2.42 {toplevel configuration options} -body {
.t configure -width 32
lindex [.t configure -width] 4
-} -result {32}
+} -result 32
test frame-2.43 {toplevel configuration options} -body {
.t configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -707,7 +707,7 @@ test frame-3.11 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test frame-3.12 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -719,7 +719,7 @@ test frame-3.12 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test frame-3.13 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -734,7 +734,7 @@ test frame-3.13 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test frame-3.14 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -749,7 +749,7 @@ test frame-3.14 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints {
defaultPseudocolor8 unix nonPortable
} -setup {
@@ -774,7 +774,7 @@ test frame-3.16 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test frame-3.17 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -787,7 +787,7 @@ test frame-3.17 {TkCreateFrame procedure} -constraints {
colorsFree .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test frame-3.18 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
@@ -799,7 +799,7 @@ test frame-3.18 {TkCreateFrame procedure} -constraints {
colorsFree .t 131 131 131
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test frame-3.19 {TkCreateFrame procedure} -constraints {
defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
@@ -841,7 +841,7 @@ test frame-3.21 {TkCreateFrame procedure} -constraints {
colorsFree .t 131 131 131
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
if {[testConstraint defaultPseudocolor8]} {
destroy .t1
}
@@ -1041,7 +1041,7 @@ test frame-9.2 {MapFrame procedure} -setup {
destroy .t
update
winfo exists .t
-} -result {0}
+} -result 0
test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
deleteWindows
} -body {
@@ -1057,7 +1057,7 @@ test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
winfo exists .t
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test frame-10.1 {frame widget vs hidden commands} -setup {
deleteWindows
@@ -1167,7 +1167,7 @@ test frame-12.3 {FrameWorldChanged procedure} -setup {
} -cleanup {
deleteWindows
font delete myfont
-} -result {0}
+} -result 0
test frame-13.1 {labelframe configuration options} -setup {
deleteWindows
@@ -1252,7 +1252,7 @@ test frame-13.12 {labelframe configuration options} -body {
lindex [.f configure -bd] 4
} -cleanup {
.f configure -bd [lindex [.f configure -bd] 3]
-} -result {4}
+} -result 4
test frame-13.13 {labelframe configuration options} -body {
.f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -1270,7 +1270,7 @@ test frame-13.16 {labelframe configuration options} -body {
lindex [.f configure -borderwidth] 4
} -cleanup {
.f configure -borderwidth [lindex [.f configure -borderwidth] 3]
-} -result {1}
+} -result 1
test frame-13.17 {labelframe configuration options} -body {
.f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -1312,7 +1312,7 @@ test frame-13.25 {labelframe configuration options} -body {
lindex [.f configure -height] 4
} -cleanup {
.f configure -height [lindex [.f configure -height] 3]
-} -result {100}
+} -result 100
test frame-13.26 {labelframe configuration options} -body {
.f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
@@ -1339,7 +1339,7 @@ test frame-13.31 {labelframe configuration options} -body {
lindex [.f configure -highlightthickness] 4
} -cleanup {
.f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
-} -result {6}
+} -result 6
test frame-13.32 {labelframe configuration options} -body {
.f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -1357,7 +1357,7 @@ test frame-13.35 {labelframe configuration options} -body {
lindex [.f configure -padx] 4
} -cleanup {
.f configure -padx [lindex [.f configure -padx] 3]
-} -result {3}
+} -result 3
test frame-13.36 {labelframe configuration options} -body {
.f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -1366,7 +1366,7 @@ test frame-13.37 {labelframe configuration options} -body {
lindex [.f configure -pady] 4
} -cleanup {
.f configure -pady [lindex [.f configure -pady] 3]
-} -result {4}
+} -result 4
test frame-13.38 {labelframe configuration options} -body {
.f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -1396,7 +1396,7 @@ test frame-13.43 {labelframe configuration options} -body {
lindex [.f configure -width] 4
} -cleanup {
.f configure -width [lindex [.f configure -width] 3]
-} -result {32}
+} -result 32
test frame-13.44 {labelframe configuration options} -body {
.f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
diff --git a/tests/geometry.test b/tests/geometry.test
index c10a119..da9e77b 100644
--- a/tests/geometry.test
+++ b/tests/geometry.test
@@ -2,9 +2,9 @@
# tkGeometry.c (generic support for geometry managers). It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
proc getsize w {
@@ -282,7 +282,7 @@ test geometry-4.10 {Tk_MaintainGeometry and Tk_UnmaintainGeometry} -setup {
winfo ismapped .t.quit
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
# cleanup
diff --git a/tests/get.test b/tests/get.test
index ea08c8c..5ea2af3 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -2,8 +2,8 @@
# tkGet.c. It is organized in the standard fashion for Tcl
# white-box tests.
#
-# Copyright (c) 1998 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/grab.test b/tests/grab.test
index 653d756..ae53673 100644
--- a/tests/grab.test
+++ b/tests/grab.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1998-2000 by Ajuba Solutions.
+# Copyright © 1998-2000 by Ajuba Solutions.
# All rights reserved.
package require tcltest 2.2
@@ -107,7 +107,7 @@ test grab-2.1 {Tk_GrabObjCmd, grab status gives correct status} -body {
grab status .
} -cleanup {
grab release .
-} -result {none}
+} -result none
test grab-2.2 {Tk_GrabObjCmd, grab status gives correct status} -body {
set curr [grab current .]
if { [string length $curr] > 0 } {
diff --git a/tests/grid.test b/tests/grid.test
index 53f8be5..62f6ff6 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the *NEW* "grid" command of Tk. It is
# (almost) organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body {
} -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"}
test grid-1.2 {basic argument checking} -body {
grid foo bar
-} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}
+} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, or size}
test grid-1.3 {basic argument checking} -body {
button .b
grid .b -row 0 -column
@@ -63,10 +63,10 @@ test grid-1.5 {basic argument checking} -body {
} -returnCodes error -result {can't manage ".": it's a top-level window}
test grid-1.6 {basic argument checking} -body {
grid x
-} -returnCodes error -result {can't determine master window}
+} -returnCodes error -result {can't determine container window}
test grid-1.7 {basic argument checking} -body {
grid configure x
-} -returnCodes error -result {can't determine master window}
+} -returnCodes error -result {can't determine container window}
test grid-1.8 {basic argument checking} -body {
button .b
grid x .b
@@ -93,7 +93,7 @@ test grid-2.2 {bbox} -body {
} -result {0 0 0 0}
test grid-2.3 {bbox: argument checking} -body {
grid bbox . 0 0 5
-} -returnCodes error -result {wrong # args: should be "grid bbox master ?column row ?column row??"}
+} -returnCodes error -result {wrong # args: should be "grid bbox window ?column row ?column row??"}
test grid-2.4 {bbox} -body {
grid bbox .bad 0 0
} -returnCodes error -result {bad window path name ".bad"}
@@ -145,7 +145,7 @@ test grid-3.1 {configure: basic argument checking} -body {
test grid-3.2 {configure: basic argument checking} -body {
button .b
grid configure .b
- grid slaves .
+ grid content .
} -cleanup {
grid_reset 3.2
} -result {.b}
@@ -179,11 +179,11 @@ test grid-3.7 {configure: basic argument checking} -body {
grid .f .f.b
} -cleanup {
grid_reset 3.7
-} -returnCodes error -result {can't put .f.b inside .}
+} -returnCodes error -result {can't put ".f.b" inside "."}
test grid-3.8 {configure: basic argument checking} -body {
button .b
grid configure x .b
- grid slaves .
+ grid content .
} -cleanup {
grid_reset 3.8
} -result {.b}
@@ -193,7 +193,7 @@ test grid-3.9 {configure: basic argument checking} -body {
} -cleanup {
grid_reset 3.9
} -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'}
-test grid-3.10 {ConfigureSlave procedure, bad -in option} -body {
+test grid-3.10 {ConfigureContent procedure, bad -in option} -body {
frame .f
grid .f -in .f
} -cleanup {
@@ -206,7 +206,7 @@ test grid-3.11 {prevent management loops} -body {
grid .f2 -in .f1
} -cleanup {
grid_reset 3.11
-} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f2" inside ".f1": would cause management loop}
test grid-3.12 {prevent management loops} -body {
frame .f1
frame .f2
@@ -216,7 +216,7 @@ test grid-3.12 {prevent management loops} -body {
grid .f3 -in .f1
} -cleanup {
grid_reset 3.12
-} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f3" inside ".f1": would cause management loop}
test grid-4.1 {forget: basic argument checking} -body {
grid forget foo
@@ -224,9 +224,9 @@ test grid-4.1 {forget: basic argument checking} -body {
test grid-4.2 {forget} -body {
button .c
grid [button .b]
- set a [grid slaves .]
+ set a [grid content .]
grid forget .b .c
- lappend a [grid slaves .]
+ lappend a [grid content .]
return $a
} -cleanup {
grid_reset 4.2
@@ -293,7 +293,7 @@ test grid-5.4 {info} -body {
test grid-6.1 {location: basic argument checking} -body {
grid location .
-} -returnCodes error -result {wrong # args: should be "grid location master x y"}
+} -returnCodes error -result {wrong # args: should be "grid location window x y"}
test grid-6.2 {location: basic argument checking} -body {
grid location .bad 0 0
} -returnCodes error -result {bad window path name ".bad"}
@@ -389,12 +389,12 @@ test grid-7.2 {propagate} -body {
grid propagate .
} -cleanup {
grid_reset 7.2
-} -result {1}
+} -result 1
test grid-7.3 {propagate} -body {
grid propagate . 0;grid propagate .
} -cleanup {
grid_reset 7.3
-} -result {0}
+} -result 0
test grid-7.4 {propagate} -body {
grid propagate .x
} -cleanup {
@@ -516,43 +516,43 @@ test grid-8.6 {size} -body {
grid_reset 8.6
} -result {{51 11} {51 11} {31 11} {21 11} {16 1} {1 1}}
-test grid-9.1 {slaves} -body {
- grid slaves .
+test grid-9.1 {content} -body {
+ grid content .
} -returnCodes ok -result {}
-test grid-9.2 {slaves} -body {
- grid slaves .foo
+test grid-9.2 {content} -body {
+ grid content .foo
} -returnCodes error -result {bad window path name ".foo"}
-test grid-9.3 {slaves} -body {
- grid slaves a b
-} -returnCodes error -result {wrong # args: should be "grid slaves window ?-option value ...?"}
-test grid-9.4 {slaves} -body {
- grid slaves . a b
+test grid-9.3 {content} -body {
+ grid content a b
+} -returnCodes error -result {wrong # args: should be "grid content window ?-option value ...?"}
+test grid-9.4 {content} -body {
+ grid content . a b
} -returnCodes error -result {bad option "a": must be -column or -row}
-test grid-9.5 {slaves} -body {
- grid slaves . -column x
+test grid-9.5 {content} -body {
+ grid content . -column x
} -returnCodes error -result {expected integer but got "x"}
-test grid-9.6 {slaves} -body {
- grid slaves . -row -3
+test grid-9.6 {content} -body {
+ grid content . -row -3
} -returnCodes error -result {-3 is an invalid value: should NOT be < 0}
-test grid-9.7 {slaves} -body {
- grid slaves . -foo 3
+test grid-9.7 {content} -body {
+ grid content . -foo 3
} -returnCodes error -result {bad option "-foo": must be -column or -row}
-test grid-9.8 {slaves} -body {
- grid slaves .x -row 3
+test grid-9.8 {content} -body {
+ grid content .x -row 3
} -returnCodes error -result {bad window path name ".x"}
-test grid-9.9 {slaves} -body {
- grid slaves . -row 3
+test grid-9.9 {content} -body {
+ grid content . -row 3
} -returnCodes ok -result {}
-test grid-9.10 {slaves} -body {
+test grid-9.10 {content} -body {
foreach i {0 1 2} {
label .$i -text $i
grid .$i -row $i -column $i
}
- grid slaves .
+ grid content .
} -cleanup {
grid_reset 9.10
} -result {.2 .1 .0}
-test grid-9.11 {slaves} -body {
+test grid-9.11 {content} -body {
catch {unset a}
foreach i {0 1 2} {
label .$i -text $i
@@ -561,10 +561,10 @@ test grid-9.11 {slaves} -body {
grid .$i-x -row $i -column [incr i]
}
foreach row {0 1 2 3} {
- lappend a $row{[grid slaves . -row $row]}
+ lappend a $row{[grid content . -row $row]}
}
foreach col {0 1 2 3} {
- lappend a $col{[grid slaves . -column $col]}
+ lappend a $col{[grid content . -column $col]}
}
return $a
} -cleanup {
@@ -576,12 +576,12 @@ test grid-10.1 {column/row configure} -body {
grid columnconfigure .
} -cleanup {
grid_reset 10.1
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
+} -returnCodes error -result {wrong # args: should be "grid columnconfigure window index ?-option value ...?"}
test grid-10.2 {column/row configure} -body {
grid columnconfigure . 0 -weight 0 -pad
} -cleanup {
grid_reset 10.2
-} -returnCodes error -result {wrong # args: should be "grid columnconfigure master index ?-option value ...?"}
+} -returnCodes error -result {wrong # args: should be "grid columnconfigure window index ?-option value ...?"}
test grid-10.3 {column/row configure} -body {
grid columnconfigure .f 0 -weight
} -cleanup {
@@ -596,7 +596,7 @@ test grid-10.5 {column/row configure} -body {
grid columnconfigure . 265 -weight
} -cleanup {
grid_reset 10.5
-} -result {0}
+} -result 0
test grid-10.6 {column/row configure} -body {
grid columnconfigure . 0
} -cleanup {
@@ -622,7 +622,7 @@ test grid-10.10 {column/row configure} -body {
grid columnconfigure . 0 -minsize
} -cleanup {
grid_reset 10.10
-} -result {10}
+} -result 10
test grid-10.11 {column/row configure} -body {
grid columnconfigure . 0 -weight bad
} -cleanup {
@@ -638,7 +638,7 @@ test grid-10.13 {column/row configure} -body {
grid columnconfigure . 0 -weight
} -cleanup {
grid_reset 10.13
-} -result {3}
+} -result 3
test grid-10.14 {column/row configure} -body {
grid columnconfigure . 0 -pad foo
} -cleanup {
@@ -654,7 +654,7 @@ test grid-10.16 {column/row configure} -body {
grid columnconfigure . 0 -pad
} -cleanup {
grid_reset 10.16
-} -result {3}
+} -result 3
test grid-10.17 {column/row configure} -body {
frame .f
set a ""
@@ -856,13 +856,13 @@ test grid-11.1 {default widget placement} -body {
grid ^
} -cleanup {
grid_reset 11.1
-} -returnCodes error -result {can't use '^', cant find master}
+} -returnCodes error -result {can't use '^', can't find container window}
test grid-11.2 {default widget placement} -body {
button .b
grid .b ^
} -cleanup {
grid_reset 11.2
-} -returnCodes error -result {can't find slave to extend with "^"}
+} -returnCodes error -result {can't find content to extend with "^"}
test grid-11.3 {default widget placement} -body {
button .b
grid .b - - .c
@@ -917,7 +917,7 @@ test grid-11.9 {default widget placement} -body {
grid .f x ^
} -cleanup {
grid_reset 11.9
-} -returnCodes error -result {can't find slave to extend with "^"}
+} -returnCodes error -result {can't find content to extend with "^"}
test grid-11.10 {default widget placement} -body {
foreach i {1 2 3} {
frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red
@@ -1162,7 +1162,7 @@ test grid-13.4 {-in} -body {
grid .f -in .top
} -cleanup {
grid_reset 13.3
-} -returnCodes error -result {can't put .f inside .top}
+} -returnCodes error -result {can't put ".f" inside ".top"}
destroy .top
test grid-13.5 {-ipadx} -body {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
@@ -1305,10 +1305,10 @@ test grid-13.20 {reparenting} -body {
grid .b -in .1
set a ""
catch {unset info}; array set info [grid info .b]
- lappend a [grid slaves .1],[grid slaves .2],$info(-in)
+ lappend a [grid content .1],[grid content .2],$info(-in)
grid .b -in .2
catch {unset info}; array set info [grid info .b]
- lappend a [grid slaves .1],[grid slaves .2],$info(-in)
+ lappend a [grid content .1],[grid content .2],$info(-in)
unset info
return $a
} -cleanup {
@@ -1369,27 +1369,27 @@ test grid-14.3 {map notify: bug 1648} -constraints {nonPortable} -body {
grid_reset 14.3
} -result {.2 2 .0 1 . 2 .1 1}
-test grid-15.1 {lost slave} -body {
+test grid-15.1 {lost content} -body {
button .b
grid .b
- set a [grid slaves .]
+ set a [grid content .]
pack .b
- lappend a [grid slaves .]
+ lappend a [grid content .]
grid .b
- lappend a [grid slaves .]
+ lappend a [grid content .]
} -cleanup {
grid_reset 15.1
} -result {.b {} .b}
-test grid-15.2 {lost slave} -body {
+test grid-15.2 {lost content} -body {
frame .f
grid .f
button .b
grid .b -in .f
- set a [grid slaves .f]
+ set a [grid content .f]
pack .b -in .f
- lappend a [grid slaves .f]
+ lappend a [grid content .f]
grid .b -in .f
- lappend a [grid slaves .f]
+ lappend a [grid content .f]
} -cleanup {
grid_reset 15.2
} -result {.b {} .b}
@@ -1974,9 +1974,9 @@ test grid-22.1 {remove: basic argument checking} {
test grid-22.2 {remove} {
button .c
grid [button .b]
- set a [grid slaves .]
+ set a [grid content .]
grid remove .b .c
- lappend a [grid slaves .]
+ lappend a [grid content .]
return $a
} {.b {}}
grid_reset 22.2
@@ -2023,7 +2023,7 @@ test grid-22.5 {remove} {
} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
grid_reset 22.5
-test grid-23 {grid configure -in leaked from previous master - bug
+test grid-23 {grid configure -in leaked from previous container window - bug
6aea69fccbb266b7f0437686379fbe5b55442958} {
frame .f
frame .g
@@ -2039,7 +2039,7 @@ test grid-23 {grid configure -in leaked from previous master - bug
pack forget .f
update
winfo ismapped .t ; # must return 1
-} {1}
+} 1
grid_reset 23
test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup {
@@ -2055,7 +2055,7 @@ test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup {
} -cleanup {
bind . <<NoManagedChild>> {}
grid_reset 24.1
-} -result {1}
+} -result 1
test grid-24.2 {<<NoManagedChild>> fires on last grid remove} -setup {
global A
unset -nocomplain A
@@ -2069,7 +2069,7 @@ test grid-24.2 {<<NoManagedChild>> fires on last grid remove} -setup {
} -cleanup {
bind . <<NoManagedChild>> {}
grid_reset 24.2
-} -result {1}
+} -result 1
test grid-24.3 {<<NoManagedChild>> fires on last gridded child destruction} -setup {
global A
unset -nocomplain A
@@ -2083,7 +2083,7 @@ test grid-24.3 {<<NoManagedChild>> fires on last gridded child destruction} -set
} -cleanup {
bind . <<NoManagedChild>> {}
grid_reset 24.3
-} -result {1}
+} -result 1
test grid-24.4 {<Configure> does not fire on last grid forget} -setup {
global A
unset -nocomplain A
@@ -2097,7 +2097,7 @@ test grid-24.4 {<Configure> does not fire on last grid forget} -setup {
} -cleanup {
bind . <Configure> {}
grid_reset 24.4
-} -result {0}
+} -result 0
test grid-24.5 {<Configure> fires on forelast grid forget} -setup {
global A
unset -nocomplain A
@@ -2112,7 +2112,7 @@ test grid-24.5 {<Configure> fires on forelast grid forget} -setup {
} -cleanup {
bind . <Configure> {}
grid_reset 24.5
-} -result {1}
+} -result 1
test grid-24.6 {<<NoManagedChild>> does not fire on forelast grid forget} -setup {
global A
unset -nocomplain A
@@ -2127,7 +2127,7 @@ test grid-24.6 {<<NoManagedChild>> does not fire on forelast grid forget} -setup
} -cleanup {
bind . <<NoManagedChild>> {}
grid_reset 24.6
-} -result {0}
+} -result 0
test grid-24.7 {<<NoManagedChild>> does not fire on grid anchor} -setup {
global A
unset -nocomplain A
@@ -2140,7 +2140,7 @@ test grid-24.7 {<<NoManagedChild>> does not fire on grid anchor} -setup {
grid anchor . nw
bind . <<NoManagedChild>> {}
grid_reset 24.7
-} -result {0}
+} -result 0
test grid-24.8 {<<NoManagedChild>> does not fire on last grid forget if propagation is off} -setup {
global A
unset -nocomplain A
@@ -2155,7 +2155,7 @@ test grid-24.8 {<<NoManagedChild>> does not fire on last grid forget if propagat
} -cleanup {
bind . <<NoManagedChild>> {}
grid_reset 24.8
-} -result {0}
+} -result 0
# cleanup
cleanupTests
diff --git a/tests/image.test b/tests/image.test
index da65a66..aa3bab8 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -2,9 +2,9 @@
# other procedures in the file tkImage.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -50,7 +50,7 @@ test image-1.6 {Tk_ImageCmd procedure, "create" option} -constraints {
expr {$second-$first}
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints {
testImageType
@@ -308,14 +308,14 @@ test image-5.7 {Tk_ImageCmd procedure, "type" option} -constraints {
} -returnCodes error -result {image "myimage" doesn't exist}
-test image-6.1 {Tk_ImageCmd procedure, "types" option} -body {
- image types x
-} -returnCodes error -result {wrong # args: should be "image types"}
-test image-6.2 {Tk_ImageCmd procedure, "types" option} -constraints {
+test image-6.1 {Tk_ImageCmd procedure, "types" option} -constraints {
testImageType
} -body {
+ image types x
+} -returnCodes error -result {wrong # args: should be "image types"}
+test image-6.2 {Tk_ImageCmd procedure, "types" option} -body {
lsort [image types]
-} -result {bitmap oldtest photo test}
+} -match glob -result {bitmap*photo test}
test image-7.1 {Tk_ImageCmd procedure, "width" option} -body {
@@ -357,12 +357,6 @@ test image-8.1 {Tk_ImageCmd procedure, "inuse" option} -constraints {
catch {destroy .b}
} -result [list 0 1]
-if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
- # Aqua >= 10.14 will redraw the entire image in drawRect.
- set result_9_1 {{foo display 0 0 30 15}}
-} else {
- set result_9_1 {{foo display 5 6 7 8}}
-}
test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c delete all
imageCleanup
@@ -385,13 +379,8 @@ test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
} -cleanup {
.c delete all
imageCleanup
-} -result $result_9_1
-if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
- # Aqua >= 10.14 will redraw the entire image.
- set result_9_2 {{foo display 0 0 30 15} {foo display 0 0 30 15}}
-} else {
- set result_9_2 {{foo display 5 6 25 9} {foo display 0 0 12 14}}
-}
+} -result {{foo display 5 6 7 8}}
+
test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c delete all
imageCleanup
@@ -411,7 +400,7 @@ test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup {
} -cleanup {
.c delete all
imageCleanup
-} -result $result_9_2
+} -result {{foo display 5 6 25 9} {foo display 0 0 12 14}}
test image-10.1 {Tk_GetImage procedure} -setup {
imageCleanup
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index e7f2c7e..975210b 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -2,9 +2,9 @@
# the procedures in the file tkImgBmap.c). It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -137,28 +137,28 @@ test imageBmap-2.2 {ImgBmapCreate procedure} -setup {
} -result {image1 image1 0 0 #000000 {}}
-test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} -body {
+test imageBmap-3.1 {ImgBmapConfigureModel procedure, memory de-allocation} -body {
image create bitmap i1 -data $data1
i1 configure -data $data1
} -cleanup {
image delete i1
} -result {}
-test imageBmap-3.2 {ImgBmapConfigureMaster procedure} -body {
+test imageBmap-3.2 {ImgBmapConfigureModel procedure} -body {
image create bitmap i1 -data $data1
list [catch {i1 configure -data bogus} msg] $msg [image width i1] \
[image height i1]
} -result {1 {format error in bitmap data} 16 16}
-test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} -body {
+test imageBmap-3.3 {ImgBmapConfigureModel procedure, memory de-allocation} -body {
image create bitmap i1 -data $data1 -maskdata $data2
i1 configure -maskdata $data2
} -cleanup {
image delete i1
} -result {}
-test imageBmap-3.4 {ImgBmapConfigureMaster procedure} -body {
+test imageBmap-3.4 {ImgBmapConfigureModel procedure} -body {
image create bitmap i1
i1 configure -maskdata $data2
} -returnCodes error -result {can't have mask without bitmap}
-test imageBmap-3.5 {ImgBmapConfigureMaster procedure} -body {
+test imageBmap-3.5 {ImgBmapConfigureModel procedure} -body {
image create bitmap i1 -data $data1 -maskdata {
#define foo_width 8
#define foo_height 16
@@ -167,7 +167,7 @@ test imageBmap-3.5 {ImgBmapConfigureMaster procedure} -body {
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
}
} -returnCodes error -result {bitmap and mask have different sizes}
-test imageBmap-3.6 {ImgBmapConfigureMaster procedure} -body {
+test imageBmap-3.6 {ImgBmapConfigureModel procedure} -body {
image create bitmap i1 -data $data1 -maskdata {
#define foo_width 16
#define foo_height 8
@@ -176,7 +176,7 @@ test imageBmap-3.6 {ImgBmapConfigureMaster procedure} -body {
0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};
}
} -returnCodes error -result {bitmap and mask have different sizes}
-test imageBmap-3.7 {ImgBmapConfigureMaster procedure} -setup {
+test imageBmap-3.7 {ImgBmapConfigureModel procedure} -setup {
destroy .c
pack [canvas .c]
} -body {
@@ -366,7 +366,7 @@ test imageBmap-7.5 {ImgBmapCmd procedure, "cget" option} -body {
} -returnCodes error -result {unknown option "-stupid"}
test imageBmap-7.6 {ImgBmapCmd procedure} -body {
llength [i1 configure]
-} -result {6}
+} -result 6
test imageBmap-7.7 {ImgBmapCmd procedure} -body {
i1 co -foreground #001122
i1 configure -foreground
@@ -503,8 +503,8 @@ test imageBmap-11.2 {ImgBmapDelete procedure} -body {
test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
rename i2 {}
- list [lsearch -exact [imageNames] i2] [catch {i2 foo} msg] $msg
-} -result {-1 1 {invalid command name "i2"}}
+ list [expr {"i2" in [imageNames]}] [catch {i2 foo} msg] $msg
+} -result {0 1 {invalid command name "i2"}}
removeFile foo.bm
removeFile foo2.bm
diff --git a/tests/imgListFormat.test b/tests/imgListFormat.test
index 331b572..4877645 100644
--- a/tests/imgListFormat.test
+++ b/tests/imgListFormat.test
@@ -2,7 +2,7 @@
# ("list format") implementend in the file tkImgListFormat.c.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 2017 Simon Bachmann
+# Copyright © 2017 Simon Bachmann
# All rights reserved.
#
# Author: Simon Bachmann (simonbachmann@bluewin.ch)
@@ -187,7 +187,7 @@ test imgListFormat-4.4 {StringReadDef: normal use case} -constraints {
} -cleanup {
imageCleanup
unset imgData
-} -result {1}
+} -result 1
test imgListFormat-4.5 {StringReadDef: correct compositing rule} -constraints {
hasTranspTeapotPhoto
} -setup {
diff --git a/tests/imgPNG.test b/tests/imgPNG.test
index 4900e9c..1f3c8e8 100644
--- a/tests/imgPNG.test
+++ b/tests/imgPNG.test
@@ -2,10 +2,10 @@
# and write PNG-format image files for photo widgets. The files is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 1998 Willem van Schaik (images only)
-# Copyright (c) 2008 Donal K. Fellows
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 1998 Willem van Schaik (images only)
+# Copyright © 2008 Donal K. Fellows
# All rights reserved.
package require tcltest 2.2
@@ -1113,7 +1113,7 @@ test imgPNG-3.1 {reading image with unknown ancillary chunk - bug [1c659ef0f1]}
catch {set i [image create photo -file $fileName]}
} -cleanup {
image delete $i
-} -result {0}
+} -result 0
}
namespace delete png
diff --git a/tests/imgPPM.test b/tests/imgPPM.test
index e3a738a..b9dfe12 100644
--- a/tests/imgPPM.test
+++ b/tests/imgPPM.test
@@ -2,8 +2,8 @@
# which reads and write PPM-format image files for photo widgets.
# The files is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index b5a91fe..8acf2bc 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -2,10 +2,10 @@
# procedures in the file tkImgPhoto.c. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1994 The Australian National University
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2002-2008 Donal K. Fellows
+# Copyright © 1994 The Australian National University
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 2002-2008 Donal K. Fellows
# All rights reserved.
#
# Author: Paul Mackerras (paulus@cs.anu.edu.au)
@@ -32,7 +32,7 @@
# ImgPhotoCmd imgPhoto-4.*, imgPhoto-17.*
# GetExtension: no tests
# ParseSubcommandOptions: imgPhoto-1.*
-# ImgPhotoConfigureMaster: imgPhoto-3.*, imgPhoto-15.*
+# ImgPhotoConfigureModel: imgPhoto-3.*, imgPhoto-15.*
# toggleComplexAlphaIfNeeded: no tests
# ImgPhotoDelete: imgPhoto-8.*
# ImgPhotoCmdDeleteProc: imgPhoto-9.*
@@ -129,14 +129,8 @@ testConstraint hasTeapotPhoto [file exists $teapotPhotoFile]
# let's see if we have the semi-transparent one as well
set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png]
testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile]
-
-proc base64ok {} {
- expr {
- ![catch {package require base64}]
- }
-}
+testConstraint needsTcl867 [package vsatisfies [package provide Tcl] 8.6.7-]
-testConstraint base64PackageNeeded [base64ok]
test imgPhoto-1.1 {options for photo images} -body {
image create photo photo1 -width 79 -height 83
@@ -193,7 +187,7 @@ test imgPhoto-1.12 {option -alpha, normal use} -setup {
photo1 transparency get 0 0 -alpha
} -cleanup {
imageCleanup
-} -result {255}
+} -result 255
test imgPhoto-1.13 {option -withalpha, normal use} -setup {
image create photo photo1
} -body {
@@ -226,7 +220,7 @@ test imgPhoto-2.2 {ImgPhotoCreate procedure} -setup {
# set msg
# } {couldn't open "bogus.img": no such file or directory}
-test imgPhoto-3.1 {ImgPhotoConfigureMaster procedure} -constraints {
+test imgPhoto-3.1 {ImgPhotoConfigureModel procedure} -constraints {
hasTeapotPhoto
} -body {
image create photo photo1 -file $teapotPhotoFile
@@ -234,7 +228,7 @@ test imgPhoto-3.1 {ImgPhotoConfigureMaster procedure} -constraints {
} -cleanup {
image delete photo1
} -result {}
-test imgPhoto-3.2 {ImgPhotoConfigureMaster procedure} -constraints {
+test imgPhoto-3.2 {ImgPhotoConfigureModel procedure} -constraints {
hasTeapotPhoto
} -body {
image create photo photo1 -file $teapotPhotoFile
@@ -243,7 +237,7 @@ test imgPhoto-3.2 {ImgPhotoConfigureMaster procedure} -constraints {
} -cleanup {
image delete photo1
} -result {1 {couldn't open "bogus": no such file or directory} 256 256}
-test imgPhoto-3.3 {ImgPhotoConfigureMaster procedure} -constraints {
+test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -constraints {
hasTeapotPhoto
} -setup {
destroy .c
@@ -261,7 +255,7 @@ test imgPhoto-3.3 {ImgPhotoConfigureMaster procedure} -constraints {
destroy .c
image delete photo1
} -result {256 256 {10 10 266 266} {300 10 556 266}}
-test imgPhoto-3.4 {ImgPhotoConfigureMaster: -data <ppm>} -constraints {
+test imgPhoto-3.4 {ImgPhotoConfigureModel: -data <ppm>} -constraints {
hasTeapotPhoto
} -setup {
image create photo photo1 -file $teapotPhotoFile
@@ -272,8 +266,9 @@ test imgPhoto-3.4 {ImgPhotoConfigureMaster: -data <ppm>} -constraints {
} -cleanup {
imageCleanup
} -result {20 20}
-test imgPhoto-3.5 {ImgPhotoConfigureMaster: -data <png>} -constraints {
- hasTeapotPhoto
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
+test imgPhoto-3.5 {ImgPhotoConfigureModel: -data <png>} -constraints {
+ hasTeapotPhoto needsTcl867
} -setup {
image create photo photo1 -file $teapotPhotoFile
image create photo photo2
@@ -283,7 +278,7 @@ test imgPhoto-3.5 {ImgPhotoConfigureMaster: -data <png>} -constraints {
} -cleanup {
imageCleanup
} -result {20 20}
-test imgPhoto-3.6 {ImgPhotoConfigureMaster: -data <default>} -constraints {
+test imgPhoto-3.6 {ImgPhotoConfigureModel: -data <default>} -constraints {
hasTeapotPhoto
} -setup {
image create photo photo1 -file $teapotPhotoFile
@@ -959,7 +954,7 @@ test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constrain
image delete photo1
file delete ./-teapotPhotoFile
} -result {}
-test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints {
+test imgPhoto-4.75.1 {ImgPhotoCmd procedure: copy to same image} -constraints {
hasTeapotPhoto
} -setup {
imageCleanup
@@ -971,7 +966,7 @@ test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints {
} -cleanup {
imageCleanup
} -result {}
-test imgPhoto-4.76 {ImgPhotoCmd, transparancy get: too many options} -setup {
+test imgPhoto-4.76 {ImgPhotoCmd, transparency get: too many options} -setup {
image create photo photo1
} -body {
photo1 put white -to 0 0 1 1
@@ -1211,7 +1206,7 @@ test imgPhoto-4.100 {ImgPhotoCmd put: no changes on empty data} -setup {
string equal $imgData [photo1 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-4.101 {ImgPhotoCmd get: too many args} -setup {
image create photo photo1
} -body {
@@ -1340,10 +1335,10 @@ test imgPhoto-4.117 {ImgPhotoCmd data: list colorformat} -setup {
} -body {
photo1 data -format {default -colorformat list}
} -result {{{255 0 0 170} {0 128 0 255}} {{0 0 255 204} {255 255 255 221}}}
+# This testcase fails with Tcl < 8.6.7, due to [25842c]
test imgPhoto-4.118 {ImgPhotoCmd data: using data for new image
results in same image as orignial } -constraints {
- hasTeapotPhoto
- hasTranspTeapotPhoto
+ hasTeapotPhoto hasTranspTeapotPhoto needsTcl867
} -setup {
image create photo teapot -file $teapotPhotoFile
teapot copy teapot -from 50 60 70 80 -shrink
@@ -1503,8 +1498,8 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
} -body {
image create photo photo2 -file $teapotPhotoFile
rename photo2 {}
- list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg
-} -result {-1 1 {invalid command name "photo2"}}
+ list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg
+} -result {0 1 {invalid command name "photo2"}}
test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup {
imageCleanup
@@ -1527,7 +1522,7 @@ test imgPhoto-10.2 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints {
hasTeapotPhoto
} -setup {
@@ -1541,7 +1536,7 @@ test imgPhoto-10.3 {Tk_ImgPhotoPutBlock, same source and dest img} -constraints
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-10.4 {Tk_ImgPhotoPutBlock, empty image} -setup {
imageCleanup
} -body {
@@ -1583,7 +1578,7 @@ test imgPhoto-12.2 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -constr
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-12.3 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -setup {
imageCleanup
} -body {
@@ -1595,7 +1590,7 @@ test imgPhoto-12.3 {Tk_ImgPhotoPutZoomedBlock, same source and dest img} -setup
string equal [photo1 data] [photo2 data]
} -cleanup {
imageCleanup
-} -result {1}
+} -result 1
test imgPhoto-12.4 {Tk_ImgPhotoPutZoomedBlock, empty image} -setup {
imageCleanup
} -body {
@@ -1949,13 +1944,10 @@ test imgPhoto-19.8 {MatchStirngFormat: invalid data for gif} -setup {
} -returnCodes error -result {couldn't recognize image data}
# Reject corrupted or truncated image [Bug b601ce3ab1].
-# WARNING - tests 18.1-18.9 will cause a segfault on 8.5.19 and lower,
+# WARNING - tests 20.1-20.9 will cause a segfault on 8.5.19 and lower,
# and on 8.6.6 and lower.
-test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -constraints {
- base64PackageNeeded
-} -setup {
- package require base64
- set data [base64::decode {
+test imgPhoto-20.1 {Reject corrupted GIF (binary string)} -setup {
+ set data [binary decode base64 {
R0lGODlhAAQABP8zM/8z/zP/MzP/////M////yH5CiwheLrcLTBCd6Tv2qW16tdK4jhV
5qpraXIvM1JlNyAgOw==
}]
@@ -1964,7 +1956,7 @@ test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.2 {Reject corrupted GIF (base 64 string)} -setup {
+test imgPhoto-20.2 {Reject corrupted GIF (base 64 string)} -setup {
set data {
R0lGODlhAAQABP8zM/8z/zP/MzP/////M////yH5CiwheLrcLTBCd6Tv2qW16tdK4jhV
5qpraXIvM1JlNyAgOw==
@@ -1974,18 +1966,15 @@ test imgPhoto-18.2 {Reject corrupted GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.3 {Reject corrupted GIF (file)} -setup {
+test imgPhoto-20.3 {Reject corrupted GIF (file)} -setup {
set fileName [file join [file dirname [info script]] corruptMangled.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.4 {Reject truncated GIF (binary string)} -constraints {
- base64PackageNeeded
-} -setup {
- package require base64
- set data [base64::decode {
+test imgPhoto-20.4 {Reject truncated GIF (binary string)} -setup {
+ set data [binary decode base64 {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP///8=
}]
} -body {
@@ -1993,7 +1982,7 @@ test imgPhoto-18.4 {Reject truncated GIF (binary string)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.5 {Reject truncated GIF (base 64 string)} -setup {
+test imgPhoto-20.5 {Reject truncated GIF (base 64 string)} -setup {
set data {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP///8=
}
@@ -2002,22 +1991,21 @@ test imgPhoto-18.5 {Reject truncated GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.6 {Reject truncated GIF (file)} -setup {
+test imgPhoto-20.6 {Reject truncated GIF (file)} -setup {
set fileName [file join [file dirname [info script]] corruptTruncated.gif]
} -body {
image create photo gif1 -file $fileName
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map}
-test imgPhoto-18.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
- base64PackageNeeded nonPortable
+test imgPhoto-20.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
+ nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
# If there is insufficient memory, the error message
# {not enough free memory for image buffer} should be returned.
# Instead, some systems (e.g. FreeBSD 11.1) terminate the test interpreter.
- package require base64
- set data [base64::decode {
+ set data [binary decode base64 {
R0lGODlhwmYz//8zM/8z/zP/MzP/////M////yH5Ciwhe
LrcLTBCd6Tv2qW16tdK4jhV5qpraXIvM1JlNyAgOw==
}]
@@ -2026,7 +2014,7 @@ test imgPhoto-18.7 {Reject corrupted GIF (> 4Gb) (binary string)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints {
+test imgPhoto-20.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints {
nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
@@ -2042,7 +2030,7 @@ test imgPhoto-18.8 {Reject corrupted GIF (> 4Gb) (base 64 string)} -constraints
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
+test imgPhoto-20.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
nonPortable
} -setup {
# About the non portability constraint of this test: see ticket [cc42cc18a5]
@@ -2055,14 +2043,11 @@ test imgPhoto-18.9 {Reject corrupted GIF (> 4Gb) (file)} -constraints {
} -cleanup {
catch {image delete gif1}
} -returnCodes error -result {error reading color map|not enough free memory for image buffer} -match regexp
-test imgPhoto-18.10 {Valid GIF (binary string)} -constraints {
- base64PackageNeeded
-} -setup {
+test imgPhoto-20.10 {Valid GIF (binary string)} -setup {
# Test the binary string reader with a valid GIF.
# This is not tested elsewhere.
- # Tests 18.11, 18.12, with matching data, are included for completeness.
- package require base64
- set data [base64::decode {
+ # Tests 20.11, 20.12, with matching data, are included for completeness.
+ set data [binary decode base64 {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP/////M////yH5BAEKAAcALAAA
AAAQABAAAAMheLrcLTBCd6QV79qlterXB0riOFXmmapraXIvM1IdZTcJADs=
}]
@@ -2071,7 +2056,7 @@ test imgPhoto-18.10 {Valid GIF (binary string)} -constraints {
} -cleanup {
catch {image delete gif1}
} -result gif1
-test imgPhoto-18.11 {Valid GIF (base 64 string)} -setup {
+test imgPhoto-20.11 {Valid GIF (base 64 string)} -setup {
set data {
R0lGODlhEAAQAMIHAAAAADMz//8zM/8z/zP/MzP/////M////yH5BAEKAAcALAAA
AAAQABAAAAMheLrcLTBCd6QV79qlterXB0riOFXmmapraXIvM1IdZTcJADs=
@@ -2081,7 +2066,7 @@ test imgPhoto-18.11 {Valid GIF (base 64 string)} -setup {
} -cleanup {
catch {image delete gif1}
} -result gif1
-test imgPhoto-18.12 {Valid GIF (file)} -setup {
+test imgPhoto-20.12 {Valid GIF (file)} -setup {
set fileName [file join [file dirname [info script]] red.gif]
} -body {
image create photo gif1 -file $fileName
diff --git a/tests/imgSVGnano.test b/tests/imgSVGnano.test
index ff7046a..e2789c2 100644
--- a/tests/imgSVGnano.test
+++ b/tests/imgSVGnano.test
@@ -2,7 +2,7 @@
# and write SVG-format image files for photo widgets. The files is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 2018 Rene Zaumseil
+# Copyright © 2018 Rene Zaumseil
# All rights reserved.
package require tcltest 2.2
@@ -158,7 +158,7 @@ test imgSVGnano-3.7 {Option -scaletowidth} -body {
image width foo
} -cleanup {
rename foo ""
-} -result {20}
+} -result 20
test imgSVGnano-3.8 {Option -scaletoheight} -body {
image create photo foo -format "svg -scaletoheight 20"\
@@ -166,7 +166,7 @@ test imgSVGnano-3.8 {Option -scaletoheight} -body {
image height foo
} -cleanup {
rename foo ""
-} -result {20}
+} -result 20
test imgSVGnano-3.10 {change from -scaletoheight to -scale} -body {
set res {}
@@ -207,6 +207,34 @@ test imgSVGnano-4.2 {error on file not accessible on reread due to configure} -s
tcltest::removeFile tmpplus.svg
} -returnCodes error -match glob -result {couldn't open "*/tmpplus.svg": no such file or directory}
+# Special images
+test imgSVGnano-5.0 {image without any of "width", "height" and "viewbox"} -body {
+ image create photo foo -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\"\
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <svg xmlns="http://www.w3.org/2000/svg">\
+ <g style="fill-opacity:0.7;">\
+ <circle cx="6.5cm" cy="2cm" r="100" style="fill:green;\
+ stroke:black; stroke-width:0.1cm" transform="translate(-70,150)"/>\
+ </g></svg>}
+} -cleanup {
+ rename foo ""
+} -result {foo}
+
+test imgSVGnano-5.1 {bug ea665e08f3 - too many values in parameters of the transform attribute} -body {
+ # shall not loop endlessly
+ image create photo foo -data\
+ {<?xml version="1.0"?><!DOCTYPE svg PUBLIC\
+ "-//W3C//DTD SVG 1.0//EN\"\
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\
+ <svg xmlns="http://www.w3.org/2000/svg">\
+ <circle cx="6.5cm" cy="2cm" r="100" transform="skewX(1 1)"/>\
+ </g></svg>}
+} -cleanup {
+ rename foo ""
+} -result {foo}
+
};# end of namespace svgnano
namespace delete svgnano
diff --git a/tests/listbox.test b/tests/listbox.test
index 98ec96c..5afeddd 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "listbox" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1993-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -376,15 +376,15 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body {
test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate -1
.l index active
-} -result {0}
+} -result 0
test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate 30
.l index active
-} -result {17}
+} -result 17
test listbox-3.8 {ListboxWidgetCmd procedure, "activate" option} -body {
.l activate end
.l index active
-} -result {17}
+} -result 17
test listbox-3.9 {ListboxWidgetCmd procedure, "bbox" option} -body {
.l bbox
} -returnCodes error -result {wrong # args: should be ".l bbox index"}
@@ -508,7 +508,7 @@ test listbox-3.18b {ListboxWidgetCmd procedure, "bbox" option, justified, non-de
} -cleanup {
destroy .top.l .top
unset -nocomplain lres res
-} -result {1}
+} -result 1
test listbox-3.19 {ListboxWidgetCmd procedure, "cget" option} -body {
.l cget
} -returnCodes error -result {wrong # args: should be ".l cget option"}
@@ -520,10 +520,10 @@ test listbox-3.21 {ListboxWidgetCmd procedure, "cget" option} -body {
} -returnCodes error -result {unknown option "-gorp"}
test listbox-3.22 {ListboxWidgetCmd procedure, "cget" option} -body {
.l cget -setgrid
-} -result {0}
+} -result 0
test listbox-3.23 {ListboxWidgetCmd procedure, "configure" option} -body {
llength [.l configure]
-} -result {28}
+} -result 28
test listbox-3.24 {ListboxWidgetCmd procedure, "configure" option} -body {
.l configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
@@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 2
+ .l2 delete -1 2
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup {
} -body {
listbox .l2
.l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7
- .l2 delete -3 -1
+ .l2 delete -1 -1
.l2 get 0 end
} -cleanup {
destroy .l2
@@ -684,10 +684,10 @@ test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body {
.l get -1
} -result {}
test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 -1
+ .l get -1 -1
} -result {}
test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body {
- .l get -2 3
+ .l get -1 3
} -result {el0 el1 el2 el3}
test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body {
.l get 12 end
@@ -718,7 +718,7 @@ test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body {
} -result 2
test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body {
.l index -1
-} -result {-1}
+} -result -1
test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body {
.l index end
} -result 18
@@ -783,7 +783,7 @@ test listbox-3.72 {ListboxWidgetCmd procedure, "nearest" option} -body {
test listbox-3.73 {ListboxWidgetCmd procedure, "nearest" option} -body {
.l yview 3
.l nearest 1000
-} -result {7}
+} -result 7
test listbox-3.74 {ListboxWidgetCmd procedure, "scan" option} -body {
.l scan a b
} -returnCodes error -result {wrong # args: should be ".l scan mark|dragto x y"}
@@ -830,52 +830,52 @@ test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 7
.l index @0,0
-} -result {7}
+} -result 7
test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 11
.l index @0,0
-} -result {7}
+} -result 7
test listbox-3.85 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 6
.l index @0,0
-} -result {6}
+} -result 6
test listbox-3.86 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 5
.l index @0,0
-} -result {3}
+} -result 3
test listbox-3.87 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 12
.l index @0,0
-} -result {8}
+} -result 8
test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 13
.l index @0,0
-} -result {11}
+} -result 11
test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see -1
.l index @0,0
-} -result {0}
+} -result 0
test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see end
.l index @0,0
-} -result {13}
+} -result 13
test listbox-3.91 {ListboxWidgetCmd procedure, "see" option} -body {
.l yview 7
.l see 322
.l index @0,0
-} -result {13}
+} -result 13
test listbox-3.92 {ListboxWidgetCmd procedure, "see" option, partial last line} -body {
mkPartial
.partial.l see 4
.partial.l index @0,0
-} -result {1}
+} -result 1
test listbox-3.93 {ListboxWidgetCmd procedure, "selection" option} -body {
.l select a
} -returnCodes error -result {wrong # args: should be ".l selection option index ?index?"}
@@ -898,15 +898,15 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body {
test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor -1
.l index anchor
-} -result {0}
+} -result 0
test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor end
.l index anchor
-} -result {17}
+} -result 17
test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection anchor 44
.l index anchor
-} -result {17}
+} -result 17
test listbox-3.102 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set 2 8
@@ -926,16 +926,16 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body {
test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection set 0 end
.l selection includes -1
-} -result {0}
+} -result 0
test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set end
.l selection includes end
-} -result {1}
+} -result 1
test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection set 0 end
.l selection includes 44
-} -result {0}
+} -result 0
test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup {
destroy .l2
} -body {
@@ -943,7 +943,7 @@ test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} -setup {
.l2 selection includes 0
} -cleanup {
destroy .l2
-} -result {0}
+} -result 0
test listbox-3.109 {ListboxWidgetCmd procedure, "selection" option} -body {
.l selection clear 0 end
.l selection set 2
@@ -965,7 +965,7 @@ test listbox-3.112 {ListboxWidgetCmd procedure, "size" option} -body {
} -returnCodes error -result {wrong # args: should be ".l size"}
test listbox-3.113 {ListboxWidgetCmd procedure, "size" option} -body {
.l size
-} -result {18}
+} -result 18
test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} -setup {
destroy .l2
} -body {
@@ -1242,7 +1242,7 @@ test listbox-4.2 {ConfigureListbox procedure} -setup {
.l cget -highlightthickness
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test listbox-4.3 {ConfigureListbox procedure} -setup {
deleteWindows
destroy .l
@@ -1573,14 +1573,14 @@ test listbox-6.2 {InsertEls procedure} -body {
.l selection anchor 2
.l insert 2 A B
.l index anchor
-} -result {4}
+} -result 4
test listbox-6.3 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 2
.l insert 3 A B
.l index anchor
-} -result {2}
+} -result 2
test listbox-6.4 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1588,7 +1588,7 @@ test listbox-6.4 {InsertEls procedure} -body {
update
.l insert 2 A B
.l index @0,0
-} -result {5}
+} -result 5
test listbox-6.5 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1596,31 +1596,31 @@ test listbox-6.5 {InsertEls procedure} -body {
update
.l insert 3 A B
.l index @0,0
-} -result {3}
+} -result 3
test listbox-6.6 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 5
.l insert 5 A B
.l index active
-} -result {7}
+} -result 7
test listbox-6.7 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 5
.l insert 6 A B
.l index active
-} -result {5}
+} -result 5
test listbox-6.8 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b c
.l index active
-} -result {2}
+} -result 2
test listbox-6.9 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0
.l index active
-} -result {0}
+} -result 0
test listbox-6.10 {InsertEls procedure} -body {
.l delete 0 end
.l insert 0 a b "two words" c d e f g h i j
@@ -1728,28 +1728,28 @@ test listbox-7.5 {DeleteEls procedure} -body {
.l selection anchor 2
.l delete 0 1
.l index anchor
-} -result {0}
+} -result 0
test listbox-7.6 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 2
.l delete 2
.l index anchor
-} -result {2}
+} -result 2
test listbox-7.7 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 4
.l delete 2 5
.l index anchor
-} -result {2}
+} -result 2
test listbox-7.8 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l selection anchor 3
.l delete 4 5
.l index anchor
-} -result {3}
+} -result 3
test listbox-7.9 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1757,7 +1757,7 @@ test listbox-7.9 {DeleteEls procedure} -body {
update
.l delete 1 2
.l index @0,0
-} -result {1}
+} -result 1
test listbox-7.10 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1765,7 +1765,7 @@ test listbox-7.10 {DeleteEls procedure} -body {
update
.l delete 3 4
.l index @0,0
-} -result {3}
+} -result 3
test listbox-7.11 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1773,7 +1773,7 @@ test listbox-7.11 {DeleteEls procedure} -body {
update
.l delete 4 6
.l index @0,0
-} -result {3}
+} -result 3
test listbox-7.12 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
@@ -1781,42 +1781,42 @@ test listbox-7.12 {DeleteEls procedure} -body {
update
.l delete 3 end
.l index @0,0
-} -result {1}
+} -result 1
test listbox-7.13 {DeleteEls procedure, updating view with partial last line} -body {
mkPartial
.partial.l yview 8
update
.partial.l delete 10 13
.partial.l index @0,0
-} -result {7}
+} -result 7
test listbox-7.14 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 3 4
.l index active
-} -result {4}
+} -result 4
test listbox-7.15 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 5 7
.l index active
-} -result {5}
+} -result 5
test listbox-7.16 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 5 end
.l index active
-} -result {4}
+} -result 4
test listbox-7.17 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c d e f g h i j
.l activate 6
.l delete 0 end
.l index active
-} -result {0}
+} -result 0
test listbox-7.18 {DeleteEls procedure} -body {
.l delete 0 end
.l insert 0 a b c "two words" d e f g h i j
@@ -1987,7 +1987,7 @@ test listbox-10.5 {GetListboxIndex procedure} -setup {
.l index end
} -cleanup {
destroy .l
-} -result {12}
+} -result 12
test listbox-10.6 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2102,7 +2102,7 @@ test listbox-10.16 {GetListboxIndex procedure} -setup {
.l index 3
} -cleanup {
destroy .l
-} -result {3}
+} -result 3
test listbox-10.17 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2112,7 +2112,7 @@ test listbox-10.17 {GetListboxIndex procedure} -setup {
.l index 20
} -cleanup {
destroy .l
-} -result {12}
+} -result 12
test listbox-10.18 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2129,10 +2129,10 @@ test listbox-10.19 {GetListboxIndex procedure} -setup {
pack [listbox .l]
.l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11
update
- .l index -2
+ .l index -1
} -cleanup {
destroy .l
-} -result -1
+} -result -1
test listbox-10.20 {GetListboxIndex procedure} -setup {
destroy .l
} -body {
@@ -2226,7 +2226,7 @@ test listbox-11.6 {ChangeListboxView procedure, partial last line} -body {
.partial.l index @0,0
} -cleanup {
destroy .l
-} -result {11}
+} -result 11
# Listbox used in 12.* tests
@@ -2314,7 +2314,7 @@ test listbox-13.3 {ListboxScanTo procedure} -constraints {
test listbox-14.1 {NearestListboxElement procedure, partial last line} -body {
mkPartial
.partial.l nearest [winfo height .partial.l]
-} -result {4}
+} -result 4
# Listbox used in 14.* tests
destroy .l
listbox .l -font $fixed -width 20 -height 10
@@ -2326,7 +2326,7 @@ test listbox-14.2 {NearestListboxElement procedure} -constraints {
fonts
} -body {
.l index @50,0
-} -result {4}
+} -result 4
test listbox-14.3 {NearestListboxElement procedure} -constraints {
fonts
} -body {
@@ -2336,7 +2336,7 @@ test listbox-14.4 {NearestListboxElement procedure} -constraints {
fonts
} -body {
.l index @50,200
-} -result {13}
+} -result 13
# Listbox used in 15.* 16.* and 17.* tests
@@ -2378,7 +2378,7 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo
.l delete 0 end
.l insert 0 a b c d e f
.l select clear 0 end
- .l select set -2 -1
+ .l select set -1 -1
.l curselection
} -result {}
test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body {
@@ -2415,7 +2415,7 @@ test listbox-15.9 {ListboxSelect procedure, boundary conditions for indices} -bo
.l select clear 0 end
.l select set end 30
.l curselection
-} -result {5}
+} -result 5
test listbox-15.10 {ListboxSelect procedure, boundary conditions for indices} -body {
.l delete 0 end
.l insert 0 a b c d e f
@@ -2451,7 +2451,7 @@ test listbox-16.3 {ListboxFetchSelection procedure, retrieve in several parts} -
string compare 1$long\n2$long\n3$long\n4$long\n5$long $sel
} -cleanup {
catch {unset long sel}
-} -result {0}
+} -result 0
test listbox-17.1 {ListboxLostSelection procedure} -setup {
@@ -2662,41 +2662,37 @@ test listbox-21.8 {ListboxListVarProc, test selection after listvar mod} -setup
test listbox-21.9 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
- catch {unset x}
+ set x {}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5}]
+} -result [list {x 0 1} {x 0 0.5}]
test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} -setup {
destroy .l
} -body {
catch {unset x}
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
lappend x "0000000000"
- update
+ update idletasks
lappend x "00000000000000000000"
- update
+ update idletasks
set x [list "0000000000"]
- update
+ update idletasks
set log
} -cleanup {
destroy .l
- after cancel timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5} {x 0 1}]
+} -result [list {x 0 1} {x 0 0.5} {x 0 1}]
test listbox-21.11 {ListboxListVarProc, bad list} -setup {
destroy .l
} -body {
@@ -2764,7 +2760,7 @@ test listbox-21.15 {ListboxListVarProc, update vertical scrollbar} -setup {
update
set log {}
pack .l
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout3}]
vwait log
update
lappend x a b c d e f
@@ -2801,19 +2797,19 @@ test listbox-22.1 {UpdateHScrollbar} -setup {
destroy .l
} -body {
listbox .l -font $fixed -width 10 -xscrollcommand "record x"
- set log {}
pack .l
- set timeout [after 500 {set log timeout}]
- vwait log
+ update idletasks
+ set log {}
+ set timeout [after 500 {lappend log timeout4}]
.l insert end "0000000000"
- update
+ vwait log
.l insert end "00000000000000000000"
vwait log
set log
} -cleanup {
destroy .l
after cancel $timeout
-} -result [list {x 0 1} {x 0 1} {x 0 0.5}]
+} -result [list {x 0 1} {x 0 0.5}]
# ConfigureListboxItem
@@ -2858,7 +2854,7 @@ test listbox-23.4 {ConfigureListboxItem, wrong num args} -setup {
set result
} -cleanup {
destroy .l
-} -result {wrong # args: should be ".l itemconfigure index ?-option? ?value? ?-option value ...?"}
+} -result {wrong # args: should be ".l itemconfigure index ?-option value ...?"}
test listbox-23.5 {ConfigureListboxItem, multiple calls} -setup {
destroy .l
} -body {
@@ -3221,8 +3217,3 @@ option clear
# cleanup
cleanupTests
return
-
-
-
-
-
diff --git a/tests/main.test b/tests/main.test
index deb0783..19bbf5a 100644
--- a/tests/main.test
+++ b/tests/main.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1997 by Sun Microsystems, Inc.
+# Copyright © 1997 by Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
@@ -27,8 +27,7 @@ test main-2.1 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]; exit"
+ puts $f {puts [string equal \u20AC €]; exit}
close $f
catch {set f [open "|[list [interpreter] -encoding utf-8 script]" r]}
} -body {
@@ -44,8 +43,7 @@ test main-2.2 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]; exit"
+ puts $f {puts [string equal \u20AC €]; exit}
close $f
catch {set f [open "|[list [interpreter] -encoding ascii script]" r]}
} -body {
@@ -76,8 +74,7 @@ test main-2.3 {Tk_MainEx: -encoding option} -constraints stdio -setup {
set f [open $script w]
fconfigure $f -encoding utf-8
puts $f {puts [list $argv0 $argv $tcl_interactive]}
- puts -nonewline $f {puts [string equal \u20ac }
- puts $f "\u20ac]"
+ puts $f {puts [string equal \u20AC €]}
close $f
catch {set f [open "|[list [interpreter] -enc utf-8 script]" r+]}
} -body {
diff --git a/tests/menu.test b/tests/menu.test
index 5d4884c..fee5079 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test menus in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -270,11 +270,11 @@ test menu-2.27 {configuration options -takefocus {any string}} -body {
test menu-2.28 {configuration options -tearoff 0} -body {
.m1 configure -tearoff 0
.m1 cget -tearoff
-} -result {0}
+} -result 0
test menu-2.29 {configuration options -tearoff 1} -body {
.m1 configure -tearoff 1
.m1 cget -tearoff
-} -result {1}
+} -result 1
test menu-2.30 {configuration options -tearoffcommand {any old string}} -body {
.m1 configure -tearoffcommand {any old string}
.m1 cget -tearoffcommand
@@ -545,12 +545,12 @@ test menu-2.85 {entry configuration options 0 -columnbreak 1 tearoff} -body {
test menu-2.86 {entry configuration options 1 -columnbreak 1 command} -body {
.m1 entryconfigure 1 -columnbreak 1
lindex [.m1 entryconfigure 1 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.87 {entry configuration options 2 -columnbreak 1 cascade} -body {
.m1 entryconfigure 2 -columnbreak 1
lindex [.m1 entryconfigure 2 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.88 {entry configuration options 3 -columnbreak 1 separator} -body {
.m1 entryconfigure 3 -columnbreak 1
@@ -559,12 +559,12 @@ test menu-2.88 {entry configuration options 3 -columnbreak 1 separator} -body {
test menu-2.89 {entry configuration options 4 -columnbreak 1 checkbutton} -body {
.m1 entryconfigure 4 -columnbreak 1
lindex [.m1 entryconfigure 4 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.90 {entry configuration options 5 -columnbreak 1 radiobutton} -body {
.m1 entryconfigure 5 -columnbreak 1
lindex [.m1 entryconfigure 5 -columnbreak] 4
-} -result {1}
+} -result 1
test menu-2.91 {entry configuration options 0 -command beep tearoff} -body {
.m1 entryconfigure 0 -command beep
@@ -829,12 +829,12 @@ test menu-2.142 {entry configuration options 3 -indicatoron 1 separator} -body {
test menu-2.143 {entry configuration options 4 -indicatoron 1 checkbutton} -body {
.m1 entryconfigure 4 -indicatoron 1
lindex [.m1 entryconfigure 4 -indicatoron] 4
-} -result {1}
+} -result 1
test menu-2.144 {entry configuration options 5 -indicatoron 1 radiobutton} -body {
.m1 entryconfigure 5 -indicatoron 1
lindex [.m1 entryconfigure 5 -indicatoron] 4
-} -result {1}
+} -result 1
test menu-2.145 {entry configuration options 0 -label test tearoff} -body {
.m1 entryconfigure 0 -label test
@@ -1172,12 +1172,12 @@ test menu-2.217 {entry configuration options 0 -underline 0 tearoff} -body {
test menu-2.218 {entry configuration options 1 -underline 0 command} -body {
.m1 entryconfigure 1 -underline 0
lindex [.m1 entryconfigure 1 -underline] 4
-} -result {0}
+} -result 0
test menu-2.219 {entry configuration options 2 -underline 0 cascade} -body {
.m1 entryconfigure 2 -underline 0
lindex [.m1 entryconfigure 2 -underline] 4
-} -result {0}
+} -result 0
test menu-2.220 {entry configuration options 3 -underline 0 separator} -body {
.m1 entryconfigure 3 -underline 0
@@ -1186,12 +1186,12 @@ test menu-2.220 {entry configuration options 3 -underline 0 separator} -body {
test menu-2.221 {entry configuration options 4 -underline 0 checkbutton} -body {
.m1 entryconfigure 4 -underline 0
lindex [.m1 entryconfigure 4 -underline] 4
-} -result {0}
+} -result 0
test menu-2.222 {entry configuration options 5 -underline 0 radiobutton} -body {
.m1 entryconfigure 5 -underline 0
lindex [.m1 entryconfigure 5 -underline] 4
-} -result {0}
+} -result 0
test menu-2.223 {entry configuration options 0 -underline 3p tearoff} -body {
.m1 entryconfigure 0 -underline 3p
@@ -1367,7 +1367,7 @@ test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup {
llength [.m1 configure]
} -cleanup {
destroy .m1
-} -result {21}
+} -result 21
test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup {
destroy .m1
} -body {
@@ -1519,7 +1519,7 @@ test menu-3.36 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
llength [.m1 entryconfigure 1]
} -cleanup {
destroy .m1
-} -result {15}
+} -result 15
test menu-3.37 {MenuWidgetCmd procedure, "entryconfigure" option} -setup {
destroy .m1
} -body {
@@ -1787,7 +1787,7 @@ test menu-3.66a {MenuWidgetCmd procedure, "yposition" option, no tearoff} -setup
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {0}
+} -result 0
test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
notAqua
} -setup {
@@ -1799,7 +1799,7 @@ test menu-3.66b {MenuWidgetCmd procedure, "yposition" option, with tearoff} -con
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {1}
+} -result 1
test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -constraints {
aqua
} -setup {
@@ -1811,7 +1811,7 @@ test menu-3.66c {MenuWidgetCmd procedure, "yposition" option, with tearoff} -con
.m1 yposition 1
} -cleanup {
destroy .m1
-} -result {0}
+} -result 0
test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup {
destroy .m1
} -body {
@@ -1858,6 +1858,14 @@ test menu-3.70 {MenuWidgetCmd procedure, "xposition" option} -setup {
} -cleanup {
destroy .m1
} -result {}
+test menu-3.71 {MenuWidgetCmd procedure, "index end" option, bug [f3cd942e9e]} -setup {
+ destroy .m1
+} -body {
+ menu .m1
+ list [.m1 index "end"]
+} -cleanup {
+ destroy .m1
+} -result none
test menu-4.1 {TkInvokeMenu: disabled} -setup {
@@ -1878,7 +1886,7 @@ test menu-4.2 {TkInvokeMenu: tearoff} -setup {
catch {.m1 invoke 0}
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup {
destroy .m1
} -body {
@@ -2060,7 +2068,7 @@ test menu-5.8 {DestroyMenuInstance - multiple clones} -setup {
set tearoff2 [tk::TearOffMenu .m1]
list [destroy $tearoff1] [destroy .m1]
} -returnCodes ok -result {{} {}}
-test menu-5.9 {DestroyMenuInstace - master menu} -setup {
+test menu-5.9 {DestroyMenuInstace - main menu} -setup {
destroy .m1
} -body {
menu .m1
@@ -2139,7 +2147,7 @@ test menu-6.5 {TkDestroyMenu} -setup {
.m1 clone .m2
destroy .m1
winfo exists .m2
-} -result {0}
+} -result 0
test menu-6.6 {TkDestroyMenu} -setup {
destroy .m1 .m2
} -body {
@@ -3375,7 +3383,7 @@ test menu-22.1 {GetIndexFromCoords} -setup {
.m1 index @5
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-22.2 {GetIndexFromCoords} -setup {
deleteWindows
} -body {
@@ -3385,7 +3393,7 @@ test menu-22.2 {GetIndexFromCoords} -setup {
.m1 index @5,5
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
deleteWindows
} -constraints {x11} -body {
@@ -3397,7 +3405,7 @@ test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
.m1 index @5
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
deleteWindows
} -constraints {x11} -body {
@@ -3411,7 +3419,7 @@ test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
.m1 index @$x,5
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
deleteWindows
} -constraints {x11} -body {
@@ -3426,7 +3434,7 @@ test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
.m1 index @$x,5
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test menu-23.1 {RecursivelyDeleteMenu} -setup {
deleteWindows
@@ -3965,7 +3973,7 @@ test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over
winfo ismapped .top.mb.m
} -cleanup {
destroy .top.mb.m .top.m .top
-} -result {0}
+} -result 0
# cleanup
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 9382974..fd79a8c 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test drawing of menus in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -561,7 +561,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup {
$tearoff index active
} -cleanup {
deleteWindows
-} -result {none}
+} -result none
test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup {
deleteWindows
} -body {
diff --git a/tests/menubut.test b/tests/menubut.test
index d245fd0..92c16b3 100644
--- a/tests/menubut.test
+++ b/tests/menubut.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test menubuttons in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
# XXX This test file is woefully incomplete right now. If any part
@@ -71,7 +71,7 @@ test menubutton-1.9 {configuration options} -body {
.mb cget -bd
} -cleanup {
.mb configure -bd [lindex [.mb configure -bd] 3]
-} -result {4}
+} -result 4
test menubutton-1.10 {configuration options} -body {
.mb configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -98,7 +98,7 @@ test menubutton-1.15 {configuration options} -body {
.mb cget -borderwidth
} -cleanup {
.mb configure -borderwidth [lindex [.mb configure -borderwidth] 3]
-} -result {1}
+} -result 1
test menubutton-1.16 {configuration options} -body {
.mb configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -158,7 +158,7 @@ test menubutton-1.28 {configuration options} -body {
.mb cget -height
} -cleanup {
.mb configure -height [lindex [.mb configure -height] 3]
-} -result {18}
+} -result 18
test menubutton-1.29 {configuration options} -body {
.mb configure -height 20.0
} -returnCodes error -result {expected integer but got "20.0"}
@@ -185,7 +185,7 @@ test menubutton-1.34 {configuration options} -body {
.mb cget -highlightthickness
} -cleanup {
.mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3]
-} -result {18}
+} -result 18
test menubutton-1.35 {configuration options} -body {
.mb configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -213,7 +213,7 @@ test menubutton-1.38 {configuration options} -body {
.mb cget -indicatoron
} -cleanup {
.mb configure -indicatoron [lindex [.mb configure -indicatoron] 3]
-} -result {1}
+} -result 1
test menubutton-1.39 {configuration options} -body {
.mb configure -indicatoron no_way
} -returnCodes error -result {expected boolean value but got "no_way"}
@@ -237,7 +237,7 @@ test menubutton-1.43 {configuration options} -body {
.mb cget -padx
} -cleanup {
.mb configure -padx [lindex [.mb configure -padx] 3]
-} -result {12}
+} -result 12
test menubutton-1.44 {configuration options} -body {
.mb configure -padx 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -246,7 +246,7 @@ test menubutton-1.45 {configuration options} -body {
.mb cget -pady
} -cleanup {
.mb configure -pady [lindex [.mb configure -pady] 3]
-} -result {12}
+} -result 12
test menubutton-1.46 {configuration options} -body {
.mb configure -pady 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -291,7 +291,7 @@ test menubutton-1.54 {configuration options} -body {
.mb cget -underline
} -cleanup {
.mb configure -underline [lindex [.mb configure -underline] 3]
-} -result {5}
+} -result 5
test menubutton-1.55 {configuration options} -body {
.mb configure -underline 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -300,7 +300,7 @@ test menubutton-1.56 {configuration options} -body {
.mb cget -width
} -cleanup {
.mb configure -width [lindex [.mb configure -width] 3]
-} -result {402}
+} -result 402
test menubutton-1.57 {configuration options} -body {
.mb configure -width 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -309,7 +309,7 @@ test menubutton-1.58 {configuration options} -body {
.mb cget -wraplength
} -cleanup {
.mb configure -wraplength [lindex [.mb configure -wraplength] 3]
-} -result {100}
+} -result 100
test menubutton-1.59 {configuration options} -body {
.mb configure -wraplength 6x
} -returnCodes error -result {bad screen distance "6x"}
@@ -364,10 +364,10 @@ test menubutton-3.5 {ButtonWidgetCmd procedure, "cget" option} -body {
test menubutton-3.6 {ButtonWidgetCmd procedure, "cget" option} -body {
.mb configure -highlightthickness 3
.mb cget -highlightthickness
-} -result {3}
+} -result 3
test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} -body {
llength [.mb configure]
-} -result {33}
+} -result 33
test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} -body {
.mb configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
diff --git a/tests/message.test b/tests/message.test
index 2ca6921..a547e4e 100644
--- a/tests/message.test
+++ b/tests/message.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "message" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 by Ajuba Solutions.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-2000 by Ajuba Solutions.
# All rights reserved.
package require tcltest 2.2
@@ -41,7 +41,7 @@ test message-1.3 {configuration option: "aspect"} -setup {
.m cget -aspect
} -cleanup {
destroy .m
-} -result {3}
+} -result 3
test message-1.4 {configuration option: "aspect"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -81,7 +81,7 @@ test message-1.7 {configuration option: "bd"} -setup {
.m cget -bd
} -cleanup {
destroy .m
-} -result {4}
+} -result 4
test message-1.8 {configuration option: "bd"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -121,7 +121,7 @@ test message-1.11 {configuration option: "borderwidth"} -setup {
.m cget -borderwidth
} -cleanup {
destroy .m
-} -result {1}
+} -result 1
test message-1.12 {configuration option: "borderwidth"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -261,7 +261,7 @@ test message-1.25 {configuration option: "highlightthickness"} -setup {
.m cget -highlightthickness
} -cleanup {
destroy .m
-} -result {2}
+} -result 2
test message-1.26 {configuration option: "highlightthickness"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -383,7 +383,7 @@ test message-1.37 {configuration option: "width"} -setup {
.m cget -width
} -cleanup {
destroy .m
-} -result {2}
+} -result 2
test message-1.38 {configuration option: "width"} -setup {
message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .m
@@ -452,7 +452,7 @@ test message-3.5 {MessageWidgetObjCmd procedure, "configure"} -setup {
llength [.m configure]
} -cleanup {
destroy .m
-} -result {21}
+} -result 21
test message-3.6 {MessageWidgetObjCmd procedure, "configure"} -setup {
message .m
} -body {
@@ -468,7 +468,7 @@ test message-3.7 {MessageWidgetObjCmd procedure, "configure"} -setup {
lindex [.m configure -bd] 4
} -cleanup {
destroy .m
-} -result {4}
+} -result 4
test message-4.1 {Bug [5d991b822e]} {
# Want this not to segfault, or write to variable with empty name
diff --git a/tests/msgbox.test b/tests/msgbox.test
index 8fd0dae..465df05 100644
--- a/tests/msgbox.test
+++ b/tests/msgbox.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out Tk's "tk_messageBox" command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/obj.test b/tests/obj.test
index eece58e..a2a9148 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test new object types in Tk.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/oldpack.test b/tests/oldpack.test
index 72ec065..68a56a0 100644
--- a/tests/oldpack.test
+++ b/tests/oldpack.test
@@ -2,9 +2,9 @@
# "pack" command (before release 3.3). It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1991-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1991-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -30,8 +30,13 @@ frame .pack.violet -width 80 -height 20
label .pack.violet.l -text P -bd 2 -relief raised
place .pack.violet.l -relwidth 1.0 -relheight 1.0
+if {![catch {pack ap .pack .pack.red top}]} {
+
+# Don't execute any of this file if Tk is compiled with -DTCL_NO_DEPRECATED
+
+
test oldpack-1.1 {basic positioning} -body {
- pack ap .pack .pack.red top
+ #pack ap .pack .pack.red top
update
winfo geometry .pack.red
} -result 10x20+45+0
@@ -452,10 +457,10 @@ test oldpack-8.2 {syntax errors} -body {
} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"}
test oldpack-8.3 {syntax errors} -body {
pack gorp foo
-} -returnCodes error -result {bad option "gorp": must be configure, forget, info, propagate, or slaves}
+} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, or propagate}
test oldpack-8.4 {syntax errors} -body {
pack a .pack
-} -returnCodes error -result {bad option "a": must be configure, forget, info, propagate, or slaves}
+} -returnCodes error -result {bad option "a": must be configure, content, forget, info, or propagate}
test oldpack-8.5 {syntax errors} -body {
pack after foobar
} -returnCodes error -result {bad window path name "foobar"}
@@ -492,7 +497,7 @@ test oldpack-8.12 {syntax errors} -body {
} -returnCodes error -result {wrong # args: window ".pack.blue" should be followed by options}
test oldpack-8.13 {syntax errors} -body {
pack append . .pack.blue top
-} -returnCodes error -result {can't pack .pack.blue inside .}
+} -returnCodes error -result {can't pack ".pack.blue" inside "."}
test oldpack-8.14 {syntax errors} -body {
pack append .pack .pack.blue f
} -returnCodes error -result {bad option "f": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame}
@@ -527,23 +532,24 @@ test oldpack-9.1 {information output} -body {
pack append .pack .pack.blue {top fillx frame n} \
.pack.red {bottom filly frame s} .pack.green {left fill frame w} \
.pack.violet {right expand frame e}
- list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
+ list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \
[pack info .pack.green] [pack info .pack.violet]
} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor n -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor s -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side bottom} {-in .pack -anchor w -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left} {-in .pack -anchor e -expand 1 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right}}
test oldpack-9.2 {information output} -body {
pack append .pack .pack.blue {padx 10 frame nw} \
.pack.red {pady 20 frame ne} .pack.green {frame se} \
.pack.violet {frame sw}
- list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
+ list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \
[pack info .pack.green] [pack info .pack.violet]
} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor nw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side top} {-in .pack -anchor ne -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top} {-in .pack -anchor se -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor sw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
test oldpack-9.3 {information output} -body {
pack append .pack .pack.blue {frame center} .pack.red {frame center} \
.pack.green {frame c} .pack.violet {frame c}
- list [pack slaves .pack] [pack info .pack.blue] [pack info .pack.red] \
+ list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \
[pack info .pack.green] [pack info .pack.violet]
} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}}
+}
destroy .pack
# cleanup
diff --git a/tests/option.test b/tests/option.test
index 5e1568e..ba5f38c 100644
--- a/tests/option.test
+++ b/tests/option.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the option-handling facilities
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1991-1993 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1991-1993 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -401,7 +401,7 @@ test option-15.10 {database files} -body {
} -returnCodes error -result {missing colon on line 2}
set option3 [file join [testsDirectory] option.file3]
option read $option3
-test option-15.11 {database files} {option get . {x 4} color} br\xf3wn
+test option-15.11 {database files} {option get . {x 4} color} brówn
test option-16.1 {ReadOptionFile} -body {
set option4 [makeFile {} option.file3]
diff --git a/tests/pack.test b/tests/pack.test
index 4a41516..e69dd69 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "pack" command of Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1993 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,6 +11,8 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# Create some test windows.
@@ -868,28 +870,28 @@ test pack-9.1 {window ordering} -setup {
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.a -after .pack.b
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.a .pack.c .pack.d}
test pack-9.2 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.a -after .pack.a
- pack slaves .pack
+ pack content .pack
} -result {.pack.a .pack.b .pack.c .pack.d}
test pack-9.3 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.a -before .pack.d
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.c .pack.a .pack.d}
test pack-9.4 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.d -before .pack.a
- pack slaves .pack
+ pack content .pack
} -result {.pack.d .pack.a .pack.b .pack.c}
test pack-9.5 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -897,42 +899,42 @@ test pack-9.5 {window ordering} -setup {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack propagate .pack.c 0
pack .pack.a -in .pack.c
- list [pack slaves .pack] [pack slaves .pack.c]
+ list [pack content .pack] [pack content .pack.c]
} -result {{.pack.b .pack.c .pack.d} .pack.a}
test pack-9.6 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.a -in .pack
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.c .pack.d .pack.a}
test pack-9.7 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d -side top
pack .pack.a -padx 0
- pack slaves .pack
+ pack content .pack
} -result {.pack.a .pack.b .pack.c .pack.d}
test pack-9.8 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c
pack .pack.d
- pack slaves .pack
+ pack content .pack
} -result {.pack.a .pack.b .pack.c .pack.d}
test pack-9.9 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d
pack .pack.b .pack.d .pack.c -before .pack.a
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.d .pack.c .pack.a}
test pack-9.10 {window ordering} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d
pack .pack.a .pack.c .pack.d .pack.b -after .pack.a
- pack slaves .pack
+ pack content .pack
} -result {.pack.a .pack.c .pack.d .pack.b}
test pack-10.1 {retaining/clearing configuration state} -setup {
@@ -952,19 +954,19 @@ test pack-10.2 {retaining/clearing configuration state} -setup {
pack .pack.a -pady 14
pack info .pack.a
} -result {-in .pack -anchor n -expand 1 -fill both -ipadx 3 -ipady 4 -padx 1 -pady 14 -side bottom}
-test pack-10.3 {bad -in window does not change master} -setup {
+test pack-10.3 {bad -in window does not change container window} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
set result [list [winfo manager .pack.a]]
catch {pack .pack.a -in .pack.a}
lappend result [winfo manager .pack.a]
} -result {{} {}}
-test pack-10.4 {bad -in window does not change master} -setup {
+test pack-10.4 {bad -in window does not change container window} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
winfo manager .pack.a
pack .pack.a -in .pack.a
-} -returnCodes error -result {can't pack .pack.a inside itself}
+} -returnCodes error -result {can't pack ".pack.a" inside itself}
test pack-10.5 {prevent management loops} -body {
frame .f1
frame .f2
@@ -973,7 +975,7 @@ test pack-10.5 {prevent management loops} -body {
} -cleanup {
destroy .f1
destroy .f2
-} -returnCodes error -result {can't put .f2 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f2" inside ".f1": would cause management loop}
test pack-10.6 {prevent management loops} -body {
frame .f1
frame .f2
@@ -985,7 +987,7 @@ test pack-10.6 {prevent management loops} -body {
destroy .f1
destroy .f2
destroy .f3
-} -returnCodes error -result {can't put .f3 inside .f1, would cause management loop}
+} -returnCodes error -result {can't put ".f3" inside ".f1": would cause management loop}
test pack-11.1 {info option} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -1134,7 +1136,7 @@ test pack-12.4 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack configure .pack.b .pack.c
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.c}
test pack-12.5 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -1281,24 +1283,24 @@ test pack-12.33 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a -in .
-} -returnCodes error -result {can't pack .pack.a inside .}
+} -returnCodes error -result {can't pack ".pack.a" inside "."}
test pack-12.34 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
frame .pack.a.a
pack .pack.a.a -in .pack.b
-} -returnCodes error -result {can't pack .pack.a.a inside .pack.b}
+} -returnCodes error -result {can't pack ".pack.a.a" inside ".pack.b"}
test pack-12.35 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a -in .pack.a
-} -returnCodes error -result {can't pack .pack.a inside itself}
+} -returnCodes error -result {can't pack ".pack.a" inside itself}
test pack-12.36 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a .pack.b .pack.c .pack.d
pack forget .pack.a .pack.d
- pack slaves .pack
+ pack content .pack
} -result {.pack.b .pack.c}
test pack-12.37 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -1339,28 +1341,28 @@ test pack-12.41 {command options and errors} -setup {
test pack-12.42 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
- pack slaves
+ pack content
} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"}
test pack-12.43 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
- pack slaves a b
-} -returnCodes error -result {wrong # args: should be "pack slaves window"}
+ pack content a b
+} -returnCodes error -result {wrong # args: should be "pack content window"}
test pack-12.44 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
- pack slaves .x
+ pack content .x
} -returnCodes error -result {bad window path name ".x"}
test pack-12.45 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
- pack slaves .pack.a
+ pack content .pack.a
} -returnCodes ok -result {}
test pack-12.46 {command options and errors} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack lousy .pack
-} -returnCodes error -result {bad option "lousy": must be configure, forget, info, propagate, or slaves}
+} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, or propagate}
test pack-13.1 {window deletion} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom
@@ -1371,7 +1373,7 @@ test pack-13.1 {window deletion} -setup {
update
destroy .pack.d
update
- set result [list [pack slaves .pack] [winfo geometry .pack.a] \
+ set result [list [pack content .pack] [winfo geometry .pack.a] \
[winfo geometry .pack.b] [winfo geometry .pack.c]]
} -result {{.pack.right .pack.bottom .pack.a .pack.b .pack.c} 20x40+30+0 50x30+15+40 80x80+0+70}
@@ -1511,7 +1513,7 @@ test pack-16.1 {geometry manager name} -setup {
lappend result [winfo manager .pack.a]
} -result {{} pack {}}
-test pack-17.1 {PackLostSlaveProc procedure} -setup {
+test pack-17.1 {PackLostContentProc procedure} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a
@@ -1520,7 +1522,7 @@ test pack-17.1 {PackLostSlaveProc procedure} -setup {
update
list [winfo manager .pack.a] [winfo geometry .pack.a]
} -result {place 20x40+40+10}
-test pack-17.2 {PackLostSlaveProc procedure} -setup {
+test pack-17.2 {PackLostContentProc procedure} -setup {
pack forget .pack.a .pack.b .pack.c .pack.d
} -body {
pack .pack.a
@@ -1532,8 +1534,17 @@ test pack-17.2 {PackLostSlaveProc procedure} -setup {
pack info .pack.a
} -returnCodes error -result {window ".pack.a" isn't packed}
-test pack-18.1 {unmap slaves when master unmapped} -constraints {
- tempNotPc
+if {[tk windowingsystem] == "win32"} {
+ proc packUpdate {} {
+ update
+ }
+} else {
+ proc packUpdate {} {
+ }
+}
+
+test pack-18.1 {unmap content when container unmapped} -constraints {
+ tempNotPc failsOnUbuntu failsOnXQuarz
} -setup {
eval destroy [winfo child .pack]
} -body {
@@ -1550,20 +1561,20 @@ test pack-18.1 {unmap slaves when master unmapped} -constraints {
eval destroy [winfo child .pack]
frame .pack.a -width 100 -height 50 -relief raised -bd 2
pack .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.a]
wm iconify .pack
- update
lappend result [winfo ismapped .pack.a]
.pack.a configure -width 200 -height 75
- update
+ update idletasks
lappend result [winfo width .pack.a ] [winfo height .pack.a] \
[winfo ismapped .pack.a]
wm deiconify .pack
- update
+ packUpdate
lappend result [winfo ismapped .pack.a]
} -result {1 0 200 75 0 1}
-test pack-18.2 {unmap slaves when master unmapped} -setup {
+
+test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
eval destroy [winfo child .pack]
} -body {
# adjust the position of .pack before test to avoid a screen switch
@@ -1575,22 +1586,21 @@ test pack-18.2 {unmap slaves when master unmapped} -setup {
frame .pack.b -width 70 -height 30 -relief sunken -bd 2
pack .pack.a
pack .pack.b -in .pack.a
- update
+ update idletasks
set result [winfo ismapped .pack.b]
wm iconify .pack
- update
lappend result [winfo ismapped .pack.b]
.pack.b configure -width 100 -height 30
- update
+ update idletasks
lappend result [winfo width .pack.b ] [winfo height .pack.b] \
[winfo ismapped .pack.b]
wm deiconify .pack
- update
+ packUpdate
lappend result [winfo ismapped .pack.b]
} -result {1 0 100 30 0 1}
test pack-19.1 {test respect for internalborder} -setup {
- catch {eval pack forget [pack slaves .pack]}
+ catch {eval pack forget [pack content .pack]}
destroy .pack.l .pack.lf
} -body {
wm geometry .pack 200x200
@@ -1608,7 +1618,7 @@ test pack-19.1 {test respect for internalborder} -setup {
destroy .pack.l .pack.lf
} -result {196x188+2+10 177x186+5+7}
test pack-19.2 {test support for minreqsize} -setup {
- catch {eval pack forget [pack slaves .pack]}
+ catch {eval pack forget [pack content .pack]}
destroy .pack.l .pack.lf
} -body {
wm geometry .pack {}
@@ -1639,7 +1649,7 @@ test pack-20.1 {<<NoManagedChild>> fires on last pack forget} -setup {
} -cleanup {
bind . <<NoManagedChild>> {}
destroy .1
-} -result {1}
+} -result 1
test pack-20.2 {<<NoManagedChild>> fires on last packed child destruction} -setup {
global A
unset -nocomplain A
@@ -1653,7 +1663,7 @@ test pack-20.2 {<<NoManagedChild>> fires on last packed child destruction} -setu
} -cleanup {
bind . <<NoManagedChild>> {}
destroy .1
-} -result {1}
+} -result 1
test pack-20.3 {<Configure> does not fire on last pack forget} -setup {
global A
unset -nocomplain A
@@ -1667,7 +1677,7 @@ test pack-20.3 {<Configure> does not fire on last pack forget} -setup {
} -cleanup {
bind . <Configure> {}
destroy .1
-} -result {0}
+} -result 0
test pack-20.4 {<<NoManagedChild>> does not fire on forelast pack forget} -setup {
global A
unset -nocomplain A
@@ -1682,7 +1692,7 @@ test pack-20.4 {<<NoManagedChild>> does not fire on forelast pack forget} -setup
} -cleanup {
bind . <<NoManagedChild>> {}
destroy .1 .2
-} -result {0}
+} -result 0
test pack-20.5 {<Configure> does not fire on last pack forget} -setup {
global A
unset -nocomplain A
@@ -1697,7 +1707,7 @@ test pack-20.5 {<Configure> does not fire on last pack forget} -setup {
} -cleanup {
bind . <Configure> {}
destroy .1 .2
-} -result {1}
+} -result 1
test pack-20.6 {<<NoManagedChild>> does not fire on last pack forget if propagation is off} -setup {
global A
unset -nocomplain A
@@ -1712,7 +1722,7 @@ test pack-20.6 {<<NoManagedChild>> does not fire on last pack forget if propagat
} -cleanup {
bind . <<NoManagedChild>> {}
destroy .1
-} -result {0}
+} -result 0
# cleanup
cleanupTests
diff --git a/tests/packgrid.test b/tests/packgrid.test
index 6074ce9..db49f60 100644
--- a/tests/packgrid.test
+++ b/tests/packgrid.test
@@ -2,7 +2,7 @@
# "grid" commands.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 2008 Peter Spjuth
+# Copyright © 2008 Peter Spjuth
# All rights reserved.
package require tcltest 2.2
@@ -10,7 +10,7 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::*
-test packgrid-1.1 {pack and grid in same master} -setup {
+test packgrid-1.1 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -22,9 +22,9 @@ test packgrid-1.1 {pack and grid in same master} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
-test packgrid-1.2 {pack and grid in same master} -setup {
+test packgrid-1.2 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -36,9 +36,9 @@ test packgrid-1.2 {pack and grid in same master} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
-test packgrid-1.3 {pack and grid in same master} -setup {
+test packgrid-1.3 {pack and grid in same container window} -setup {
grid propagate . false
pack propagate . true
label .p -text PACK
@@ -52,7 +52,7 @@ test packgrid-1.3 {pack and grid in same master} -setup {
destroy .g
} -result {}
-test packgrid-1.4 {pack and grid in same master} -setup {
+test packgrid-1.4 {pack and grid in same container window} -setup {
grid propagate . false
pack propagate . true
label .p -text PACK
@@ -66,7 +66,7 @@ test packgrid-1.4 {pack and grid in same master} -setup {
destroy .g
} -result {}
-test packgrid-1.5 {pack and grid in same master} -setup {
+test packgrid-1.5 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . false
label .p -text PACK
@@ -80,7 +80,7 @@ test packgrid-1.5 {pack and grid in same master} -setup {
destroy .g
} -result {}
-test packgrid-1.6 {pack and grid in same master} -setup {
+test packgrid-1.6 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . false
label .p -text PACK
@@ -94,7 +94,7 @@ test packgrid-1.6 {pack and grid in same master} -setup {
destroy .g
} -result {}
-test packgrid-1.7 {pack and grid in same master} -setup {
+test packgrid-1.7 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -103,13 +103,13 @@ test packgrid-1.7 {pack and grid in same master} -setup {
# Basic conflict should stop widget from being handled
grid .g
catch { pack .p }
- pack slaves .
+ pack content .
} -cleanup {
destroy .p
destroy .g
} -result {}
-test packgrid-1.8 {pack and grid in same master} -setup {
+test packgrid-1.8 {pack and grid in same container window} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -118,13 +118,13 @@ test packgrid-1.8 {pack and grid in same master} -setup {
# Basic conflict should stop widget from being handled
pack .p
catch { grid .g }
- grid slaves .
+ grid content .
} -cleanup {
destroy .p
destroy .g
} -result {}
-test packgrid-2.1 {pack and grid in same master, change propagation} -setup {
+test packgrid-2.1 {pack and grid in same container window, change propagation} -setup {
grid propagate . false
pack propagate . true
label .p -text PACK
@@ -137,9 +137,9 @@ test packgrid-2.1 {pack and grid in same master, change propagation} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
-test packgrid-2.2 {pack and grid in same master, change propagation} -setup {
+test packgrid-2.2 {pack and grid in same container window, change propagation} -setup {
grid propagate . true
pack propagate . false
label .p -text PACK
@@ -153,9 +153,9 @@ test packgrid-2.2 {pack and grid in same master, change propagation} -setup {
destroy .p
update
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
-test packgrid-2.3 {pack and grid in same master, change propagation} -setup {
+test packgrid-2.3 {pack and grid in same container window, change propagation} -setup {
grid propagate . false
pack propagate . false
label .p -text PACK
@@ -170,9 +170,9 @@ test packgrid-2.3 {pack and grid in same master, change propagation} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
-test packgrid-2.4 {pack and grid in same master, change propagation} -setup {
+test packgrid-2.4 {pack and grid in same container window, change propagation} -setup {
grid propagate . false
pack propagate . false
label .p -text PACK
@@ -186,9 +186,9 @@ test packgrid-2.4 {pack and grid in same master, change propagation} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
-test packgrid-3.1 {stealing slave} -setup {
+test packgrid-3.1 {stealing content} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -202,7 +202,7 @@ test packgrid-3.1 {stealing slave} -setup {
destroy .g
} -result {}
-test packgrid-3.2 {stealing slave} -setup {
+test packgrid-3.2 {stealing content} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -216,7 +216,7 @@ test packgrid-3.2 {stealing slave} -setup {
destroy .g
} -result {}
-test packgrid-3.3 {stealing slave} -setup {
+test packgrid-3.3 {stealing content} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -229,9 +229,9 @@ test packgrid-3.3 {stealing slave} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager pack inside . which already has slaves managed by grid}
+} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows}
-test packgrid-3.4 {stealing slave} -setup {
+test packgrid-3.4 {stealing content} -setup {
grid propagate . true
pack propagate . true
label .p -text PACK
@@ -244,9 +244,9 @@ test packgrid-3.4 {stealing slave} -setup {
} -returnCodes error -cleanup {
destroy .p
destroy .g
-} -result {cannot use geometry manager grid inside . which already has slaves managed by pack}
+} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows}
-test packgrid-4.1 {slave stolen after master destruction - bug [aa7679685e]} -setup {
+test packgrid-4.1 {content stolen after container destruction - bug [aa7679685e]} -setup {
frame .f
button .b -text hello
} -body {
@@ -261,7 +261,7 @@ test packgrid-4.1 {slave stolen after master destruction - bug [aa7679685e]} -se
destroy .b
} -result {}
-test packgrid-4.2 {slave stolen after master destruction - bug [aa7679685e]} -setup {
+test packgrid-4.2 {content stolen after container destruction - bug [aa7679685e]} -setup {
frame .f
button .b -text hello
} -body {
diff --git a/tests/panedwindow.test b/tests/panedwindow.test
index ea407a0..7e07762 100644
--- a/tests/panedwindow.test
+++ b/tests/panedwindow.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -1022,7 +1022,7 @@ test panedwindow-12.6 {panedwindow takes explicit widget width over reqwidth} -s
} -cleanup {
deleteWindows
} -result [list 20 20]
-test panedwindow-12.7 {horizontal panedwindow reqheight is max slave height} -setup {
+test panedwindow-12.7 {horizontal panedwindow reqheight is max pane height} -setup {
deleteWindows
} -body {
panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4
@@ -1033,7 +1033,7 @@ test panedwindow-12.7 {horizontal panedwindow reqheight is max slave height} -se
} -cleanup {
deleteWindows
} -result {20 40}
-test panedwindow-12.8 {horizontal panedwindow reqheight is max slave height} -setup {
+test panedwindow-12.8 {horizontal panedwindow reqheight is max pane height} -setup {
deleteWindows
} -body {
panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4
@@ -1087,7 +1087,7 @@ test panedwindow-12.11 {panedwindow takes explicit height over reqheight} -setup
} -cleanup {
deleteWindows
} -result [list 20 20]
-test panedwindow-12.12 {vertical panedwindow reqwidth is max slave width} -setup {
+test panedwindow-12.12 {vertical panedwindow reqwidth is max pane width} -setup {
deleteWindows
} -body {
panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \
@@ -1099,7 +1099,7 @@ test panedwindow-12.12 {vertical panedwindow reqwidth is max slave width} -setup
} -cleanup {
deleteWindows
} -result {20 40}
-test panedwindow-12.13 {vertical panedwindow reqwidth is max slave width} -setup {
+test panedwindow-12.13 {vertical panedwindow reqwidth is max pane width} -setup {
deleteWindows
} -body {
panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 4 \
@@ -1133,7 +1133,7 @@ test panedwindow-13.1 {PanestructureProc, widget yields managements} -setup {
deleteWindows
} -body {
# Check that the panedwindow correctly yields geometry management of
- # a slave when the slave is destroyed.
+ # a pane when the pane is destroyed.
# This test should not cause a core dump, and it should not cause
# a memory leak.
@@ -1144,11 +1144,11 @@ test panedwindow-13.1 {PanestructureProc, widget yields managements} -setup {
destroy .b
set result ""
} -result {}
-test panedwindow-13.2 {PanedWindowLostSlaveProc, widget yields management} -setup {
+test panedwindow-13.2 {PanedWindowLostPaneProc, widget yields management} -setup {
deleteWindows
} -body {
# Check that the paned window correctly yields geometry management of
- # a slave when some other geometry manager steals the slave from us.
+ # a pane when some other geometry manager steals the pane from us.
# This test should not cause a core dump, and it should not cause a
# memory leak.
@@ -2241,10 +2241,10 @@ test panedwindow-19.6 {ComputeGeometry, reqwidth taken from widgets} -setup {
deleteWindows
} -result [list [list 60 60] [list 80 60]]
-test panedwindow-19.7 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.7 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2282,7 +2282,7 @@ test panedwindow-19.9 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{20 0} {40 0}}
-test panedwindow-19.10 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.10 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2303,10 +2303,10 @@ test panedwindow-19.10 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {53 3 20 20} {95 3 20 20}}
-test panedwindow-19.11 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.11 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2349,7 +2349,7 @@ test panedwindow-19.13 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 20} {0 40}}
-test panedwindow-19.14 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.14 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2370,10 +2370,10 @@ test panedwindow-19.14 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 53 20 20} {3 95 20 20}}
-test panedwindow-19.15 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.15 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2411,7 +2411,7 @@ test panedwindow-19.17 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{23 0} {49 0}}
-test panedwindow-19.18 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.18 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2432,10 +2432,10 @@ test panedwindow-19.18 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {59 3 20 20} {107 3 20 20}}
-test panedwindow-19.19 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.19 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2478,7 +2478,7 @@ test panedwindow-19.21 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 23} {0 49}}
-test panedwindow-19.22 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.22 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2499,10 +2499,10 @@ test panedwindow-19.22 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 59 20 20} {3 107 20 20}}
-test panedwindow-19.23 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.23 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2540,7 +2540,7 @@ test panedwindow-19.25 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{20 0} {43 0}}
-test panedwindow-19.26 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.26 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2561,10 +2561,10 @@ test panedwindow-19.26 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {56 3 20 20} {101 3 20 20}}
-test panedwindow-19.27 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.27 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2607,7 +2607,7 @@ test panedwindow-19.29 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 20} {0 43}}
-test panedwindow-19.30 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.30 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2628,10 +2628,10 @@ test panedwindow-19.30 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 56 20 20} {3 101 20 20}}
-test panedwindow-19.31 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.31 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2669,7 +2669,7 @@ test panedwindow-19.33 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{21 0} {47 0}}
-test panedwindow-19.34 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.34 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2690,10 +2690,10 @@ test panedwindow-19.34 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {59 3 20 20} {107 3 20 20}}
-test panedwindow-19.35 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.35 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2736,7 +2736,7 @@ test panedwindow-19.37 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 21} {0 47}}
-test panedwindow-19.38 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.38 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 \
@@ -2757,10 +2757,10 @@ test panedwindow-19.38 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 59 20 20} {3 107 20 20}}
-test panedwindow-19.39 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.39 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2798,7 +2798,7 @@ test panedwindow-19.41 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{25 0} {55 0}}
-test panedwindow-19.42 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.42 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2819,10 +2819,10 @@ test panedwindow-19.42 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {63 3 20 20} {115 3 20 20}}
-test panedwindow-19.43 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.43 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2865,7 +2865,7 @@ test panedwindow-19.45 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 25} {0 55}}
-test panedwindow-19.46 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.46 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2886,10 +2886,10 @@ test panedwindow-19.46 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 63 20 20} {3 115 20 20}}
-test panedwindow-19.47 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.47 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2927,7 +2927,7 @@ test panedwindow-19.49 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{28 0} {64 0}}
-test panedwindow-19.50 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.50 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2948,10 +2948,10 @@ test panedwindow-19.50 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {69 3 20 20} {127 3 20 20}}
-test panedwindow-19.51 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.51 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -2994,7 +2994,7 @@ test panedwindow-19.53 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 28} {0 64}}
-test panedwindow-19.54 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.54 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3015,10 +3015,10 @@ test panedwindow-19.54 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 69 20 20} {3 127 20 20}}
-test panedwindow-19.55 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.55 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3056,7 +3056,7 @@ test panedwindow-19.57 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{25 0} {58 0}}
-test panedwindow-19.58 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.58 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3077,10 +3077,10 @@ test panedwindow-19.58 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {66 3 20 20} {121 3 20 20}}
-test panedwindow-19.59 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.59 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3123,7 +3123,7 @@ test panedwindow-19.61 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 25} {0 58}}
-test panedwindow-19.62 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.62 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3144,10 +3144,10 @@ test panedwindow-19.62 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 66 20 20} {3 121 20 20}}
-test panedwindow-19.63 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.63 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3185,7 +3185,7 @@ test panedwindow-19.65 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{26 0} {62 0}}
-test panedwindow-19.66 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.66 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3206,10 +3206,10 @@ test panedwindow-19.66 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{11 3 20 20} {69 3 20 20} {127 3 20 20}}
-test panedwindow-19.67 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.67 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3252,7 +3252,7 @@ test panedwindow-19.69 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{0 26} {0 62}}
-test panedwindow-19.70 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.70 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 5 \
@@ -3273,10 +3273,10 @@ test panedwindow-19.70 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{3 11 20 20} {3 69 20 20} {3 127 20 20}}
-test panedwindow-19.71 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.71 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3314,7 +3314,7 @@ test panedwindow-19.73 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{22 2} {42 2}}
-test panedwindow-19.74 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.74 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3335,10 +3335,10 @@ test panedwindow-19.74 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {55 5 20 20} {97 5 20 20}}
-test panedwindow-19.75 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.75 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3381,7 +3381,7 @@ test panedwindow-19.77 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 22} {2 42}}
-test panedwindow-19.78 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.78 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3402,10 +3402,10 @@ test panedwindow-19.78 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 55 20 20} {5 97 20 20}}
-test panedwindow-19.79 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.79 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3443,7 +3443,7 @@ test panedwindow-19.81 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{25 2} {51 2}}
-test panedwindow-19.82 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.82 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3464,10 +3464,10 @@ test panedwindow-19.82 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {61 5 20 20} {109 5 20 20}}
-test panedwindow-19.83 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.83 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3510,7 +3510,7 @@ test panedwindow-19.85 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 25} {2 51}}
-test panedwindow-19.86 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.86 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3531,10 +3531,10 @@ test panedwindow-19.86 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 61 20 20} {5 109 20 20}}
-test panedwindow-19.87 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.87 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3572,7 +3572,7 @@ test panedwindow-19.89 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{22 2} {45 2}}
-test panedwindow-19.90 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.90 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3593,10 +3593,10 @@ test panedwindow-19.90 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {58 5 20 20} {103 5 20 20}}
-test panedwindow-19.91 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.91 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3639,7 +3639,7 @@ test panedwindow-19.93 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 22} {2 45}}
-test panedwindow-19.94 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.94 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3660,10 +3660,10 @@ test panedwindow-19.94 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 58 20 20} {5 103 20 20}}
-test panedwindow-19.95 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.95 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3701,7 +3701,7 @@ test panedwindow-19.97 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{23 2} {49 2}}
-test panedwindow-19.98 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.98 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3722,10 +3722,10 @@ test panedwindow-19.98 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {61 5 20 20} {109 5 20 20}}
-test panedwindow-19.99 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.99 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3768,7 +3768,7 @@ test panedwindow-19.101 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 23} {2 49}}
-test panedwindow-19.102 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.102 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 0 \
@@ -3789,10 +3789,10 @@ test panedwindow-19.102 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 61 20 20} {5 109 20 20}}
-test panedwindow-19.103 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.103 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3830,7 +3830,7 @@ test panedwindow-19.105 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{27 2} {57 2}}
-test panedwindow-19.106 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.106 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3851,10 +3851,10 @@ test panedwindow-19.106 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {65 5 20 20} {117 5 20 20}}
-test panedwindow-19.107 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.107 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3897,7 +3897,7 @@ test panedwindow-19.109 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 27} {2 57}}
-test panedwindow-19.110 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.110 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3918,10 +3918,10 @@ test panedwindow-19.110 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 65 20 20} {5 117 20 20}}
-test panedwindow-19.111 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.111 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3959,7 +3959,7 @@ test panedwindow-19.113 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{30 2} {66 2}}
-test panedwindow-19.114 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.114 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -3980,10 +3980,10 @@ test panedwindow-19.114 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {71 5 20 20} {129 5 20 20}}
-test panedwindow-19.115 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.115 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4026,7 +4026,7 @@ test panedwindow-19.117 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 30} {2 66}}
-test panedwindow-19.118 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.118 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4047,10 +4047,10 @@ test panedwindow-19.118 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 71 20 20} {5 129 20 20}}
-test panedwindow-19.119 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.119 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4088,7 +4088,7 @@ test panedwindow-19.121 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{27 2} {60 2}}
-test panedwindow-19.122 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.122 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4109,10 +4109,10 @@ test panedwindow-19.122 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {68 5 20 20} {123 5 20 20}}
-test panedwindow-19.123 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.123 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4155,7 +4155,7 @@ test panedwindow-19.125 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 27} {2 60}}
-test panedwindow-19.126 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.126 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4176,10 +4176,10 @@ test panedwindow-19.126 {ComputeGeometry/ArrangePanes, slave coords, vert} -setu
} -cleanup {
deleteWindows
} -result {{5 13 20 20} {5 68 20 20} {5 123 20 20}}
-test panedwindow-19.127 {ComputeGeometry, one slave, reqsize set properly} -setup {
+test panedwindow-19.127 {ComputeGeometry, one pane, reqsize set properly} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4217,7 +4217,7 @@ test panedwindow-19.129 {ComputeGeometry, sash coords} -setup {
deleteWindows
} -result {{28 2} {64 2}}
-test panedwindow-19.130 {ComputeGeometry/ArrangePanes, slave coords} -setup {
+test panedwindow-19.130 {ComputeGeometry/ArrangePanes, pane coords} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4238,10 +4238,10 @@ test panedwindow-19.130 {ComputeGeometry/ArrangePanes, slave coords} -setup {
deleteWindows
} -result {{13 5 20 20} {71 5 20 20} {129 5 20 20}}
-test panedwindow-19.131 {ComputeGeometry, one slave, vertical} -setup {
+test panedwindow-19.131 {ComputeGeometry, one pane, vertical} -setup {
deleteWindows
} -body {
- # With just one slave, sashpad and sashwidth should not
+ # With just one pane, sashpad and sashwidth should not
# affect the panedwindow's geometry, since no sash should
# ever be drawn.
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4284,7 +4284,7 @@ test panedwindow-19.133 {ComputeGeometry, sash coords, vertical} -setup {
deleteWindows
} -result {{2 28} {2 64}}
-test panedwindow-19.134 {ComputeGeometry/ArrangePanes, slave coords, vert} -setup {
+test panedwindow-19.134 {ComputeGeometry/ArrangePanes, pane coords, vert} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 2 -sashpad 5 \
@@ -4317,7 +4317,7 @@ test panedwindow-20.1 {destroyed widgets are removed from panedwindow} -setup {
} -cleanup {
deleteWindows
} -result {}
-test panedwindow-20.2 {destroyed slave causes geometry recomputation} -setup {
+test panedwindow-20.2 {destroyed pane causes geometry recomputation} -setup {
deleteWindows
} -body {
panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 2
@@ -4537,7 +4537,7 @@ test panedwindow-21.15 {ArrangePanes, last pane grows} -setup {
} -result {50 150 1 1 211 50 150 1 89 300}
-test panedwindow-22.1 {PanedWindowReqProc, react to slave geometry changes} -setup {
+test panedwindow-22.1 {PanedWindowReqProc, react to pane geometry changes} -setup {
deleteWindows
} -body {
# Basically just want to make sure that the PanedWindowReqProc is called
@@ -4550,7 +4550,7 @@ test panedwindow-22.1 {PanedWindowReqProc, react to slave geometry changes} -set
} -cleanup {
deleteWindows
} -result {40 80}
-test panedwindow-22.2 {PanedWindowReqProc, react to slave geometry changes} -setup {
+test panedwindow-22.2 {PanedWindowReqProc, react to pane geometry changes} -setup {
deleteWindows
} -body {
panedwindow .p -orient horizontal -sashpad 0 -sashwidth 2
@@ -4562,7 +4562,7 @@ test panedwindow-22.2 {PanedWindowReqProc, react to slave geometry changes} -set
expr {[lindex $result 1] - [lindex $result 0]}
} -cleanup {
deleteWindows
-} -result {10}
+} -result 10
test panedwindow-23.1 {ConfigurePanes, can't add panedwindow to itself} -setup {
@@ -4824,7 +4824,7 @@ test panedwindow-23.21 {ConfigurePanes, -before, relocate existing windows} -set
} -cleanup {
deleteWindows
} -result {.d .b .a .c}
-test panedwindow-23.22 {ConfigurePanes, slave specified multiple times} -setup {
+test panedwindow-23.22 {ConfigurePanes, pane specified multiple times} -setup {
deleteWindows
} -body {
# This test should not cause a core dump
@@ -4839,7 +4839,7 @@ test panedwindow-23.22 {ConfigurePanes, slave specified multiple times} -setup {
} -cleanup {
deleteWindows
} -result {.a .b .c}
-test panedwindow-23.23 {ConfigurePanes, slave specified multiple times} -setup {
+test panedwindow-23.23 {ConfigurePanes, pane specified multiple times} -setup {
deleteWindows
} -body {
# This test should not cause a core dump
@@ -5146,7 +5146,7 @@ test panedwindow-25.1 {DestroyPanedWindow} -setup {
}
set result {}
} -result {}
-test panedwindow-25.2 {UnmapNotify and MapNotify events are propagated to slaves} -setup {
+test panedwindow-25.2 {UnmapNotify and MapNotify events are propagated to panes} -setup {
deleteWindows
} -body {
panedwindow .pw
@@ -5461,7 +5461,7 @@ test panedwindow-27.2 {destroy the window cleanly on rename [Bug #616589]} -setu
winfo exists .p
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test panedwindow-28.1 {resizing width} -setup {
diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test
index e080b91..47a9c0e 100644
--- a/tests/pkgconfig.test
+++ b/tests/pkgconfig.test
@@ -5,10 +5,10 @@
# built-in commands. Sourcing this file into Tk runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1991-1993 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2017 Stuart Cassoff <stwo@users.sourceforge.net>
+# Copyright © 1991-1993 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 2017 Stuart Cassoff <stwo@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,7 +18,9 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
-test pkgconfig-1.1 {query keys} nonwin {
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
+test pkgconfig-1.1 {query keys} nodeprecated {
lsort [::tk::pkgconfig list]
} [list \
64bit bindir,install bindir,runtime debug demodir,install demodir,runtime \
diff --git a/tests/place.test b/tests/place.test
index e04ee0a..e60b706 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test out the "place" command. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,6 +13,9 @@ tcltest::loadTestedCommands
# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# XXX - This test file is woefully incomplete. At present, only a
# few of the features are tested.
@@ -53,17 +56,17 @@ test place-1.3 {Tk_PlaceCmd procedure, "info" option} -setup {
} -result {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore}
-test place-2.1 {ConfigureSlave procedure, -height option} -body {
+test place-2.1 {ConfigureContent procedure, -height option} -body {
place .t.f2 -height abcd
} -returnCodes error -result {bad screen distance "abcd"}
-test place-2.2 {ConfigureSlave procedure, -height option} -setup {
+test place-2.2 {ConfigureContent procedure, -height option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -height 40
update
winfo height .t.f2
-} -result {40}
-test place-2.3 {ConfigureSlave procedure, -height option} -setup {
+} -result 40
+test place-2.3 {ConfigureContent procedure, -height option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -height 120
@@ -71,20 +74,20 @@ test place-2.3 {ConfigureSlave procedure, -height option} -setup {
place .t.f2 -height {}
update
winfo height .t.f2
-} -result {60}
+} -result 60
-test place-3.1 {ConfigureSlave procedure, -relheight option} -body {
+test place-3.1 {ConfigureContent procedure, -relheight option} -body {
place .t.f2 -relheight abcd
} -returnCodes error -result {expected floating-point number but got "abcd"}
-test place-3.2 {ConfigureSlave procedure, -relheight option} -setup {
+test place-3.2 {ConfigureContent procedure, -relheight option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -relheight .5
update
winfo height .t.f2
-} -result {40}
-test place-3.3 {ConfigureSlave procedure, -relheight option} -setup {
+} -result 40
+test place-3.3 {ConfigureContent procedure, -relheight option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -relheight .8
@@ -92,43 +95,43 @@ test place-3.3 {ConfigureSlave procedure, -relheight option} -setup {
place .t.f2 -relheight {}
update
winfo height .t.f2
-} -result {60}
+} -result 60
-test place-4.1 {ConfigureSlave procedure, bad -in options} -setup {
+test place-4.1 {ConfigureContent procedure, bad -in options} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f2
-} -returnCodes error -result {can't place .t.f2 relative to itself}
-test place-4.2 {ConfigureSlave procedure, bad -in option} -setup {
+} -returnCodes error -result {can't place ".t.f2" relative to itself}
+test place-4.2 {ConfigureContent procedure, bad -in option} -setup {
place forget .t.f2
} -body {
set result [list [winfo manager .t.f2]]
catch {place .t.f2 -in .t.f2}
lappend result [winfo manager .t.f2]
} -result {{} {}}
-test place-4.3 {ConfigureSlave procedure, bad -in option} -setup {
+test place-4.3 {ConfigureContent procedure, bad -in option} -setup {
place forget .t.f2
} -body {
winfo manager .t.f2
place .t.f2 -in .t.f2
-} -returnCodes error -result {can't place .t.f2 relative to itself}
-test place-4.4 {ConfigureSlave procedure, bad -in option} -setup {
+} -returnCodes error -result {can't place ".t.f2" relative to itself}
+test place-4.4 {ConfigureContent procedure, bad -in option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .
-} -returnCodes error -result {can't place .t.f2 relative to .}
-test place-4.5 {ConfigureSlave procedure, bad -in option} -setup {
+} -returnCodes error -result {can't place ".t.f2" relative to "."}
+test place-4.5 {ConfigureContent procedure, bad -in option} -setup {
} -body {
frame .t.f1
place .t.f1 -in .t.f1
-} -returnCodes error -result {can't place .t.f1 relative to itself}
+} -returnCodes error -result {can't place ".t.f1" relative to itself}
test place-4.6 {prevent management loops} -setup {
place forget .t.f1
} -body {
place .t.f1 -in .t.f2
place .t.f2 -in .t.f1
-} -returnCodes error -result {can't put .t.f2 inside .t.f1, would cause management loop}
+} -returnCodes error -result {can't put ".t.f2" inside ".t.f1": would cause management loop}
test place-4.7 {prevent management loops} -setup {
place forget .t.f1
place forget .t.f2
@@ -137,19 +140,19 @@ test place-4.7 {prevent management loops} -setup {
place .t.f1 -in .t.f2
place .t.f2 -in .t.f3
place .t.f3 -in .t.f1
-} -returnCodes error -result {can't put .t.f3 inside .t.f1, would cause management loop}
+} -returnCodes error -result {can't put ".t.f3" inside ".t.f1": would cause management loop}
-test place-5.1 {ConfigureSlave procedure, -relwidth option} -body {
+test place-5.1 {ConfigureContent procedure, -relwidth option} -body {
place .t.f2 -relwidth abcd
} -returnCodes error -result {expected floating-point number but got "abcd"}
-test place-5.2 {ConfigureSlave procedure, -relwidth option} -setup {
+test place-5.2 {ConfigureContent procedure, -relwidth option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -relwidth .5
update
winfo width .t.f2
-} -result {75}
-test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup {
+} -result 75
+test place-5.3 {ConfigureContent procedure, -relwidth option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -relwidth .8
@@ -157,19 +160,19 @@ test place-5.3 {ConfigureSlave procedure, -relwidth option} -setup {
place .t.f2 -relwidth {}
update
winfo width .t.f2
-} -result {30}
+} -result 30
-test place-6.1 {ConfigureSlave procedure, -width option} -body {
+test place-6.1 {ConfigureContent procedure, -width option} -body {
place .t.f2 -width abcd
} -returnCodes error -result {bad screen distance "abcd"}
-test place-6.2 {ConfigureSlave procedure, -width option} -setup {
+test place-6.2 {ConfigureContent procedure, -width option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -width 100
update
winfo width .t.f2
-} -result {100}
-test place-6.3 {ConfigureSlave procedure, -width option} -setup {
+} -result 100
+test place-6.3 {ConfigureContent procedure, -width option} -setup {
place forget .t.f2
} -body {
place .t.f2 -in .t.f -width 120
@@ -177,7 +180,7 @@ test place-6.3 {ConfigureSlave procedure, -width option} -setup {
place .t.f2 -width {}
update
winfo width .t.f2
-} -result {30}
+} -result 30
test place-7.1 {ReconfigurePlacement procedure, computing position} -setup {
@@ -258,40 +261,47 @@ test place-7.10 {ReconfigurePlacement procedure, computing size} -setup {
list [winfo width .t.f2] [winfo height .t.f2]
} -result {30 60}
+if {[tk windowingsystem] == "win32"} {
+ proc placeUpdate {} {
+ update
+ }
+} else {
+ proc placeUpdate {} {
+ }
+}
-test place-8.1 {MasterStructureProc, mapping and unmapping slaves} -setup {
+test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
place forget .t.f2
place forget .t.f
} -body {
place .t.f2 -relx 1.0 -rely 1.0 -anchor sw
- update
+ update idletasks
set result [winfo ismapped .t.f2]
wm iconify .t
- update
lappend result [winfo ismapped .t.f2]
place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw
- update
+ update idletasks
lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
wm deiconify .t
- update
+ placeUpdate
lappend result [winfo ismapped .t.f2]
} -result {1 0 40 30 0 1}
-test place-8.2 {MasterStructureProc, mapping and unmapping slaves} -setup {
+test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
place forget .t.f2
place forget .t.f
+ update idletasks
} -body {
place .t.f -x 0 -y 0 -width 200 -height 100
place .t.f2 -in .t.f -relx 1.0 -rely 1.0 -anchor sw -width 50 -height 20
- update
+ update idletasks
set result [winfo ismapped .t.f2]
wm iconify .t
- update
lappend result [winfo ismapped .t.f2]
place .t.f2 -x 40 -y 30 -relx 0 -rely 0 -anchor nw
- update
+ update idletasks
lappend result [winfo x .t.f2] [winfo y .t.f2] [winfo ismapped .t.f2]
wm deiconify .t
- update
+ placeUpdate
lappend result [winfo ismapped .t.f2]
} -result {1 0 42 32 0 1}
destroy .t
@@ -322,7 +332,7 @@ test place-9.5 {PlaceObjCmd} -setup {
place badopt .foo
} -cleanup {
destroy .foo
-} -returnCodes error -result {bad option "badopt": must be configure, forget, info, or slaves}
+} -returnCodes error -result {bad option "badopt": must be configure, content, forget, or info}
test place-9.6 {PlaceObjCmd, configure errors} -setup {
destroy .foo
} -body {
@@ -373,17 +383,17 @@ test place-9.11 {PlaceObjCmd, info errors} -setup {
} -cleanup {
destroy .foo
} -returnCodes error -result {wrong # args: should be "place info pathName"}
-test place-9.12 {PlaceObjCmd, slaves errors} -setup {
+test place-9.12 {PlaceObjCmd, content errors} -setup {
destroy .foo
} -body {
frame .foo
- place slaves .foo bar
+ place content .foo bar
} -cleanup {
destroy .foo
-} -returnCodes error -result {wrong # args: should be "place slaves pathName"}
+} -returnCodes error -result {wrong # args: should be "place content pathName"}
-test place-10.1 {ConfigureSlave} -setup {
+test place-10.1 {ConfigureContent} -setup {
destroy .foo
} -body {
frame .foo
@@ -391,7 +401,7 @@ test place-10.1 {ConfigureSlave} -setup {
} -cleanup {
destroy .foo
} -returnCodes error -result {unknown option "-badopt"}
-test place-10.2 {ConfigureSlave} -setup {
+test place-10.2 {ConfigureContent} -setup {
destroy .foo
} -body {
frame .foo
@@ -399,7 +409,7 @@ test place-10.2 {ConfigureSlave} -setup {
} -cleanup {
destroy .foo
} -returnCodes error -result {value for "-anchor" missing}
-test place-10.3 {ConfigureSlave} -setup {
+test place-10.3 {ConfigureContent} -setup {
destroy .foo
} -body {
frame .foo
@@ -407,7 +417,7 @@ test place-10.3 {ConfigureSlave} -setup {
} -cleanup {
destroy .foo
} -returnCodes error -result {bad bordermode "j": must be inside, outside, or ignore}
-test place-10.4 {ConfigureSlave} -setup {
+test place-10.4 {ConfigureContent} -setup {
destroy .foo
} -body {
frame .foo
@@ -417,21 +427,21 @@ test place-10.4 {ConfigureSlave} -setup {
} -returnCodes error -result {value for "-y" missing}
-test place-11.1 {PlaceObjCmd, slaves command} -setup {
+test place-11.1 {PlaceObjCmd, content command} -setup {
destroy .foo
} -body {
frame .foo
- place slaves .foo
+ place content .foo
} -cleanup {
destroy .foo
} -result {}
-test place-11.2 {PlaceObjCmd, slaves command} -setup {
+test place-11.2 {PlaceObjCmd, content command} -setup {
destroy .foo .bar
} -body {
frame .foo
frame .bar
place .bar -in .foo
- place slaves .foo
+ place content .foo
} -cleanup {
destroy .foo .bar
} -result [list .bar]
@@ -493,7 +503,7 @@ test place-14.1 {memory leak testing} -constraints memory -setup {
return $res
}
} -body {
- # Test all manners of forgetting a slave
+ # Test all manners of forgetting content
frame .f
frame .f.f
stress {
diff --git a/tests/raise.test b/tests/raise.test
index f8674fc..56a41eb 100644
--- a/tests/raise.test
+++ b/tests/raise.test
@@ -3,9 +3,9 @@
# stacking order. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1993-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1993-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/safe.test b/tests/safe.test
index 4f0ce15..627d242 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the Safe Tk facility. It is organized in
# the standard fashion for Tk tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -33,38 +33,33 @@ namespace import -force tcltest::test
# The set of hidden commands is platform dependent:
-set hidden_cmds {bell cd clipboard encoding exec exit fconfigure}
-lappend hidden_cmds {*}[apply {{} {
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- lappend result file
- }
- lappend result glob grab load menu open pwd selection socket source tcl:encoding:dirs
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- lappend result tcl:encoding:system
- }
- lappend result toplevel unload wm
+set hidden_cmds [list bell cd clipboard encoding exec exit \
+ fconfigure glob grab load menu open pwd selection \
+ socket source toplevel unload wm]
+if {[package vsatisfies [package provide Tcl] 8.6.7-]} {
+ lappend hidden_cmds tcl:encoding:dirs
+}
+if {[package vsatisfies [package provide Tcl] 8.7-]} {
+ lappend hidden_cmds file tcl:encoding:system tcl:file:tempdir
foreach cmd {
- atime attributes copy delete dirname executable exists extension
- isdirectory isfile link lstat mkdir mtime nativename normalize owned
- readable readlink rename rootname size stat tail tempdir tempfile type
- volumes writable
- } {lappend result tcl:file:$cmd}
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- foreach cmd {
- cmdtype nameofexecutable
- } {lappend result tcl:info:$cmd}
- foreach cmd {
- autopurge list purge status
- } {lappend result tcl:process:$cmd}
- foreach cmd {
- lmkimg lmkzip mkimg mkkey mkzip mount mount_data unmount
- } {lappend result tcl:zipfs:$cmd}
- }
- return $result
-}}]
+ cmdtype nameofexecutable
+ } {lappend hidden_cmds tcl:info:$cmd}
+ foreach cmd {
+ autopurge list purge status
+ } {lappend hidden_cmds tcl:process:$cmd}
+ foreach cmd {
+ lmkimg lmkzip mkimg mkkey mkzip mount mount_data unmount
+ } {lappend hidden_cmds tcl:zipfs:$cmd}
+}
+foreach cmd {
+ atime attributes copy delete dirname executable exists extension
+ isdirectory isfile link lstat mkdir mtime nativename normalize
+ owned readable readlink rename rootname size stat tail tempfile
+ type volumes writable
+} {lappend hidden_cmds tcl:file:$cmd}
if {[tk windowingsystem] ne "x11"} {
- lappend hidden_cmds tk_chooseColor tk_chooseDirectory tk_getOpenFile \
- tk_getSaveFile tk_messageBox
+ lappend hidden_cmds tk_chooseColor tk_chooseDirectory \
+ tk_getOpenFile tk_getSaveFile tk_messageBox
}
if {[llength [info commands send]]} {
lappend hidden_cmds send
@@ -202,12 +197,12 @@ test safe-4.2 {testing loadTk -use} -setup {
destroy $w
} -result {}
-test safe-5.1 {loading Tk in safe interps without master's clearance} -body {
+test safe-5.1 {loading Tk in safe interps without parent's clearance} -body {
set i [safe::interpCreate]
interp eval $i {load {} Tk}
} -cleanup {
safe::interpDelete $i
-} -returnCodes error -result {not allowed}
+} -returnCodes error -match glob -result {*not allowed}
test safe-5.2 {multi-level Tk loading with clearance} -setup {
set safeParent [safe::interpCreate]
} -body {
diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test
index 7cc31f4..713eedc 100644
--- a/tests/safePrimarySelection.test
+++ b/tests/safePrimarySelection.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test entry widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -16,9 +16,9 @@ tcltest::loadTestedCommands
# ------------------------------------------------------------------------------
# - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch
# bug-de156e9efe has been applied and still works. They test that a Safe Base
-# slave interpreter cannot write to the PRIMARY selection.
-# - The other tests verify that the master interpreter and an unsafe slave CAN
-# write to the PRIMARY selection, and therefore that the test scripts
+# child interpreter cannot write to the PRIMARY selection.
+# - The other tests verify that the parent interpreter and an child interpreter
+# CAN write to the PRIMARY selection, and therefore that the test scripts
# themselves are valid.
# - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have
# option -exportselection 1, meaning (in an unsafe interpreter) that a
@@ -33,12 +33,12 @@ namespace eval ::_test_tmp {}
# ------------------------------------------------------------------------------
# Proc ::_test_tmp::unsafeInterp
# ------------------------------------------------------------------------------
-# Command that creates an unsafe child interpreter and tries to load Tk.
+# Command that creates an child interpreter and tries to load Tk.
# - This is necessary for loading Tk if the tests are done in the build
# directory without installing Tk. In that case the usual auto_path loading
# mechanism cannot work because the tk binary is not where pkgIndex.tcl says
# it is.
-# - This command is not needed for Safe Base slaves because safe::loadTk does
+# - This command is not needed for Safe Base children because safe::loadTk does
# something similar and works correctly.
# - Based on scripts in winSend.test.
# ------------------------------------------------------------------------------
@@ -208,11 +208,11 @@ set ::_test_tmp::script {
}
}
-# Do this once for the master interpreter.
+# Do this once for the parent interpreter.
eval $::_test_tmp::script
-test safePrimarySelection-1.1 {master interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.1 {parent interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -223,8 +223,8 @@ test safePrimarySelection-1.1 {master interpreter, text, no existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.2 {parent interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -235,8 +235,8 @@ test safePrimarySelection-1.2 {master interpreter, entry, no existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.3 {parent interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -247,8 +247,8 @@ test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.4 {master interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.4 {parent interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -259,8 +259,8 @@ test safePrimarySelection-1.4 {master interpreter, listbox, no existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.5 {parent interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -271,8 +271,8 @@ test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.6 {parent interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -281,10 +281,10 @@ test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing sel
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.7 {parent interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -293,10 +293,10 @@ test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, n
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.8 {parent interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -307,8 +307,8 @@ test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no exi
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.9 {parent interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -317,10 +317,10 @@ test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existin
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
@@ -329,14 +329,14 @@ test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.1 {child interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryText
@@ -348,12 +348,12 @@ test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.2 {child interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryEntry
@@ -365,12 +365,12 @@ test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing sele
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.3 {child interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkEntry
@@ -382,12 +382,12 @@ test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.4 {child interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryListbox
@@ -399,12 +399,12 @@ test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.5 {child interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 1
@@ -416,12 +416,12 @@ test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no ex
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.6 {child interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 2
@@ -431,14 +431,14 @@ test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existi
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.7 {child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 3
@@ -448,14 +448,14 @@ test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/s
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.8 {child interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 1
@@ -467,12 +467,12 @@ test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.9 {child interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 2
@@ -482,14 +482,14 @@ test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no e
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-2.10 {child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 3
@@ -499,15 +499,15 @@ test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/sele
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.1 {IMPORTANT, safe interpreter, text, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -522,13 +522,13 @@ test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no exist
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.2 {IMPORTANT, safe interpreter, entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -543,13 +543,13 @@ test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no exis
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.3 {IMPORTANT, safe interpreter, ttk::entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -564,13 +564,13 @@ test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.4 {IMPORTANT, safe interpreter, listbox, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -585,13 +585,13 @@ test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no ex
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.5 {IMPORTANT, safe interpreter, spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -606,13 +606,13 @@ test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.6 {IMPORTANT, safe interpreter, spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -627,13 +627,13 @@ test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -648,13 +648,13 @@ test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -669,13 +669,13 @@ test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -690,13 +690,13 @@ test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-3.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -711,8 +711,8 @@ test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-4.1 {master interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.1 {parent interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -723,8 +723,8 @@ test safePrimarySelection-4.1 {master interpreter, text, existing selection} -se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.2 {parent interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -735,8 +735,8 @@ test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -s
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.3 {parent interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -747,8 +747,8 @@ test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.4 {parent interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -759,8 +759,8 @@ test safePrimarySelection-4.4 {master interpreter, listbox, existing selection}
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.5 {parent interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -771,8 +771,8 @@ test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.6 {parent interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -781,10 +781,10 @@ test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing select
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.7 {parent interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -793,10 +793,10 @@ test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, e
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.8 {parent interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -807,8 +807,8 @@ test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existi
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.9 {parent interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -817,10 +817,10 @@ test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
@@ -829,14 +829,14 @@ test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/s
} -cleanup {
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.1 {child interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryText
@@ -848,12 +848,12 @@ test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.2 {child interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryEntry
@@ -865,12 +865,12 @@ test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selecti
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.3 {child interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkEntry
@@ -882,12 +882,12 @@ test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.4 {child interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryListbox
@@ -899,12 +899,12 @@ test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.5 {child interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 1
@@ -916,12 +916,12 @@ test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, exist
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.6 {child interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 2
@@ -931,14 +931,14 @@ test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.7 {child interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::trySpinbox 3
@@ -948,14 +948,14 @@ test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/s
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.8 {child interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 1
@@ -967,12 +967,12 @@ test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.9 {child interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 2
@@ -982,14 +982,14 @@ test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, exis
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {2}
+} -result 2
-test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-5.10 {child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
- set int2 slave2
+ set int2 child2
::_test_tmp::unsafeInterp $int2
$int2 eval $::_test_tmp::script
$int2 eval ::_test_tmp::tryTtkSpinbox 3
@@ -999,15 +999,15 @@ test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/sele
destroy {*}[winfo children .]
unset int2
::_test_tmp::clearPrimarySelection
-} -result {3}
+} -result 3
-test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.1 {IMPORTANT, safe interpreter, text, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1022,13 +1022,13 @@ test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.2 {IMPORTANT, safe interpreter, entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1043,13 +1043,13 @@ test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existin
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.3 {IMPORTANT, safe interpreter, ttk::entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1064,13 +1064,13 @@ test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, ex
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.4 {IMPORTANT, safe interpreter, listbox, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1085,13 +1085,13 @@ test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, exist
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.5 {IMPORTANT, safe interpreter, spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1106,13 +1106,13 @@ test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.6 {IMPORTANT, safe interpreter, spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1127,13 +1127,13 @@ test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1148,13 +1148,13 @@ test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1169,13 +1169,13 @@ test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
@@ -1190,13 +1190,13 @@ test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
- catch {interp delete slave2}
+test safePrimarySelection-6.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+ catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
} -body {
set res0 [::_test_tmp::getPrimarySelection]
- set int2 slave2
+ set int2 child2
::safe::interpCreate $int2
::safe::loadTk $int2
$int2 eval $::_test_tmp::script
diff --git a/tests/scale.test b/tests/scale.test
index 955092b..055762f 100644
--- a/tests/scale.test
+++ b/tests/scale.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "scale" command
# of Tk. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -46,7 +46,7 @@ test scale-1.5 {configuration options} -body {
.s cget -bd
} -cleanup {
.s configure -bd [lindex [.s configure -bd] 3]
-} -result {4}
+} -result 4
test scale-1.6 {configuration options} -body {
.s configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -73,7 +73,7 @@ test scale-1.11 {configuration options} -body {
.s cget -borderwidth
} -cleanup {
.s configure -borderwidth [lindex [.s configure -borderwidth] 3]
-} -result {1}
+} -result 1
test scale-1.12 {configuration options} -body {
.s configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -97,7 +97,7 @@ test scale-1.17 {configuration options} -body {
.s cget -digits
} -cleanup {
.s configure -digits [lindex [.s configure -digits] 3]
-} -result {5}
+} -result 5
test scale-1.18 {configuration options} -body {
.s configure -digits badValue
} -returnCodes error -result {expected integer but got "badValue"}
@@ -157,7 +157,7 @@ test scale-1.31 {configuration options} -body {
.s cget -highlightthickness
} -cleanup {
.s configure -highlightthickness [lindex [.s configure -highlightthickness] 3]
-} -result {2}
+} -result 2
test scale-1.32 {configuration options} -body {
.s configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -172,7 +172,7 @@ test scale-1.35 {configuration options} -body {
.s cget -length
} -cleanup {
.s configure -length [lindex [.s configure -length] 3]
-} -result {130}
+} -result 130
test scale-1.36 {configuration options} -body {
.s configure -length badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -205,7 +205,7 @@ test scale-1.43 {configuration options} -body {
.s cget -repeatdelay
} -cleanup {
.s configure -repeatdelay [lindex [.s configure -repeatdelay] 3]
-} -result {14}
+} -result 14
test scale-1.44 {configuration options} -body {
.s configure -repeatdelay bogus
} -returnCodes error -result {expected integer but got "bogus"}
@@ -214,7 +214,7 @@ test scale-1.45 {configuration options} -body {
.s cget -repeatinterval
} -cleanup {
.s configure -repeatinterval [lindex [.s configure -repeatinterval] 3]
-} -result {14}
+} -result 14
test scale-1.46 {configuration options} -body {
.s configure -repeatinterval bogus
} -returnCodes error -result {expected integer but got "bogus"}
@@ -232,7 +232,7 @@ test scale-1.49 {configuration options} -body {
.s cget -showvalue
} -cleanup {
.s configure -showvalue [lindex [.s configure -showvalue] 3]
-} -result {0}
+} -result 0
test scale-1.50 {configuration options} -body {
.s configure -showvalue badValue
} -returnCodes error -result {expected boolean value but got "badValue"}
@@ -241,7 +241,7 @@ test scale-1.51 {configuration options} -body {
.s cget -sliderlength
} -cleanup {
.s configure -sliderlength [lindex [.s configure -sliderlength] 3]
-} -result {86}
+} -result 86
test scale-1.52 {configuration options} -body {
.s configure -sliderlength badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -313,7 +313,7 @@ test scale-1.69 {configuration options} -body {
.s cget -width
} -cleanup {
.s configure -width [lindex [.s configure -width] 3]
-} -result {32}
+} -result 32
test scale-1.70 {configuration options} -body {
.s configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -359,7 +359,7 @@ test scale-3.4 {ScaleWidgetCmd procedure, cget option} -body {
test scale-3.5 {ScaleWidgetCmd procedure, cget option} -body {
.s configure -highlightthickness 2
.s cget -highlightthickness
-} -result {2}
+} -result 2
test scale-3.6 {ScaleWidgetCmd procedure, configure option} -body {
list [llength [.s configure]] [lindex [.s configure] 6]
} -result {33 {-command command Command {} {}}}
@@ -466,7 +466,7 @@ test scale-3.28 {ScaleWidgetCmd procedure, set option} -body {
.s set 181
.s configure -state normal
.s get
-} -result {118}
+} -result 118
test scale-3.29 {ScaleWidgetCmd procedure} -body {
.s dumb
} -returnCodes error -result {bad option "dumb": must be cget, configure, coords, get, identify, or set}
@@ -588,27 +588,27 @@ test scale-6.1 {ComputeFormat procedure} -body {
.s configure -from 10 -to 100 -resolution 10
.s set 49.3
.s get
-} -result {50}
+} -result 50
test scale-6.2 {ComputeFormat procedure} -body {
.s configure -from 100 -to 1000 -resolution 100
.s set 493
.s get
-} -result {500}
+} -result 500
test scale-6.3 {ComputeFormat procedure} -body {
.s configure -from 1000 -to 10000 -resolution 1000
.s set 4930
.s get
-} -result {5000}
+} -result 5000
test scale-6.4 {ComputeFormat procedure} -body {
.s configure -from 10000 -to 100000 -resolution 10000
.s set 49000
.s get
-} -result {50000}
+} -result 50000
test scale-6.5 {ComputeFormat procedure} -body {
.s configure -from 100000 -to 1000000 -resolution 100000
.s set 493000
.s get
-} -result {500000}
+} -result 500000
test scale-6.6 {ComputeFormat procedure} -constraints {
nonPortable
} -body {
@@ -617,7 +617,7 @@ test scale-6.6 {ComputeFormat procedure} -constraints {
.s configure -from 1000000 -to 10000000 -resolution 1000000
.s set 4930000
.s get
-} -result {5000000}
+} -result 5000000
test scale-6.7 {ComputeFormat procedure} -body {
.s configure -from 1000000000 -to 10000000000 -resolution 1000000000
.s set 4930000000
@@ -652,7 +652,7 @@ test scale-6.13 {ComputeFormat procedure} -body {
.s configure -from .000001 -to .00001 -resolution .000001
.s set .000006
expr {[.s get] == 6.0e-06}
-} -result {1}
+} -result 1
test scale-6.14 {ComputeFormat procedure} -body {
.s configure -to .00001 -from .0001 -resolution .00001
.s set .00006
@@ -662,17 +662,17 @@ test scale-6.15 {ComputeFormat procedure} -body {
.s configure -to .000001 -from .00001 -resolution .000001
.s set .000006
expr {[.s get] == 6.0e-06}
-} -result {1}
+} -result 1
test scale-6.16 {ComputeFormat procedure} -body {
.s configure -from .00001 -to .0001 -resolution .00001 -digits 1
.s set .00006
expr {[.s get] == 6e-05}
-} -result {1}
+} -result 1
test scale-6.17 {ComputeFormat procedure} -body {
.s configure -from 10000000 -to 100000000 -resolution 10000000 -digits 3
.s set 49300000
.s get
-} -result {50000000}
+} -result 50000000
test scale-6.18 {ComputeFormat procedure} -body {
.s configure -length 200 -from 0 -to 10 -resolution 0 -digits 0
.s set .111111111
@@ -1135,26 +1135,26 @@ test scale-14.5 {RoundValueToResolution procedure} -body {
-orient horizontal -resolution 4.0
update
.s get 84 152
-} -result {-28}
+} -result -28
test scale-14.6 {RoundValueToResolution procedure} -body {
.s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
-} -result {-24}
+} -result -24
test scale-14.7 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 84 152
-} -result {-72}
+} -result -72
test scale-14.8 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \
-orient horizontal -resolution 4.0
update
.s get 86 152
-} -result {-76}
+} -result -76
test scale-14.9 {RoundValueToResolution procedure} -body {
.s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \
@@ -1205,7 +1205,7 @@ test scale-14a.1 {RoundValueToResolution, RoundIntervalToResolution procedures}
.s get 200 0
} -cleanup {
destroy .s
-} -result {5}
+} -result 5
test scale-14a.2 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup {
pack [scale .s -orient horizontal]
update
@@ -1226,7 +1226,7 @@ test scale-15.1 {ScaleVarProc procedure} -setup {
scale .s -from 0 -to -200 -variable y -orient horizontal -length 150
pack .s
return $y
-} -result {-130}
+} -result -130
test scale-15.2 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1235,7 +1235,7 @@ test scale-15.2 {ScaleVarProc procedure} -setup {
pack .s
set y -87
.s get
-} -result {-87}
+} -result -87
test scale-15.3 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1256,7 +1256,7 @@ test scale-15.4 {ScaleVarProc procedure} -setup {
.s get
} -cleanup {
deleteWindows
-} -result {-130}
+} -result -130
test scale-15.5 {ScaleVarProc procedure} -setup {
deleteWindows
} -body {
@@ -1344,7 +1344,7 @@ test scale-17.1 {bug fix 1786} -setup {
return $x
} -cleanup {
deleteWindows
-} -result {100}
+} -result 100
test scale-18.1 {DestroyScale, -cursor option [Bug: 3897]} -setup {
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index e02e3a8..e366c40 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -2,15 +2,19 @@
# the "scrollbar" command of Tk. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}]
+
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -197,7 +201,7 @@ test scrollbar-3.14.1 {ScrollbarWidgetCmd procedure, "cget" option} emptyTest {
destroy .s2
test scrollbar-3.15 {ScrollbarWidgetCmd procedure, "configure" option} {
llength [.s configure]
-} {20}
+} 20
test scrollbar-3.16 {ScrollbarWidgetCmd procedure, "configure" option} {
list [catch {.s configure -bad} msg] $msg
} {1 {unknown option "-bad"}}
@@ -230,7 +234,7 @@ test scrollbar-3.24 {ScrollbarWidgetCmd procedure, "delta" option} {
} {1 {expected integer but got "xxyz"}}
test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 20 0]
-} {0}
+} 0
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 0 20]
} [format %.6g [expr {20.0/([getTroughSize .s]-1)}]]
@@ -262,21 +266,21 @@ test scrollbar-3.32 {ScrollbarWidgetCmd procedure, "fraction" option} {
} {1 {expected integer but got "bogus"}}
test scrollbar-3.33 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 0]
-} {0}
+} 0
test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 0 1000]
-} {1}
+} 1
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 4 21]
} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
/([getTroughSize .s] - 1)}]]
-test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
+test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 179]
-} {1}
+} 1
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
-} {1}
-test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
+} 1
+test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu failsOnXQuarz} {
format {%.6g} [.s fraction 4 178]
} {0.993711}
test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
@@ -309,12 +313,12 @@ if {[testConstraint testmetrics]} {
update
test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.t.s fraction 100 0]
-} {0}
+} 0
destroy .t
test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} {
list [catch {.s get a} msg] $msg
} {1 {wrong # args: should be ".s get"}}
-test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} {
+test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated {
.s set 100 10 13 14
.s get
} {100 10 13 14}
@@ -341,7 +345,7 @@ test scrollbar-3.49 {ScrollbarWidgetCmd procedure, "identify" option} {
test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} notAqua {
.s identify 5 5
} {arrow1}
-test scrollbar-3.50.1 {ScrollbarWidgetCmd procedure, "identify" option} aqua {
+test scrollbar-3.50.2 {ScrollbarWidgetCmd procedure, "identify" option} aqua {
# macOS scrollbars have no arrows nowadays
.s identify 5 5
} {trough1}
@@ -399,27 +403,27 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} {
}
set result
} {0.4 0.4}
-test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set abc def ghi jkl} msg] $msg
} {1 {expected integer but got "abc"}}
-test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 def ghi jkl} msg] $msg
} {1 {expected integer but got "def"}}
-test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 ghi jkl} msg] $msg
} {1 {expected integer but got "ghi"}}
-test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
list [catch {.s set 1 2 3 jkl} msg] $msg
} {1 {expected integer but got "jkl"}}
-test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set -10 50 20 30
.s get
} {0 50 0 0}
-test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 -10 20 30
.s get
} {100 0 20 30}
-test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
+test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated {
.s set 100 50 30 20
.s get
} {100 50 30 30}
@@ -491,7 +495,7 @@ test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua {
# macOS scrollbars have no arrows nowadays
.s identify 8 4
} {trough1}
-test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 {
+test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} {
.s identify 8 19
} {arrow1}
test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
@@ -549,7 +553,7 @@ test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s]
- [testmetrics cyvscroll .s] - 1}]
} {trough2}
-test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 {
+test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu failsOnXQuarz} {
.s identify 8 180
} {arrow2}
test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua {
@@ -573,7 +577,7 @@ test scrollbar-6.33 {ScrollbarPosition procedure} win {
test scrollbar-6.34 {ScrollbarPosition procedure} unix {
.s identify 4 100
} {trough2}
-test scrollbar-6.35 {ScrollbarPosition procedure} unix {
+test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} {
.s identify 18 100
} {trough2}
test scrollbar-6.37 {ScrollbarPosition procedure} win {
@@ -612,7 +616,7 @@ test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
.t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s]
- 1}] [expr {[winfo height .t.s] / 2}]
} {slider}
-test scrollbar-6.44 {ScrollbarPosition procedure} unix {
+test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu failsOnXQuarz} {
.t.s identify 100 18
} {trough2}
test scrollbar-6.46 {ScrollbarPosition procedure} win {
@@ -685,7 +689,7 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} {
list [winfo children .] [interp hidden]
} [list {} $l]
-test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.1 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -yscrollcommand {.s set}] -side left
@@ -699,22 +703,8 @@ test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
} -cleanup {
destroy .t .s
} -result {5.0}
-test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -yscrollcommand {.s set}] -side left
- for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
- pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {5.0}
-test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -728,21 +718,7 @@ test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constr
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <Shift-MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
-test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -756,20 +732,6 @@ test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
proc destroy_scrollbar {} {
diff --git a/tests/select.test b/tests/select.test
index 9146397..b1d5d56 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -2,8 +2,8 @@
# especially the "selection" command. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
@@ -23,6 +23,7 @@ if {![catch {selection get -selection CLIPBOARD_MANAGER -type TARGETS}]} {
testConstraint cliboardManagerPresent 1
}
}
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
global longValue selValue selInfo
@@ -895,7 +896,7 @@ test select-9.1 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue "1024 0xffff 2048 -2 "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -908,7 +909,7 @@ test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue " "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -921,7 +922,7 @@ test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
test select-9.4 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
-} -constraints x11 -body {
+} -constraints {x11 failsOnUbuntu} -body {
set selValue "16 foobar 32"
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -1006,7 +1007,7 @@ test select-10.3 {ConvertSelection procedure} -constraints x11 -setup {
# testing timers
# This one hangs in Exceed
test select-10.4 {ConvertSelection procedure} -constraints {
- x11 noExceed
+ x11 noExceed failsOnUbuntu
} -setup {
setup
setupbg
@@ -1021,7 +1022,7 @@ test select-10.4 {ConvertSelection procedure} -constraints {
lappend result $selInfo
} -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}}
test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
- x11
+ x11 failsOnUbuntu
} -setup {
setup
setupbg
@@ -1036,7 +1037,7 @@ test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
lappend result $selInfo
} -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}}
test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
- x11
+ x11 failsOnUbuntu
} -setup {
setup
setupbg
@@ -1059,7 +1060,7 @@ test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
##############################################################################
# testing reentrancy
-test select-11.1 {TkSelPropProc procedure} -constraints x11 -setup {
+test select-11.1 {TkSelPropProc procedure} -constraints {x11 failsOnUbuntu} -setup {
setup
setupbg
} -body {
@@ -1131,7 +1132,7 @@ test select-12.6 {DefaultSelection procedure} -body {
} -result {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
test select-13.1 {SelectionSize procedure, handler deleted} -constraints {
- x11
+ x11 failsOnUbuntu
} -setup {
setup
setupbg
diff --git a/tests/send.test b/tests/send.test
index 403a207..33d3d7c 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -2,19 +2,20 @@
# other procedures in the file tkSend.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2001 by ActiveState Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 2001 by ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
testConstraint xhost [llength [auto_execok xhost]]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
# Compute a script that will load Tk into a child interpreter.
@@ -286,7 +287,7 @@ test send-8.14 {Tk_SendCmd procedure, local interp killed by send} {secureserver
catch {interp delete t_s_2}
-test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend} {
+test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend failsOnUbuntu} {
catch {error foo}
list [catch {send t_s_1 {if 1 {open bogus_file_name}}} msg] $msg $errorInfo $errorCode
} {1 {couldn't open "bogus_file_name": no such file or directory} {couldn't open "bogus_file_name": no such file or directory
@@ -296,7 +297,7 @@ test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver te
"if 1 {open bogus_file_name}"
invoked from within
"send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}}
-test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend} {
+test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu} {
testsend prop root InterpRegistry "10234 bogus\n"
set result [list [catch {send bogus bogus command} msg] $msg]
winfo interps
@@ -401,14 +402,14 @@ test send-10.4 {SendEventProc procedure, leading nulls, bogus commands} {secures
set a null
update
set a
-} {44}
+} 44
test send-10.5 {SendEventProc procedure, extraneous command options} {secureserver testsend} {
testsend prop comm Comm \
"c\n-n tktest\n-x miscellanous\n-y who knows?\n-s set a new\n"
set a null
update
set a
-} {new}
+} new
test send-10.6 {SendEventProc procedure, unknown interpreter} {secureserver testsend} {
testsend prop [winfo id .f] Comm {}
testsend prop comm Comm \
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 2d03cf1..9267360 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test spinbox widgets in Tk. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,7 +11,11 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
# For xscrollcommand
+set scrollInfo {}
proc scroll args {
global scrollInfo
set scrollInfo $args
@@ -93,7 +97,7 @@ test spinbox-1.5 {configuration option: "bd"} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-1.6 {configuration option: "bd" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -137,7 +141,7 @@ test spinbox-1.9 {configuration option: "borderwidth"} -setup {
.e cget -borderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.10 {configuration option: "borderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -281,7 +285,7 @@ test spinbox-1.22 {configuration option: "exportselection"} -setup {
.e cget -exportselection
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.23 {configuration option: "exportselection" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -457,7 +461,7 @@ test spinbox-1.38 {configuration option: "highlightthickness"} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-1.39 {configuration option: "highlightthickness" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -479,7 +483,7 @@ test spinbox-1.40 {configuration option: "highlightthickness"} -setup {
.e cget -highlightthickness
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-1.41 {configuration option: "increment"} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
@@ -535,7 +539,7 @@ test spinbox-1.45 {configuration option: "insertborderwidth"} -setup {
.e cget -insertborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.46 {configuration option: "insertborderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -557,7 +561,7 @@ test spinbox-1.47 {configuration option: "insertofftime"} -setup {
.e cget -insertofftime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test spinbox-1.48 {configuration option: "insertofftime" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -579,7 +583,7 @@ test spinbox-1.49 {configuration option: "insertontime"} -setup {
.e cget -insertontime
} -cleanup {
destroy .e
-} -result {100}
+} -result 100
test spinbox-1.50 {configuration option: "insertontime" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -691,7 +695,7 @@ test spinbox-1.59 {configuration option: "repeatdelay"} -setup {
.e cget -repeatdelay
} -cleanup {
destroy .e
-} -result {500}
+} -result 500
test spinbox-1.60 {configuration option: "repeatdelay" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -713,7 +717,7 @@ test spinbox-1.61 {configuration option: "repeatinterval"} -setup {
.e cget -repeatinterval
} -cleanup {
destroy .e
-} -result {-500}
+} -result -500
test spinbox-1.62 {configuration option: "repeatinterval" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -757,7 +761,7 @@ test spinbox-1.65 {configuration option: "selectborderwidth"} -setup {
.e cget -selectborderwidth
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.66 {configuration option: "selectborderwidth" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -937,7 +941,7 @@ test spinbox-1.81 {configuration option: "width"} -setup {
.e cget -width
} -cleanup {
destroy .e
-} -result {402}
+} -result 402
test spinbox-1.82 {configuration option: "width" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -959,7 +963,7 @@ test spinbox-1.83 {configuration option: "wrap"} -setup {
.e cget -wrap
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-1.84 {configuration option: "wrap" for spinbox} -setup {
spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
-relief sunken
@@ -1086,7 +1090,7 @@ test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint
update
} -body {
# Tcl_UtfAtIndex(): utf at end
- .e insert 0 "ab\u4e4e"
+ .e insert 0 "ab乎"
.e bbox end
} -cleanup {
destroy .e
@@ -1099,7 +1103,7 @@ test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraint
update
} -body {
# Tcl_UtfAtIndex(): utf before index
- .e insert 0 "ab\u4e4ec"
+ .e insert 0 "ab乎c"
.e bbox 3
} -cleanup {
destroy .e
@@ -1121,7 +1125,7 @@ test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constrain
pack .e
update
} -body {
- .e insert 0 "abcdefghij\u4e4eklmnop"
+ .e insert 0 "abcdefghij乎klmnop"
list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end]
} -cleanup {
destroy .e
@@ -1154,7 +1158,7 @@ test spinbox-3.14 {SpinboxWidgetCmd procedure, "cget" widget command} -setup {
.e cget -bd
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setup {
spinbox .e
pack .e
@@ -1163,7 +1167,7 @@ test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setu
llength [.e configure]
} -cleanup {
destroy .e
-} -result {51}
+} -result 51
test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup {
spinbox .e
} -body {
@@ -1179,7 +1183,7 @@ test spinbox-3.17 {SpinboxWidgetCmd procedure, "configure" widget command} -setu
lindex [.e configure -bd] 4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.18 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
} -body {
@@ -1218,7 +1222,7 @@ test spinbox-3.22 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {014567890}
+} -result 014567890
test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
} -body {
@@ -1227,7 +1231,7 @@ test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {0123457890}
+} -result 0123457890
test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1235,20 +1239,20 @@ test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
set x {}
} -body {
# UTF
- .e insert end "01234\u4e4e67890"
+ .e insert end "01234乎67890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "012345\u4e4e7890"
+ .e insert end "012345乎7890"
.e delete 6
lappend x [.e get]
.e delete 0 end
- .e insert end "0123456\u4e4e890"
+ .e insert end "0123456乎890"
.e delete 6
lappend x [.e get]
} -cleanup {
destroy .e
-} -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"]
+} -result [list "01234乎7890" "0123457890" "012345乎890"]
test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1259,7 +1263,7 @@ test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1272,7 +1276,7 @@ test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup {
spinbox .e
pack .e
@@ -1285,7 +1289,7 @@ test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.27 {SpinboxWidgetCmd procedure, "get" widget command} -setup {
spinbox .e
} -body {
@@ -1315,7 +1319,7 @@ test spinbox-3.30 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-3.31 {SpinboxWidgetCmd procedure, "index" widget command} -setup {
spinbox .e
} -body {
@@ -1352,7 +1356,7 @@ test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup {
update
} -body {
# UTF
- .e insert 0 abc\u4e4e\u0153def
+ .e insert 0 abc乎œdef
list [.e index 3] [.e index 4] [.e index end]
} -cleanup {
destroy .e
@@ -1401,7 +1405,7 @@ test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
spinbox .e
pack .e
@@ -1414,7 +1418,7 @@ test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup
.e get
} -cleanup {
destroy .e
-} -result {01234567890}
+} -result 01234567890
test spinbox-3.41 {SpinboxWidgetCmd procedure, "insert" widget command} -setup {
spinbox .e
} -body {
@@ -1474,7 +1478,7 @@ test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constrain
.e index @0
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test spinbox-3.47 {SpinboxWidgetCmd procedure, "select" widget command} -setup {
spinbox .e
} -body {
@@ -1543,7 +1547,7 @@ test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup {
spinbox .e
pack .e
@@ -1556,7 +1560,7 @@ test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup {
spinbox .e
pack .e
@@ -1569,7 +1573,7 @@ test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget comman
.e selection present
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-3.55 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup {
spinbox .e
} -body {
@@ -1597,7 +1601,7 @@ test spinbox-3.57 {SpinboxWidgetCmd procedure, "selection adjust" widget command
selection get
} -cleanup {
destroy .e
-} -result {123}
+} -result 123
test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command} -setup {
spinbox .e
pack .e
@@ -1611,7 +1615,7 @@ test spinbox-3.58 {SpinboxWidgetCmd procedure, "selection adjust" widget command
selection get
} -cleanup {
destroy .e
-} -result {234}
+} -result 234
test spinbox-3.59 {SpinboxWidgetCmd procedure, "selection from" widget command} -setup {
spinbox .e
} -body {
@@ -1784,7 +1788,7 @@ test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e xview scroll gorp units
} -cleanup {
destroy .e
-} -returnCodes error -result {expected integer but got "gorp"}
+} -returnCodes error -result {expected floating-point number but got "gorp"}
test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1825,7 +1829,7 @@ test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {32}
+} -result 32
test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1839,7 +1843,7 @@ test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {29}
+} -result 29
test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1871,11 +1875,11 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e insert end "runs off the end of the window quite a bit."
.e xview 0
update
- .e xview -4
+ .e xview -1
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
@@ -1887,14 +1891,14 @@ test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {73}
+} -result 73
test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup {
spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .e
} -body {
.e insert end "This is quite a long text string, so long that it "
.e insert end "runs off the end of the window quite a bit."
- .e insert 10 \u4e4e
+ .e insert 10 乎
update
# UTF
# If Tcl_NumUtfChars wasn't used, wrong answer would be:
@@ -1926,7 +1930,7 @@ test spinbox-5.1 {ConfigureSpinbox procedure, -textvariable} -body {
.e get
} -cleanup {
destroy .e
-} -result {12345}
+} -result 12345
test spinbox-5.2 {ConfigureSpinbox procedure, -textvariable} -body {
set x 12345
spinbox .e -textvariable x
@@ -2013,9 +2017,10 @@ test spinbox-5.7 {ConfigureSpinbox procedure} -setup {
} -body {
.e configure -font {Courier -12} -width 4 -xscrollcommand scroll
.e insert end "01234567890"
- set timeout [after 500 {set $scrollInfo "timeout"}]
- vwait scrollInfo
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e configure -width 5
+ vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
@@ -2144,7 +2149,7 @@ test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup {
spinbox .e -highlightthickness 2
pack .e
@@ -2156,7 +2161,7 @@ test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-6.6 {SpinboxComputeGeometry procedure} -constraints {
fonts
} -setup {
@@ -2219,8 +2224,9 @@ test spinbox-7.1 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 2 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2236,8 +2242,9 @@ test spinbox-7.2 {InsertChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 500 XXX
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2311,7 +2318,7 @@ test spinbox-7.7 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test spinbox-7.8 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2322,7 +2329,7 @@ test spinbox-7.8 {InsertChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-7.9 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2334,7 +2341,7 @@ test spinbox-7.9 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {7}
+} -result 7
test spinbox-7.10 {InsertChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2346,7 +2353,7 @@ test spinbox-7.10 {InsertChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-7.11 {InsertChars procedure} -constraints {
fonts
@@ -2360,7 +2367,7 @@ test spinbox-7.11 {InsertChars procedure} -constraints {
winfo reqwidth .e
} -cleanup {
destroy .e
-} -result {70}
+} -result 70
test spinbox-8.1 {DeleteChars procedure} -setup {
unset -nocomplain contents
@@ -2370,8 +2377,9 @@ test spinbox-8.1 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 2 4
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2386,8 +2394,9 @@ test spinbox-8.2 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
- .e delete -2 2
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
+ .e delete -1 2
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2402,8 +2411,9 @@ test spinbox-8.3 {DeleteChars procedure} -setup {
} -body {
.e configure -textvariable contents -xscrollcommand scroll
.e insert 0 abcde
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 3 1000
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo]
} -cleanup {
@@ -2545,7 +2555,7 @@ test spinbox-8.12 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.13 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2558,7 +2568,7 @@ test spinbox-8.13 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.14 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2571,7 +2581,7 @@ test spinbox-8.14 {DeleteChars procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-8.15 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2584,7 +2594,7 @@ test spinbox-8.15 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.16 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2597,7 +2607,7 @@ test spinbox-8.16 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-8.17 {DeleteChars procedure} -setup {
spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
@@ -2610,8 +2620,8 @@ test spinbox-8.17 {DeleteChars procedure} -setup {
.e index @0
} -cleanup {
destroy .e
-} -result {4}
-test spinbox-8.18 {DeleteChars procedure} -setup {
+} -result 4
+test spinbox-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup {
spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2
pack .e
focus .e
@@ -2637,7 +2647,7 @@ test spinbox-8.18 {DeleteChars procedure} -setup {
} -cleanup {
destroy .e
unset XPAD buttonWidth expected
-} -result {1}
+} -result 1
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
unset -nocomplain x
@@ -2717,7 +2727,7 @@ test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup
.e index @0
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2733,7 +2743,7 @@ test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup
.e index @0
} -cleanup {
destroy .e
-} -result {10}
+} -result 10
test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2748,7 +2758,7 @@ test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {3}
+} -result 3
test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup {
unset -nocomplain x
spinbox .e -highlightthickness 2 -bd 2
@@ -2762,7 +2772,7 @@ test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup
.e index insert
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-11.1 {SpinboxEventProc procedure} -setup {
spinbox .e -highlightthickness 2 -bd 2 -font {Helvetica -12}
@@ -2806,7 +2816,7 @@ test spinbox-13.1 {GetSpinboxIndex procedure} -setup {
.e index end
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
test spinbox-13.2 {GetSpinboxIndex procedure} -body {
spinbox .e
.e index abogus
@@ -2825,7 +2835,7 @@ test spinbox-13.3 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-13.4 {GetSpinboxIndex procedure} -setup {
spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2838,7 +2848,7 @@ test spinbox-13.4 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.5 {GetSpinboxIndex procedure} -setup {
spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken
pack .e
@@ -2852,7 +2862,7 @@ test spinbox-13.5 {GetSpinboxIndex procedure} -setup {
.e index anchor
} -cleanup {
destroy .e
-} -result {15}
+} -result 15
test spinbox-13.6 {GetSpinboxIndex procedure} -setup {
spinbox .e
} -body {
@@ -2871,7 +2881,7 @@ test spinbox-13.7 {GetSpinboxIndex procedure} -setup {
.e index insert
} -cleanup {
destroy .e
-} -result {2}
+} -result 2
test spinbox-13.8 {GetSpinboxIndex procedure} -setup {
spinbox .e
} -body {
@@ -2931,7 +2941,7 @@ test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body {
.e index sel.first
} -cleanup {
destroy .e
-} -result {1}
+} -result 1
test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body {
# Previous settings:
@@ -3043,7 +3053,7 @@ test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @4
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3054,7 +3064,7 @@ test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @11
} -cleanup {
destroy .e
-} -result {4}
+} -result 4
test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3065,7 +3075,7 @@ test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @12
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3076,7 +3086,7 @@ test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 6-11}]
} -cleanup {
destroy .e
-} -result {8}
+} -result 8
test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3087,7 +3097,7 @@ test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body {
.e index @[expr {[winfo width .e] - 5}]
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test spinbox-13.21 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3098,7 +3108,7 @@ test spinbox-13.21 {GetSpinboxIndex procedure} -body {
.e index @1000
} -cleanup {
destroy .e
-} -result {9}
+} -result 9
test spinbox-13.22 {GetSpinboxIndex procedure} -setup {
spinbox .e
pack .e
@@ -3115,10 +3125,10 @@ test spinbox-13.23 {GetSpinboxIndex procedure} -body {
.e insert 0 012345678901234567890
.e xview 4
update
- .e index -10
+ .e index -1
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-13.24 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3129,7 +3139,7 @@ test spinbox-13.24 {GetSpinboxIndex procedure} -body {
.e index 12
} -cleanup {
destroy .e
-} -result {12}
+} -result 12
test spinbox-13.25 {GetSpinboxIndex procedure} -body {
spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \
-font {Courier -12}
@@ -3140,7 +3150,7 @@ test spinbox-13.25 {GetSpinboxIndex procedure} -body {
.e index 49
} -cleanup {
destroy .e
-} -result {21}
+} -result 21
# XXX Still need to write tests for SpinboxScanTo and SpinboxSelectTo.
@@ -3166,7 +3176,7 @@ test spinbox-14.3 {SpinboxFetchSelection procedure} -setup {
string compare [selection get] $x
} -cleanup {
destroy .e
-} -result {0}
+} -result 0
test spinbox-15.1 {SpinboxLostSelection} -body {
spinbox .e
@@ -3203,9 +3213,10 @@ test spinbox-16.2 {SpinboxVisibleRange procedure} -body {
test spinbox-17.1 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e delete 0 end
.e insert 0 123
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3216,8 +3227,9 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
.e insert 0 0123456789abcdef
+ update idletasks
+ set timeout [after 500 {set $scrollInfo {-1000000 -1000000}}]
.e xview 3
- set timeout [after 500 {set $scrollInfo "timeout"}]
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
@@ -3227,23 +3239,26 @@ test spinbox-17.2 {SpinboxUpdateScrollbar procedure} -body {
test spinbox-17.3 {SpinboxUpdateScrollbar procedure} -body {
spinbox .e -width 10 -xscrollcommand scroll -font {Courier -12}
pack .e
+ update idletasks
+ set timeout [after 500 {set scrollInfo {-1000000 -1000000}}]
.e insert 0 abcdefghijklmnopqrs
- .e xview 6
- set timeout [after 500 {set $scrollInfo "timeout"}]
+ .e xview
vwait scrollInfo
format {%.6f %.6f} {*}$scrollInfo
} -cleanup {
destroy .e
after cancel $timeout
-} -result {0.315789 0.842105}
+} -result {0.000000 0.526316}
test spinbox-17.4 {SpinboxUpdateScrollbar procedure} -setup {
proc bgerror msg {
global x
set x $msg
}
} -body {
- spinbox .e -width 5 -xscrollcommand thisisnotacommand
+ spinbox .e -width 5
pack .e
+ update idletasks
+ .e configure -xscrollcommand thisisnotacommand
vwait x
list $x $errorInfo
} -cleanup {
@@ -3264,7 +3279,7 @@ test spinbox-18.1 {Spinbox widget vs hiding} -setup {
set res1 [list [winfo children .] [interp hidden]]
set res2 [list {} $l]
expr {$res1 == $res2}
-} -result {1}
+} -result 1
##
## Spinbox widget VALIDATION tests
@@ -3624,7 +3639,7 @@ test spinbox-19.19 {spinbox widget validation} -setup {
list [.e cget -validate] [.e get] $::vVals
} -cleanup {
destroy .e
-} -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
+} -result {none nextdata {.e -1 -1 nextdata nextdata {} all forced}}
## This leaves validate alone because we trigger validation through the
## textvar (a write trace), and the write during validation triggers
@@ -3650,6 +3665,26 @@ test spinbox-19.20 {spinbox widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+test spinbox-19.21 {spinbox widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ spinbox .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##
@@ -3805,7 +3840,7 @@ test spinbox-22.1 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body {
set val 5
spinbox .e -from 1 -to 10 -textvariable val
@@ -3813,7 +3848,7 @@ test spinbox-22.2 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {5}
+} -result 5
test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body {
set val 5
spinbox .e -from 3 -to 10 -textvariable val
@@ -3821,7 +3856,7 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} -body {
set val
} -cleanup {
destroy .e
-} -result {6}
+} -result 6
test spinbox-23.1 {selection present while disabled, bug 637828} -body {
spinbox .e
diff --git a/tests/text.test b/tests/text.test
index 7770084..19b19a9 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkText.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -28,7 +28,7 @@ test text-1.1 {configuration option: "autoseparators"} -setup {
.t cget -autoseparators
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.1b {configuration option: "autoseparators", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -37,7 +37,7 @@ test text-1.1b {configuration option: "autoseparators", default} -setup {
.t cget -autoseparators
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.2 {configuration option: "autoseparators"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -75,7 +75,7 @@ test text-1.5 {configuration option: "bd"} -setup {
.t cget -bd
} -cleanup {
destroy .t
-} -result {4}
+} -result 4
test text-1.6 {configuration option: "bd"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -113,7 +113,7 @@ test text-1.9 {configuration option: "blockcursor"} -setup {
.t cget -blockcursor
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.10 {configuration option: "blockcursor"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -132,7 +132,7 @@ test text-1.11 {configuration option: "borderwidth"} -setup {
.t cget -borderwidth
} -cleanup {
destroy .t
-} -result {7}
+} -result 7
test text-1.12 {configuration option: "borderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -170,7 +170,7 @@ test text-1.15 {configuration option: "exportselection"} -setup {
.t cget -exportselection
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.16 {configuration option: "exportselection"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -246,7 +246,7 @@ test text-1.23 {configuration option: "height"} -setup {
.t cget -height
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.24 {configuration option: "height"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -303,7 +303,7 @@ test text-1.29 {configuration option: "highlightthickness"} -setup {
.t cget -highlightthickness
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.30 {configuration option: "highlightthickness"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -360,7 +360,7 @@ test text-1.35 {configuration option: "insertborderwidth"} -setup {
.t cget -insertborderwidth
} -cleanup {
destroy .t
-} -result {45}
+} -result 45
test text-1.36 {configuration option: "insertborderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -379,7 +379,7 @@ test text-1.37 {configuration option: "insertofftime"} -setup {
.t cget -insertofftime
} -cleanup {
destroy .t
-} -result {100}
+} -result 100
test text-1.38 {configuration option: "insertofftime"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -398,7 +398,7 @@ test text-1.39 {configuration option: "insertontime"} -setup {
.t cget -insertontime
} -cleanup {
destroy .t
-} -result {47}
+} -result 47
test text-1.40 {configuration option: "insertontime"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -417,7 +417,7 @@ test text-1.41 {configuration option: "insertwidth"} -setup {
.t cget -insertwidth
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-1.42 {configuration option: "insertwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -436,7 +436,7 @@ test text-1.43 {configuration option: "maxundo"} -setup {
.t cget -maxundo
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.43b {configuration option: "maxundo", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -445,7 +445,7 @@ test text-1.43b {configuration option: "maxundo", default} -setup {
.t cget -maxundo
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.44 {configuration option: "maxundo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -464,7 +464,7 @@ test text-1.45 {configuration option: "padx"} -setup {
.t cget -padx
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-1.46 {configuration option: "padx"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -483,7 +483,7 @@ test text-1.47 {configuration option: "pady"} -setup {
.t cget -pady
} -cleanup {
destroy .t
-} -result {82}
+} -result 82
test text-1.48 {configuration option: "pady"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -540,7 +540,7 @@ test text-1.53 {configuration option: "selectborderwidth"} -setup {
.t cget -selectborderwidth
} -cleanup {
destroy .t
-} -result {21}
+} -result 21
test text-1.54 {configuration option: "selectborderwidth"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -578,7 +578,7 @@ test text-1.57 {configuration option: "spacing1"} -setup {
.t cget -spacing1
} -cleanup {
destroy .t
-} -result {20}
+} -result 20
test text-1.58 {configuration option: "spacing1"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -597,7 +597,7 @@ test text-1.59 {configuration option: "spacing1"} -setup {
.t cget -spacing1
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.60 {configuration option: "spacing1"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -616,7 +616,7 @@ test text-1.61 {configuration option: "spacing2"} -setup {
.t cget -spacing2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-1.62 {configuration option: "spacing2"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -635,7 +635,7 @@ test text-1.63 {configuration option: "spacing2"} -setup {
.t cget -spacing2
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.64 {configuration option: "spacing2"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -654,7 +654,7 @@ test text-1.65 {configuration option: "spacing3"} -setup {
.t cget -spacing3
} -cleanup {
destroy .t
-} -result {20}
+} -result 20
test text-1.66 {configuration option: "spacing3"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -673,7 +673,7 @@ test text-1.67 {configuration option: "spacing3"} -setup {
.t cget -spacing3
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.68 {configuration option: "spacing3"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -749,7 +749,7 @@ test text-1.75 {configuration option: "undo"} -setup {
.t cget -undo
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-1.75b {configuration option: "undo", default} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -758,7 +758,7 @@ test text-1.75b {configuration option: "undo", default} -setup {
.t cget -undo
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-1.76 {configuration option: "undo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -777,7 +777,7 @@ test text-1.77 {configuration option: "width"} -setup {
.t cget -width
} -cleanup {
destroy .t
-} -result {73}
+} -result 73
test text-1.78 {configuration option: "width"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -1004,7 +1004,7 @@ test text-5.4 {TextWidgetCmd procedure, "cget" option} -setup {
.t cget -bd
} -cleanup {
destroy .t
-} -result {17}
+} -result 17
test text-6.1 {TextWidgetCmd procedure, "compare" option} -setup {
@@ -1198,7 +1198,7 @@ test text-7.3 {TextWidgetCmd procedure, "debug" option} -setup {
.t deb
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-7.4 {TextWidgetCmd procedure, "debug" option} -setup {
text .t
} -body {
@@ -1206,7 +1206,7 @@ test text-7.4 {TextWidgetCmd procedure, "debug" option} -setup {
.t debug
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-8.1 {TextWidgetCmd procedure, "delete" option} -setup {
@@ -1252,7 +1252,7 @@ bOy GIrl .#@? x_yz
Line 7"
.t configure -state disabled
.t delete 2.3
- .t g 2.0 2.end
+ .t get 2.0 2.end
} -cleanup {
destroy .t
} -result {abcdefghijklm}
@@ -1458,7 +1458,7 @@ Line 7"
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.22 {TextWidgetCmd procedure, "replace" option with undo} -setup {
text .t
set res {}
@@ -1514,14 +1514,14 @@ Line 7"
# Ensure that undo (even composite undo like 'replace')
# works when the widget shows nothing useful.
.t replace 2.1 2.3 foo
- .t configure -start 1 -end 1
+ .t configure -startline 1 -endline 1
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup {
text .t
} -body {
@@ -1540,15 +1540,15 @@ Line 7"
# works when the the event took place in one peer, which
# is then deleted, before the undo takes place in another peer.
.tt replace 2.1 2.3 foo
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
.t edit undo
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
.t configure -undo 0
string equal [.t get 1.0 end-1c] $prevtext
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-8.25 {TextWidgetCmd procedure, "replace" option with peers, undo} -setup {
text .t
} -body {
@@ -1569,14 +1569,14 @@ Line 7"
# which isn't showing everything.
.tt replace 2.1 2.3 foo
set res [.tt get 2.1 2.4]
- .tt configure -start 1 -end 1
+ .tt configure -startline 1 -endline 1
destroy .tt
- .t configure -start 3 -end 4
+ .t configure -startline 3 -endline 4
# msg will actually be set to a silently ignored error message here,
# (that the .tt command doesn't exist), but that is not important.
lappend res [catch {.t edit undo}]
.t configure -undo 0
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [string equal [.t get 1.0 end-1c] $prevtext]
} -cleanup {
destroy .t
@@ -2068,7 +2068,7 @@ test text-10.2 {TextWidgetCmd procedure, "count" option} -setup {
.t count blah 1.0 2.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "blah" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "blah": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.3 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2103,7 +2103,7 @@ Line 7"
.t count 5.7 5.3
} -cleanup {
destroy .t
-} -result {-4}
+} -result -4
test text-10.7 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2117,7 +2117,7 @@ Line 7"
.t count 5.3 5.5
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.8 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2131,7 +2131,7 @@ Line 7"
.t count 5.3 end
} -cleanup {
destroy .t
-} -result {29}
+} -result 29
test text-10.9 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2145,7 +2145,7 @@ Line 7"
.t count 5.2 5.7
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.10 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2159,7 +2159,7 @@ Line 7"
.t count 5.2 5.3
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.11 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2173,7 +2173,7 @@ Line 7"
.t count 5.2 5.4
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.12 {TextWidgetCmd procedure, "count" option} -setup {
text .t
.t insert 1.0 "Line 1
@@ -2203,7 +2203,7 @@ Line 7"
.t count -displayindices 2.0 3.0
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.14 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2219,7 +2219,7 @@ Line 7"
.t count -displayindices 2.2 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.15 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2236,7 +2236,7 @@ Line 7"
.t count -displayindices 2.0 4.2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.16 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2259,7 +2259,7 @@ Line 7"
.t count -displayindices 2.0 3.0
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.17 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2282,7 +2282,7 @@ Line 7"
.t count -displayindices 2.2 3.0
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.18 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2307,7 +2307,7 @@ Line 7"
.t count -displayindices a 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.19 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2331,7 +2331,7 @@ Line 7"
.t count -displayindices 2.0 4.2
} -cleanup {
destroy .t
-} -result {6}
+} -result 6
test text-10.20 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2355,7 +2355,7 @@ Line 7"
.t count -displaychars 2.0 3.0
} -cleanup {
destroy .t
-} -result {2}
+} -result 2
test text-10.21 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2379,7 +2379,7 @@ Line 7"
.t count -displaychars 2.2 3.0
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.22 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2404,7 +2404,7 @@ Line 7"
.t count -displaychars a 3.0
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.23 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2428,7 +2428,7 @@ Line 7"
.t count -displaychars 2.0 4.2
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-10.24 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2503,7 +2503,7 @@ Line 7"
.t count -indices 2.0 4.2
} -cleanup {
destroy .t
-} -result {21}
+} -result 21
test text-10.27 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2528,7 +2528,7 @@ Line 7"
.t count -chars 2.2 3.0
} -cleanup {
destroy .t
-} -result {10}
+} -result 10
test text-10.28 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2553,7 +2553,7 @@ Line 7"
.t count -chars a 3.0
} -cleanup {
destroy .t
-} -result {9}
+} -result 9
test text-10.29 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2578,7 +2578,7 @@ Line 7"
.t count -chars 2.0 4.2
} -cleanup {
destroy .t
-} -result {19}
+} -result 19
test text-10.30 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2588,7 +2588,7 @@ test text-10.30 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.0 end
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.31 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2598,7 +2598,7 @@ test text-10.31 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines end 1.0
} -cleanup {
destroy .t
-} -result {-3}
+} -result -3
test text-10.32 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2608,7 +2608,7 @@ test text-10.32 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.0 2.0 3.0
} -cleanup {
destroy .t
-} -returnCodes {error} -result {bad option "1.0" must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
+} -returnCodes {error} -result {bad option "1.0": must be -chars, -displaychars, -displayindices, -displaylines, -indices, -lines, -update, -xpixels, or -ypixels}
test text-10.33 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2618,7 +2618,7 @@ test text-10.33 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines end end
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.34 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2628,7 +2628,7 @@ test text-10.34 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 1.5 2.5
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-10.35 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2638,7 +2638,7 @@ test text-10.35 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 2.5 "2.5 lineend"
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-10.36 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2648,7 +2648,7 @@ test text-10.36 {TextWidgetCmd procedure, "count" option} -setup {
.t count -lines 2.7 "1.0 lineend"
} -cleanup {
destroy .t
-} -result {-1}
+} -result -1
test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
text .t
} -body {
@@ -2659,7 +2659,7 @@ test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
.t count -displaylines 1.0 end
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
pack .t -expand 1 -fill both
@@ -2691,7 +2691,7 @@ test text-10.39 {TextWidgetCmd procedure, "count" option} -setup {
} -cleanup {
destroy .t
} -result {2 6 1 5}
-test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
+test text-10.40 {TextWidgetCmd procedure, "count" option} -setup {
text .t
pack .t
update
@@ -2706,8 +2706,8 @@ test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
set res [.t count -displaylines 2.0 3.0]
} -cleanup {
destroy .t
-} -result {0}
-test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
+} -result 0
+test text-10.41 {TextWidgetCmd procedure, "count" option} -setup {
toplevel .mytop
pack [text .mytop.t -font TkFixedFont -bd 0 -padx 0 -wrap char]
set spec [font measure TkFixedFont "Line 1+++Line 1---Li"] ; # 20 chars
@@ -2729,7 +2729,7 @@ test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
} -cleanup {
destroy .mytop
} -result {1 3}
-test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup {
+test text-10.42 {TextWidgetCmd procedure, "count" option} -setup {
text .t
pack .t
update
@@ -2783,7 +2783,7 @@ test text-11.2 {counting with tag priority eliding} -setup {
.t count -displaychars 1.0 1.5
} -cleanup {
destroy .t
-} -result {5}
+} -result 5
test text-11.3 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
@@ -2796,7 +2796,7 @@ test text-11.3 {counting with tag priority eliding} -setup {
.t count -displaychars 1.0 1.5
} -cleanup {
destroy .t
-} -result {3}
+} -result 3
test text-11.4 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
set res {}
@@ -3122,7 +3122,7 @@ test text-11a.41 {"sync" "pendingsync" and <<WidgetViewSync>>} -setup {
destroy .top.yt .top
} -result {Sync:0 Pending:1 Sync:1 Pending:0}
-test text-11a.51 {<<WidgetViewSync>> calls TkSendVirtualEvent(),
+test text-11a.51 {<<WidgetViewSync>> calls Tk_SendVirtualEvent(),
NOT Tk_HandleEvent().
Bug [b362182e45704dd7bbd6aed91e48122035ea3d16]} -setup {
destroy .top.t .top
@@ -3426,7 +3426,7 @@ test text-14.14 {ConfigureText procedure} -body {
selection get
} -cleanup {
destroy .t .t2
-} -result {1234}
+} -result 1234
test text-14.15 {ConfigureText procedure} -body {
text .t
entry .t.e
@@ -3440,7 +3440,7 @@ test text-14.15 {ConfigureText procedure} -body {
selection get
} -cleanup {
destroy .t2 .t
-} -result {1234}
+} -result 1234
test text-14.16 {ConfigureText procedure} -body {
text .t
entry .t.e
@@ -3469,7 +3469,7 @@ test text-14.17 {ConfigureText procedure} -body {
return $result
} -cleanup {
destroy .t .t2
-} -result {1234}
+} -result 1234
test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
toplevel .top
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
@@ -3488,7 +3488,7 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
# to the appropriate size.
# On macOS, however, there is no way to make the window overlap the menubar.
if {[tk windowingsystem] == "aqua"} {
- set minY 23
+ set minY [expr [menubarheight] + 1]
} else {
set minY 0
}
@@ -3972,7 +3972,7 @@ test text-20.5 {TextFetchSelection procedure, long selections} -setup {
expr {[selection get] eq "$x\n"}
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-21.1 {TkTextLostSelection procedure} -constraints {x11} -setup {
@@ -4581,25 +4581,25 @@ test text-22.68 {TextSearchCmd, freeing copy of pattern} -body {
} -result {}
test text-22.69 {TextSearchCmd, unicode} -body {
text .t
- .t insert end "foo\u30c9\u30cabar"
- .t search \u30c9\u30ca 1.0
+ .t insert end "fooドナbar"
+ .t search ドナ 1.0
} -cleanup {
destroy .t
} -result {1.3}
test text-22.70 {TextSearchCmd, unicode} -body {
text .t
- .t insert end "foo\u30c9\u30cabar"
- list [.t search -count n \u30c9\u30ca 1.0] $n
+ .t insert end "fooドナbar"
+ list [.t search -count n ドナ 1.0] $n
} -cleanup {
destroy .t
} -result {1.3 2}
test text-22.71 {TextSearchCmd, unicode with non-text segments} -body {
text .t
button .b1 -text baz
- .t insert end "foo\u30c9"
+ .t insert end "fooド"
.t window create end -window .b1
- .t insert end "\u30cabar"
- list [.t search -count n \u30c9\u30ca 1.0] $n
+ .t insert end "ナbar"
+ list [.t search -count n ドナ 1.0] $n
} -cleanup {
destroy .t .b1
} -result {1.3 3}
@@ -5078,11 +5078,11 @@ test text-22.132 {TextSearchCmd, multiline regexp matching} -body {
void
Tcl_SetObjLength(objPtr, length)
- register Tcl_Obj *objPtr; /* Pointer to object. This object must
- * not currently be shared. */
- register int length; /* Number of bytes desired for string
+ Tcl_Obj *objPtr; /* Pointer to object. This object must
+ * not currently be shared. */
+ int length; /* Number of bytes desired for string
* representation of object, not including
- * terminating null byte. */
+ * terminating null byte. */
\{
char *new;
}
@@ -5824,7 +5824,7 @@ test text-22.217.1 {elide up to match, with UTF-8 chars before the match} -setup
} -body {
.t tag configure e -elide 0
.t insert end A {} xyz e bb\n
- .t insert end \u00c4 {} xyz e bb
+ .t insert end Ä {} xyz e bb
set res {}
lappend res [.t search bb 1.0 "1.0 lineend"]
lappend res [.t search bb 2.0 "2.0 lineend"]
@@ -6431,19 +6431,19 @@ test text-24.24 {TextDumpCmd procedure, command script} -setup {
} -result {mark 1.0 current mark 1.0 insert mark 2.4 m}
test text-24.25 {TextDumpCmd procedure, unicode characters} -body {
text .t
- .t insert 1.0 \xb1\xb1\xb1
+ .t insert 1.0 ±±±
.t dump -all 1.0 2.0
} -cleanup {
destroy .t
-} -result "text \xb1\xb1\xb1 1.0 mark insert 1.3 mark current 1.3 text {\n} 1.3"
+} -result "text ±±± 1.0 mark insert 1.3 mark current 1.3 text {\n} 1.3"
test text-24.26 {TextDumpCmd procedure, unicode characters} -body {
text .t
.t delete 1.0 end
- .t insert 1.0 abc\xb1\xb1\xb1
+ .t insert 1.0 abc±±±
.t dump -all 1.0 2.0
} -cleanup {
destroy .t
-} -result "text abc\xb1\xb1\xb1 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6"
+} -result "text abc±±± 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6"
test text-24.27 {TextDumpCmd procedure, peer present} -body {
text .t
.t peer create .t.t
@@ -6459,7 +6459,7 @@ test text-25.1 {text widget vs hidden commands} -body {
destroy .t
set x [list [winfo children .] [interp hidden]]
expr {$x eq $y}
-} -result {1}
+} -result 1
test text-26.1 {bug fix - 1642} -body {
@@ -6552,7 +6552,7 @@ test text-27.8 {TextEditCmd procedure, modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-27.9 {TextEditCmd procedure, reset modified flag} -body {
text .t
pack .t
@@ -6561,7 +6561,7 @@ test text-27.9 {TextEditCmd procedure, reset modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test text-27.10 {TextEditCmd procedure, set modified flag} -body {
text .t
pack .t
@@ -6569,7 +6569,7 @@ test text-27.10 {TextEditCmd procedure, set modified flag} -body {
.t edit modified
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup {
text .t
pack .t
@@ -6640,7 +6640,7 @@ test text-27.14a {<<Modified>> virtual event - propagation to peers} -body {
set ::retval
} -cleanup {
destroy .t .tt
-} -result {4}
+} -result 4
test text-27.15 {<<Selection>> virtual event on sel tagging} -body {
set ::retval no_selection
pack [text .t]
@@ -6759,7 +6759,7 @@ test text-27.15g {No <<Selection>> virtual event on <<Cut>> without widget selec
destroy .t
} -result {no_<<Selection>>_event_fired}
test text-27.16 {-maxundo configuration option} -body {
- text .t -undo 1 -autoseparators 1 -maxundo 2
+ text .t -undo 1 -autoseparators 1 -maxundo 2
pack .t
.t insert end "line 1\n"
.t delete 1.4 1.6
@@ -7034,12 +7034,12 @@ test text-27.28 {edit undo and edit redo do not leave \
.t edit separator
.t insert end "Again hello.\n"
.t edit undo
- lappend res [lsearch [.t mark names] tk::undoMark*]
+ lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}]
.t edit redo
- lappend res [lsearch [.t mark names] tk::undoMark*]
+ lappend res [expr {[lsearch [.t mark names] tk::undoMark*]<0}]
} -cleanup {
destroy .t
-} -result [list -1 -1]
+} -result {1 1}
test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
@@ -7052,13 +7052,13 @@ test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
test text-29.1 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {0}
+ .t configure -tabs 0
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "0" is not at a positive distance}
test text-29.2 {tabs - must be positive and must be increasing} -body {
pack [text .t -wrap none]
- .t configure -tabs {-5}
+ .t configure -tabs -5
} -cleanup {
destroy .t
} -returnCodes {error} -result {tab stop "-5" is not at a positive distance}
@@ -7081,7 +7081,7 @@ test text-29.4 {tabs - must be positive and must be increasing} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.1 {repeated insert and scroll} -body {
@@ -7094,7 +7094,7 @@ test text-30.1 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.2 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7105,7 +7105,7 @@ test text-30.2 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.3 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7116,7 +7116,7 @@ test text-30.3 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-30.4 {repeated insert and scroll} -body {
pack [text .t]
for {set i 0} {$i < 30} {incr i} {
@@ -7127,7 +7127,7 @@ test text-30.4 {repeated insert and scroll} -body {
set result 1
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test text-31.1 {peer widgets} -body {
@@ -7172,7 +7172,7 @@ test text-31.4 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update
destroy .t .top
} -result {}
@@ -7182,7 +7182,7 @@ test text-31.5 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
pack [.top.t peer create .top.t2]
set res [list [.top.t index end] [.top.t2 index end]]
update
@@ -7196,8 +7196,8 @@ test text-31.6 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
- pack [.top.t peer create .top.t2 -start {} -end {}]
+ pack [.t peer create .top.t -startline 5 -endline 11]
+ pack [.top.t peer create .top.t2 -startline {} -endline {}]
set res [list [.top.t index end] [.top.t2 index end]]
update
return $res
@@ -7210,21 +7210,21 @@ test text-31.7 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
set p1 [.top.t count -update -ypixels 1.0 end]
set p2 [.t count -update -ypixels 5.0 11.0]
expr {$p1 eq $p2}
} -cleanup {
destroy .t .top
-} -result {1}
+} -result 1
test text-31.8 {peer widgets} -body {
toplevel .top
pack [text .t]
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 6.0
.top.t index end
@@ -7237,7 +7237,7 @@ test text-31.9 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 8.0 12.0
.top.t index end
@@ -7250,7 +7250,7 @@ test text-31.10 {peer widgets} -body {
for {set i 1} {$i < 20} {incr i} {
.t insert end "Line $i\n"
}
- pack [.t peer create .top.t -start 5 -end 11]
+ pack [.t peer create .top.t -startline 5 -endline 11]
update ; update
.t delete 3.0 13.0
.top.t index end
@@ -7266,7 +7266,7 @@ test text-31.11 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 10 -end 20
+ .t configure -startline 10 -endline 20
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7281,7 +7281,7 @@ test text-31.12 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -start 11
+ .t configure -startline 11
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7296,7 +7296,7 @@ test text-31.13 {peer widgets} -setup {
}
.t tag add sel 1.0 end-1c
lappend res [.t tag ranges sel]
- .t configure -end 90
+ .t configure -endline 90
lappend res [.t tag ranges sel]
destroy .t
return $res
@@ -7312,7 +7312,7 @@ test text-31.14 {peer widgets} -setup {
}
.t tag add sel 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
lappend res [.t tag prevrange sel 1.0]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7332,7 +7332,7 @@ test text-31.15 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 3.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7352,7 +7352,7 @@ test text-31.16 {peer widgets} -setup {
.t insert end "Line $i\n"
}
.t tag add sel 1.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
lappend res "next" [.t tag nextrange sel 4.0] \
[.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \
@@ -7373,11 +7373,11 @@ test text-31.17 {peer widgets} -setup {
}
.t tag add sel 1.0 11.0
lappend res [.t tag ranges sel]
- lappend res [catch {.t configure -start 15 -end 10}]
+ lappend res [catch {.t configure -startline 15 -endline 10}]
lappend res [.t tag ranges sel]
- .t configure -start 6 -end 12
+ .t configure -startline 6 -endline 12
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7444,103 +7444,9 @@ test text-32.1 {line heights on creation} -setup {
expr {$before eq $after}
} -cleanup {
destroy .t
-} -result {1}
-
-test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
- destroy .t .pt
- set res {}
-} -body {
- text .t
- .t peer create .pt
- for {set i 1} {$i < 100} {incr i} {
- .t insert end "Line $i\n"
- }
- .t configure -startline 5
- # none of the following delete shall crash
- # (all did before fixing bug 1630262)
- # 1. delete on the same line: line1 == line2 in DeleteIndexRange,
- # and resetView is true neither for .t not for .pt
- .pt delete 2.0 2.2
- # 2. delete just one line: line1 < line2 in DeleteIndexRange,
- # and resetView is true only for .t, not for .pt
- .pt delete 2.0 3.0
- # 3. delete several lines: line1 < line2 in DeleteIndexRange,
- # and resetView is true only for .t, not for .pt
- .pt delete 2.0 5.0
- # 4. delete to the end line: line1 < line2 in DeleteIndexRange,
- # and resetView is true only for .t, not for .pt
- .pt delete 2.0 end
- # this test succeeds provided there is no crash
- set res 1
-} -cleanup {
- destroy .pt
-} -result {1}
-
-test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
- destroy .t .pt
- set res {}
-} -body {
- text .t
- .t peer create .pt
- for {set i 1} {$i < 100} {incr i} {
- .t insert end "Line $i\n"
- }
- .t configure -startline 5
- .pt configure -startline 3
- # the following delete shall not crash
- # (it did before fixing bug 1630262)
- .pt delete 2.0 3.0
- # moreover -startline shall be correct
- # (was wrong before fixing bug 1630262)
- lappend res [.t cget -start] [.pt cget -start]
-} -cleanup {
- destroy .pt
-} -result {4 3}
-
-test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
- destroy .t .pt
- set res {}
-} -body {
- text .t
- .t peer create .pt
- for {set i 1} {$i < 100} {incr i} {
- .t insert end "Line $i\n"
- }
- .t configure -startline 5 -endline 15
- .pt configure -startline 8 -endline 12
- # .pt now shows a range entirely inside the range of .pt
- # from .t, delete lines located after [.pt cget -end]
- .t delete 9.0 10.0
- # from .t, delete lines straddling [.pt cget -end]
- .t delete 6.0 9.0
- lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end]
- .t configure -startline 5 -endline 12
- .pt configure -startline 8 -endline 12
- # .pt now shows again a range entirely inside the range of .pt
- # from .t, delete lines located before [.pt cget -start]
- .t delete 2.0 3.0
- # from .t, delete lines straddling [.pt cget -start]
- .t delete 2.0 5.0
- lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end]
- .t configure -startline 22 -endline 31
- .pt configure -startline 42 -endline 51
- # .t now shows a range entirely before the range of .pt
- # from .t, delete some lines, then do it from .pt
- .t delete 2.0 3.0
- .t delete 2.0 5.0
- .pt delete 2.0 5.0
- lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end]
- .t configure -startline 55 -endline 75
- .pt configure -startline 60 -endline 70
- # .pt now shows a range entirely inside the range of .t
- # from .t, delete a range straddling the entire range of .pt
- .t delete 3.0 18.0
- lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end]
-} -cleanup {
- destroy .pt .t
-} -result {5 11 8 10 5 8 6 8 22 27 38 44 55 60 57 57}
+} -result 1
-test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.2 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7568,9 +7474,9 @@ test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup {
set res 1
} -cleanup {
destroy .pt
-} -result {1}
+} -result 1
-test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.3 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7591,7 +7497,7 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .pt
} -result {4 3}
-test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
+test text-32.4 {peer widget -start, -endline and deletion (bug 1630262)} -setup {
destroy .t .pt
set res {}
} -body {
@@ -7652,7 +7558,7 @@ test text-33.2 {TextWidgetCmd procedure, "peer" option} -setup {
test text-33.3 {TextWidgetCmd procedure, "peer" option} -setup {
text .t
} -body {
- .t pee names
+ .t peer names
} -cleanup {
destroy .t
} -returnCodes {ok} -result {}
@@ -7684,17 +7590,17 @@ test text-33.6 {TextWidgetCmd procedure, "peer" option} -setup {
} -result {.t2 .t {}}
test text-33.7 {peer widget -start, -end} -body {
text .t
- set res [.t configure -start 10 -end 5]
+ set res [.t configure -startline 10 -endline 5]
return $res
} -cleanup {
destroy .t
-} -returnCodes {2} -result {}
+} -returnCodes 2 -result {}
test text-33.8 {peer widget -start, -end} -body {
text .t
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 10 -end 5
+ .t configure -startline 10 -endline 5
} -cleanup {
destroy .t
} -returnCodes {error} -result {-startline must be less than or equal to -endline}
@@ -7703,7 +7609,7 @@ test text-33.9 {peer widget -start, -end} -body {
for {set i 1} {$i < 100} {incr i} {
.t insert end "Line $i\n"
}
- .t configure -start 5 -end 10
+ .t configure -startline 5 -endline 10
} -cleanup {
destroy .t
} -returnCodes {ok} -result {}
@@ -7713,11 +7619,11 @@ test text-33.10 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 10 -tab foo}]
+ lappend res [catch {.t configure -startline 5 -endline 10 -tab foo}]
lappend res [.t index end]
- lappend res [catch {.t configure -tab foo -start 15 -end 20}]
+ lappend res [catch {.t configure -tab foo -startline 15 -endline 20}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
@@ -7729,18 +7635,18 @@ test text-33.11 {peer widget -start, -end} -body {
.t insert end "Line $i\n"
}
set res [.t index end]
- lappend res [catch {.t configure -start 5 -end 15}]
+ lappend res [catch {.t configure -startline 5 -endline 15}]
lappend res [.t index end]
- lappend res [catch {.t configure -start 10 -end 40}]
+ lappend res [catch {.t configure -startline 10 -endline 40}]
lappend res [.t index end]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t index end]
return $res
} -cleanup {
destroy .t
} -result {101.0 0 11.0 0 31.0 101.0}
-test text-34.1 {peer widget -start, -end and selection} -setup {
+test text-34.1 {peer widget -start, -endline and selection} -setup {
text .t
set res {}
} -body {
@@ -7749,17 +7655,17 @@ test text-34.1 {peer widget -start, -end and selection} -setup {
}
.t tag add sel 10.0 20.0
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 30
+ .t configure -startline 5 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 5 -end 15
+ .t configure -startline 5 -endline 15
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 30
+ .t configure -startline 15 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start 15 -end 16
+ .t configure -startline 15 -endline 16
lappend res [.t tag ranges sel]
- .t configure -start 25 -end 30
+ .t configure -startline 25 -endline 30
lappend res [.t tag ranges sel]
- .t configure -start {} -end {}
+ .t configure -startline {} -endline {}
lappend res [.t tag ranges sel]
return $res
} -cleanup {
@@ -7768,7 +7674,6 @@ test text-34.1 {peer widget -start, -end and selection} -setup {
test text-35.1 {widget dump -command alters tags} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
.t tag add $value [list $index linestart] [list $index lineend]
}
text .t
@@ -7782,7 +7687,6 @@ test text-35.1 {widget dump -command alters tags} -setup {
} -result {ok}
test text-35.2 {widget dump -command makes massive changes} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
.t delete 1.0 end
}
text .t
@@ -7796,7 +7700,6 @@ test text-35.2 {widget dump -command makes massive changes} -setup {
} -result {ok}
test text-35.3 {widget dump -command destroys widget} -setup {
proc Dumpy {key value index} {
-#puts "KK: $key, $value"
destroy .t
}
text .t
diff --git a/tests/textBTree.test b/tests/textBTree.test
index fd97afa..fa69f48 100644
--- a/tests/textBTree.test
+++ b/tests/textBTree.test
@@ -3,9 +3,9 @@
# several file with additional tests for other features of text widgets.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/textDisp.test b/tests/textDisp.test
index f2d7047..c1cae00 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -1,26 +1,39 @@
# This file is a Tcl script to test the code in the file tkTextDisp.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# Platform specific procedure for updating the text widget.
if {[tk windowingsystem] == "aqua"} {
proc updateText {} {
update idletasks
}
+ proc delay {} {
+ update idletasks
+ after 100
+ update idletasks
+ }
} else {
proc updateText {} {
update
}
+ proc delay {} {
+ update
+ after 100
+ update
+ }
}
# The procedure below is used as the scrolling command for the text;
@@ -213,9 +226,9 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
.t delete 1.0 end
.t insert 1.0 "x\ty"
.t tag delete x y z
- .t tag configure x -tabs {50}
+ .t tag configure x -tabs 50
.t tag configure y -foreground black
- .t tag configure z -tabs {70}
+ .t tag configure z -tabs 70
.t tag add x 1.0 1.end
.t tag add y 1.0 1.end
.t tag add z 1.0 1.end
@@ -223,7 +236,7 @@ test textDisp-1.1 {GetStyle procedure, priorities and tab stops} {
set x [lindex [.t bbox 1.2] 0]
.t tag configure z -tabs {}
lappend x [lindex [.t bbox 1.2] 0]
- .t tag configure z -tabs {30}
+ .t tag configure z -tabs 30
.t tag raise x
update idletasks
lappend x [lindex [.t bbox 1.2] 0]
@@ -275,7 +288,7 @@ test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} {
.t insert 1.0 "This isx some sample text for testing."
list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21]
} [list [list 96 5 $fixedWidth $fixedHeight] [list 138 5 $fixedWidth $fixedHeight] [list 145 5 0 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] $fixedWidth $fixedHeight]]
-test textDisp-2.6 {LayoutDLine, word wrap} {
+test textDisp-2.6 {LayoutDLine, word wrap} failsOnUbuntu {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isxxx some sample text for testing."
@@ -494,7 +507,7 @@ test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} {
.t tag add x 1.0 end
.t tag add y 1.1 end
lindex [.t bbox 1.3] 0
-} {75}
+} 75
test textDisp-2.25 {LayoutDLine, tabs, breaking chunks at tabs} {textfonts} {
.t delete 1.0 end
.t tag delete x
@@ -661,7 +674,7 @@ test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
updateText
set x
} {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}}
-test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} {
+test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} failsOnXQuarz {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
.t yview 16.0
@@ -708,7 +721,7 @@ test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t yview moveto 1
updateText
winfo ismapped .b
-} {0}
+} 0
.t configure -wrap word
.t delete 1.0 end
.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\n"
@@ -724,7 +737,7 @@ test textDisp-4.13 {UpdateDisplayInfo, special handling for top/bottom lines} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{11.0 12.0 13.0} {4.0 10.0 11.0 12.0 13.0}}
-test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} {
+test textDisp-4.14 {UpdateDisplayInfo, special handling for top/bottom lines} failsOnXQuarz {
.t tag remove x 1.0 end
.t yview 1.0
updateText
@@ -857,7 +870,7 @@ test textDisp-5.2 {DisplayDLine, line resizes during display} {
} [list 30 30]
.t configure -wrap char
-test textDisp-6.1 {scrolling in DisplayText, scroll up} {
+test textDisp-6.1 {scrolling in DisplayText, scroll up} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1145,7 +1158,7 @@ test textDisp-8.6 {TkTextChanged} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{1.0 1.20 1.40} {1.0 1.20 1.40}}
-test textDisp-8.7 {TkTextChanged} {
+test textDisp-8.7 {TkTextChanged} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1167,7 +1180,7 @@ test textDisp-8.8 {TkTextChanged} {
updateText
list $tk_textRelayout $tk_textRedraw
} {2.0 2.0}
-test textDisp-8.9 {TkTextChanged} {
+test textDisp-8.9 {TkTextChanged} failsOnXQuarz {
.t delete 1.0 end
.t insert 1.0 "Line 1 is so long that it wraps around, two times"
foreach i {2 3 4 5 6 7 8 9 10 11 12 13 14 15} {
@@ -1178,7 +1191,7 @@ test textDisp-8.9 {TkTextChanged} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 8.0} {2.0 8.0}}
-test textDisp-8.10 {TkTextChanged} {
+test textDisp-8.10 {TkTextChanged} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
@@ -1238,7 +1251,7 @@ test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} {
update idletasks
} {}
-test textDisp-9.1 {TkTextRedrawTag} {
+test textDisp-9.1 {TkTextRedrawTag} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1256,7 +1269,7 @@ test textDisp-9.2 {TkTextRedrawTag} {textfonts} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{1.0 2.0 2.17} {1.0 2.0 2.17}}
-test textDisp-9.3 {TkTextRedrawTag} {
+test textDisp-9.3 {TkTextRedrawTag} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1267,7 +1280,7 @@ test textDisp-9.3 {TkTextRedrawTag} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.4 {TkTextRedrawTag} {
+test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1278,7 +1291,7 @@ test textDisp-9.4 {TkTextRedrawTag} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.5 {TkTextRedrawTag} {
+test textDisp-9.5 {TkTextRedrawTag} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
@@ -1289,7 +1302,7 @@ test textDisp-9.5 {TkTextRedrawTag} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20 eof}}
-test textDisp-9.6 {TkTextRedrawTag} {
+test textDisp-9.6 {TkTextRedrawTag} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap"
@@ -1300,7 +1313,7 @@ test textDisp-9.6 {TkTextRedrawTag} {
updateText
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}}
-test textDisp-9.7 {TkTextRedrawTag} {
+test textDisp-9.7 {TkTextRedrawTag} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
@@ -1336,11 +1349,11 @@ test textDisp-9.10 {TkTextRedrawTag} {
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
.t tag add big 1.0 2.0
updateText
- set tk_textRedraw {none}
+ set tk_textRedraw none
.t tag add big 1.3 1.5
updateText
set tk_textRedraw
-} {none}
+} none
test textDisp-9.11 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
@@ -1440,7 +1453,7 @@ test textDisp-11.1 {TkTextSetYView} {
updateText
.t index @0,0
} {30.0}
-test textDisp-11.2 {TkTextSetYView} {
+test textDisp-11.2 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
.t yview 32.0
@@ -1454,7 +1467,7 @@ test textDisp-11.3 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {28.0 {28.0 29.0}}
-test textDisp-11.4 {TkTextSetYView} {
+test textDisp-11.4 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
.t yview 31.4
@@ -1485,7 +1498,7 @@ test textDisp-11.7 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {21.0 {21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0}}
-test textDisp-11.8 {TkTextSetYView} {
+test textDisp-11.8 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
set tk_textRedraw {}
@@ -1493,7 +1506,7 @@ test textDisp-11.8 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {32.0 {40.0 41.0}}
-test textDisp-11.9 {TkTextSetYView} {
+test textDisp-11.9 {TkTextSetYView} failsOnXQuarz {
.t yview 30.0
updateText
set tk_textRedraw {}
@@ -1517,7 +1530,7 @@ test textDisp-11.11 {TkTextSetYView} {
updateText
list [.t index @0,0] $tk_textRedraw
} {191.0 {191.0 192.0 193.0 194.0 195.0 196.0}}
-test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} {
+test textDisp-11.12 {TkTextSetYView, wrapped line is off-screen} failsOnXQuarz {
.t insert 10.0 "Long line with enough text to wrap\n"
.t yview 1.0
updateText
@@ -1818,7 +1831,7 @@ test textDisp-13.11 {TkTextSeeCmd procedure} {} {
set res [.top2.t2 compare $ref == $new]
destroy .top2
set res
-} {0}
+} 0
wm geom . {}
.t configure -wrap none
@@ -1858,7 +1871,7 @@ test textDisp-14.5 {TkTextXviewCmd procedure} {
test textDisp-14.6 {TkTextXviewCmd procedure} {
list [catch {.t xview moveto a} msg] $msg
} {1 {expected floating-point number but got "a"}}
-test textDisp-14.7 {TkTextXviewCmd procedure} {
+test textDisp-14.7 {TkTextXviewCmd procedure} failsOnUbuntu {
.t delete 1.0 end
.t insert end xxxxxxxxx\n
.t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n"
@@ -1890,7 +1903,7 @@ test textDisp-14.11 {TkTextXviewCmd procedure} {
} {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}}
test textDisp-14.12 {TkTextXviewCmd procedure} {
list [catch {.t xview scroll gorp units} msg] $msg
-} {1 {expected integer but got "gorp"}}
+} {1 {expected floating-point number but got "gorp"}}
test textDisp-14.13 {TkTextXviewCmd procedure} {
.t delete 1.0 end
.t insert end xxxxxxxxx\n
@@ -2007,7 +2020,7 @@ test textDisp-15.8 {Scrolling near end of window} {
set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {1}
+} 1
.t configure -wrap char
.t delete 1.0 end
@@ -2058,7 +2071,7 @@ test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} {
test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} {
list [catch {.t yview moveto gorp} msg] $msg
} {1 {expected floating-point number but got "gorp"}}
-test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} {
+test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu {
.t yview moveto 0.5
.t index @0,0
} {103.0}
@@ -2070,21 +2083,21 @@ test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} {
.t yview moveto 1.1
.t index @0,0
} {191.0}
-test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} {
+test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu {
.t yview moveto .75
.t index @0,0
} {151.60}
-test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} {
+test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu {
.t yview moveto .752
.t index @0,0
} {151.60}
-test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {textfonts} {
+test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} textfonts {
set count [expr {5 * $bigHeight + 150 * $fixedHeight}]
set extra [expr {0.04 * double($fixedDiff * 150) / double($count)}]
.t yview moveto [expr {.753 - $extra}]
.t index @0,0
} {151.60}
-test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} {
+test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu {
.t yview moveto .755
.t index @0,0
} {151.80}
@@ -2109,11 +2122,11 @@ test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} {
list [catch {.t yview scroll a b c} msg] $msg
} {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}}
test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} {
- list [catch {.t yview scroll badInt bogus} msg] $msg
+ list [catch {.t yview scroll bogus bogus} msg] $msg
} {1 {bad argument "bogus": must be pages, pixels, or units}}
test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} {
- list [catch {.t yview scroll badInt units} msg] $msg
-} {1 {expected integer but got "badInt"}}
+ list [catch {.t yview scroll bogus units} msg] $msg
+} {1 {expected floating-point number but got "bogus"}}
test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} {
.t yview 50.0
updateText
@@ -2167,7 +2180,7 @@ test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
incr res -1
}
set res
-} {102}
+} 102
test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t configure -height 1
updateText
@@ -2248,7 +2261,7 @@ test textDisp-16.38 {TkTextYviewCmd procedure} {
test textDisp-16.39 {TkTextYviewCmd procedure} {
list [catch {.t yview scroll 1.3i pixels} msg] $msg
} {0 {}}
-test textDisp-16.40 {text count -xpixels} {
+test textDisp-16.40 {text count -xpixels} failsOnUbuntu {
set res {}
lappend res [.t count -xpixels 1.0 1.5] \
[.t count -xpixels 1.5 1.0] \
@@ -2489,8 +2502,6 @@ test textDisp-18.8 {GetXView procedure} {
catch {rename bgerror {}}
catch {rename bogus {}}
.t configure -xscrollcommand {} -yscrollcommand scroll
-
-.t configure -xscrollcommand {} -yscrollcommand scroll
test textDisp-19.1 {GetYView procedure} {
.t configure -wrap char
.t delete 1.0 end
@@ -2562,7 +2573,7 @@ test textDisp-19.7 {GetYView procedure} {
updateText
set x $scrollInfo
} {0.125 0.75}
-test textDisp-19.8 {GetYView procedure} {
+test textDisp-19.8 {GetYView procedure} failsOnUbuntu {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1"
@@ -2635,66 +2646,66 @@ test textDisp-19.11 {GetYView procedure} {
} {0.5 1.0}
test textDisp-19.11.2 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.0 end
-} {20}
+} 20
test textDisp-19.11.3 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines end 1.0
-} {-20}
+} -20
test textDisp-19.11.4 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 1.1 1.3
-} {0}
+} 0
test textDisp-19.11.5 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.1
-} {0}
+} 0
test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
-} {0}
+} 0
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.24
-} {1}
+} 1
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
-} {2}
+} 2
test textDisp-19.11.8 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 displaylineend +1c" "16.0 lineend"
-} {3}
+} 3
test textDisp-19.11.9 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 lineend"
-} {4}
+} 4
test textDisp-19.11.10 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.11 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 "16.0 +2displaylines"
-} {2}
+} 2
test textDisp-19.11.12 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines "16.0 +1displayline" "16.0 +2displaylines -1c"
-} {0}
+} 0
.t tag configure elide -elide 1
test textDisp-19.11.13 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines +6c"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.14 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +1displaylines displaylineend"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.15 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines -1c"
-} {3}
+} 3
test textDisp-19.11.15a {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "16.0 +1displaylines" "16.0 +2displaylines"
.t count -displaylines 16.0 "16.0 +4displaylines"
-} {4}
+} 4
test textDisp-19.11.16 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
.t count -displaylines 12.0 16.0
-} {2}
+} 2
test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
@@ -2715,7 +2726,7 @@ test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
.t count -displaylines 12.0 17.0
-} {4}
+} 4
test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
@@ -2859,7 +2870,7 @@ test textDisp-19.16 {count -ypixels} {
[.t count -ypixels 16.0 "16.0 displaylineend +1c"] \
[.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"]
} [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]]
-test textDisp-19.17 {count -ypixels with indices in elided lines} {
+test textDisp-19.17 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
@@ -2886,7 +2897,7 @@ test textDisp-19.17 {count -ypixels with indices in elided lines} {
.t yview 35.0
lappend res [.t count -ypixels 5.0 25.0]
} [list [expr {4 * $fixedHeight}] [expr {3 * $fixedHeight}] 0 0 0 0 0 0 [expr {5 * $fixedHeight}] [expr {- 5 * $fixedHeight}] [expr {2 * $fixedHeight}] [expr {3 * $fixedHeight}] [expr {5 * $fixedHeight}]]
-test textDisp-19.18 {count -ypixels with indices in elided lines} {
+test textDisp-19.18 {count -ypixels with indices in elided lines} {failsOnUbuntu failsOnXQuarz} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
@@ -2924,28 +2935,28 @@ for {set i 2} {$i <= 200} {incr i} {
.t configure -wrap word
.t delete 50.0 51.0
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
-test textDisp-20.1 {FindDLine} {
+test textDisp-20.1 {FindDLine} failsOnUbuntu {
.t yview 48.0
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
[.t dlineinfo 58.0]
} [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.2 {FindDLine} {
+test textDisp-20.2 {FindDLine} failsOnUbuntu {
.t yview 100.0
.t yview -pickplace 53.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21]
} [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
-test textDisp-20.3 {FindDLine} {
+test textDisp-20.3 {FindDLine} failsOnUbuntu {
.t yview 100.0
.t yview 49.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0]
} [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.4 {FindDLine} {
+test textDisp-20.4 {FindDLine} failsOnUbuntu {
.t yview 100.0
.t yview 42.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40]
} [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
.t config -wrap none
-test textDisp-20.5 {FindDLine} {
+test textDisp-20.5 {FindDLine} failsOnUbuntu {
.t yview 100.0
.t yview 48.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
@@ -2995,7 +3006,7 @@ set res [.tt.u count -displaylines 3.10 2.173]
destroy .tt
unset message
set res
-} {-1}
+} -1
.t delete 1.0 end
.t insert end "Line 1"
@@ -3403,7 +3414,7 @@ test textDisp-24.24 {TkTextCharLayoutProc, justification and tabs} {textfonts} {
.t tag add x 1.0 end
list [.t bbox 1.0] [.t bbox 1.10]
} [list [list 45 3 7 $fixedHeight] [list 94 3 7 $fixedHeight]]
-test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts} -setup {
+test textDisp-24.25 {TkTextCharLayoutProc, justification and tabs} -constraints {textfonts failsOnXQuarz} -setup {
text .tt -tabs {40 right} -wrap none -font $fixedFont
pack .tt
} -body {
@@ -3482,7 +3493,7 @@ test textDisp-26.5 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.2
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1,456.234
@@ -3491,7 +3502,7 @@ test textDisp-26.6 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.7] 0
-} {120}
+} 120
test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.456.234,7
@@ -3500,7 +3511,7 @@ test textDisp-26.7 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.11] 0
-} {120}
+} 120
test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\ttest
@@ -3509,7 +3520,7 @@ test textDisp-26.8 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1234
@@ -3518,7 +3529,7 @@ test textDisp-26.9 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.2
lindex [.t bbox 1.6] 0
-} {120}
+} 120
test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\t1.234567
@@ -3527,7 +3538,7 @@ test textDisp-26.10 {AdjustForTab procedure, numeric alignment} {
.t tag add x 1.0 end
.t tag add y 1.5
lindex [.t bbox 1.3] 0
-} {120}
+} 120
test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t delete 1.0 end
.t insert 1.0 a\tx=1.234567
@@ -3537,7 +3548,7 @@ test textDisp-26.11 {AdjustForTab procedure, numeric alignment} {
.t tag add y 1.7
.t tag add y 1.9
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t delete 1.0 end
.t insert 1.0 a\tx1.234567
@@ -3550,7 +3561,7 @@ test textDisp-26.12 {AdjustForTab procedure, adjusting chunks} {
.t window create 1.3 -window .b
updateText
lindex [.t bbox 1.5] 0
-} {120}
+} 120
test textDisp-26.13 {AdjustForTab procedure, not enough space} {textfonts} {
.t delete 1.0 end
.t insert 1.0 "abc\txyz\tqrs\txyz\t0"
@@ -3707,7 +3718,7 @@ test textDisp-27.7.2 {SizeOfTab procedure, fractional tab interpolation problem}
.t configure -tabs $precisetab
updateText
expr {[lindex $res 0] - [lindex [.t bbox 1.20] 0]}
-} {0}
+} 0
.t configure -wrap char -tabs {} -width 20
updateText
@@ -3723,7 +3734,7 @@ test textDisp-27.9 {SizeOfTab procedure, left alignment} {textfonts} {
.t delete 1.0 end
.t insert 1.0 a\txyzzyabc
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.3] [.t bbox 1.4]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3739,7 +3750,7 @@ test textDisp-27.11 {SizeOfTab procedure, making tabs at least as wide as a spac
.t delete 1.0 end
.t insert 1.0 abc\tdefghijklmnopqrst
.t tag delete x
- .t tag configure x -tabs {120}
+ .t tag configure x -tabs 120
.t tag add x 1.0 end
list [.t bbox 1.5] [.t bbox 1.6]
} [list [list 131 5 13 $fixedHeight] [list 4 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
@@ -3912,20 +3923,20 @@ test textDisp-30.1 {elidden text joining multiple logical lines} {
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 3.2
.t2.t count -displaylines 1.0 end
-} {1}
+} 1
test textDisp-30.2 {elidden text joining multiple logical lines} {
.t2.t delete 1.0 end
.t2.t insert 1.0 "1111\n2222\n3333"
.t2.t tag configure elidden -elide 1 -background red
.t2.t tag add elidden 1.2 2.2
.t2.t count -displaylines 1.0 end
-} {2}
+} 2
catch {destroy .t2}
.t configure -height 1
updateText
-test textDisp-31.1 {line embedded window height update} {
+test textDisp-31.1 {line embedded window height update} failsOnUbuntu {
set res {}
.t delete 1.0 end
.t insert end "abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx"
@@ -3938,7 +3949,7 @@ test textDisp-31.1 {line embedded window height update} {
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]]
-test textDisp-31.2 {line update index shifting} {
+test textDisp-31.2 {line update index shifting} failsOnUbuntu {
set res {}
.t.f configure -height 100
updateText
@@ -3955,7 +3966,7 @@ test textDisp-31.2 {line update index shifting} {
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
-test textDisp-31.3 {line update index shifting} {
+test textDisp-31.3 {line update index shifting} failsOnUbuntu {
# Should do exactly the same as the above, as long
# as we are correctly tagging the correct lines for
# recalculation. The 'update' and 'delay' must be
@@ -3969,12 +3980,12 @@ test textDisp-31.3 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t.f configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -3992,7 +4003,7 @@ test textDisp-31.4 {line embedded image height update} {
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]]
-test textDisp-31.5 {line update index shifting} {
+test textDisp-31.5 {line update index shifting} failsOnUbuntu {
set res {}
textest configure -height 100
updateText
@@ -4009,7 +4020,7 @@ test textDisp-31.5 {line update index shifting} {
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
-test textDisp-31.6 {line update index shifting} {
+test textDisp-31.6 {line update index shifting} failsOnUbuntu {
# Should do exactly the same as the above, as long
# as we are correctly tagging the correct lines for
# recalculation. The 'update' and 'delay' must be
@@ -4022,12 +4033,12 @@ test textDisp-31.6 {line update index shifting} {
.t insert 1.0 "abc\n"
.t insert 1.0 "abc\n"
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
textest configure -height 100
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]]
@@ -4044,11 +4055,11 @@ test textDisp-31.7 {line update index shifting, elided} {
.t tag configure elide -elide 1
.t tag add elide 1.3 2.1
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
.t delete 1.0 3.0
lappend res [.t count -ypixels 1.0 end]
- update ; after 1000 ; update
+ delay
lappend res [.t count -ypixels 1.0 end]
set res
} [list [expr {$fixedHeight * 1}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 3}] [expr {$fixedHeight * 2}] [expr {$fixedHeight * 1}] [expr {$fixedHeight * 1}]]
@@ -4183,6 +4194,7 @@ test textDisp-32.3 "NULL undisplayProc problems: #1791052" -setup {
test textDisp-33.0 {one line longer than fits in the widget} {
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt see 1.0
@@ -4191,6 +4203,7 @@ test textDisp-33.0 {one line longer than fits in the widget} {
test textDisp-33.1 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
+ updateText
.tt insert 1.0 [string repeat "more wrap + " 300]
updateText
.tt yview "1.0 +1 displaylines"
@@ -4204,12 +4217,14 @@ test textDisp-33.2 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
.tt debug 1
+ updateText
set tk_textHeightCalc ""
+ set timer [after 200 lappend tk_textHeightCalc "Timed out"]
.tt insert 1.0 [string repeat "more wrap + " 1]
- after 100 ; update idletasks
- # Nothing should have been recalculated.
+ vwait tk_textHeightCalc
+ after cancel $timer
set tk_textHeightCalc
-} {}
+} {1.0}
test textDisp-33.3 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
@@ -4222,7 +4237,7 @@ test textDisp-33.3 {one line longer than fits in the widget} {
# Each line should have been recalculated just once
.tt debug 0
expr {[llength $tk_textHeightCalc] == [.tt count -displaylines 1.0 end]}
-} {1}
+} 1
test textDisp-33.4 {one line longer than fits in the widget} {
destroy .tt
pack [text .tt -wrap char]
@@ -4293,7 +4308,7 @@ test textDisp-34.1 {Line heights recalculation problem: bug 2677890} -setup {
set negative
} -cleanup {
destroy .t1
-} -result {0}
+} -result 0
test textDisp-35.1 {Init value of charHeight - Dancing scrollbar bug 1499165} -setup {
pack [text .t1] -fill both -expand y -side left
diff --git a/tests/textImage.test b/tests/textImage.test
index 2666ec5..b4f80d7 100644
--- a/tests/textImage.test
+++ b/tests/textImage.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 310db6a..195c1e1 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -1,12 +1,12 @@
# This file is a Tcl script to test the code in the file tkTextIndex.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
@@ -30,7 +30,7 @@ wm deiconify .
abcdefghijklm
12345
Line 4
-b\u4e4fy GIrl .#@? x_yz
+b乏y GIrl .#@? x_yz
!@#$%
Line 7"
@@ -118,7 +118,7 @@ test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} {
test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
{testtext} {
# ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
- # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+ # Wrong answer would be ¹ (the 2nd byte of UTF rep of 0x4e4f).
set x [testtext .t byteindex 5 2]
list $x [.t get insert]
@@ -128,7 +128,7 @@ test textIndex-1.18 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \
# ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType))
testtext .t byteindex 5 1
.t get insert
-} "\u4e4f"
+} "乏"
test textIndex-2.1 {TkTextMakeCharIndex} {
# (lineIndex < 0)
@@ -183,7 +183,7 @@ test textIndex-2.11 {TkTextMakeCharIndex: verify index is in range} {
} 3.4
test textIndex-2.12 {TkTextMakeCharIndex: verify index is in range} {
# (segPtr->typePtr == &tkTextCharType)
- # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f).
+ # Wrong answer would be ¹ (the 2nd byte of UTF rep of 0x4e4f).
.t mark set insert 5.2
.t get insert
@@ -608,7 +608,7 @@ test textIndex-14.15 {TkTextIndexBackChars: UTF} {
} y
test textIndex-14.16 {TkTextIndexBackChars: UTF} {
.t get {5.3 - 2 chars}
-} \u4e4f
+} 乏
test textIndex-14.17 {TkTextIndexBackChars: UTF} {
.t get {5.3 - 3 chars}
} b
@@ -809,10 +809,10 @@ test textIndex-19.12.1 {Display lines} {
test textIndex-19.12.2 {Display lines} {
.t compare [.t index "2.50 + 100 displaylines"] == "end - 1 c"
-} {1}
+} 1
test textIndex-19.13 {Display lines} {
- destroy {*}[pack slaves .]
+ destroy {*}[pack content .]
text .txt -height 1 -wrap word -yscroll ".sbar set" -width 400
scrollbar .sbar -command ".txt yview"
grid .txt .sbar -sticky news
@@ -871,19 +871,19 @@ test textIndex-21.9 {text index wordend} {
text_test_word worde "x.y" end-1
} 2
test textIndex-21.10 {text index wordend, unicode} {
- text_test_word wordend "xyz\u00c7de fg" 0
+ text_test_word wordend "xyzÇde fg" 0
} 6
test textIndex-21.11 {text index wordend, unicode} {
- text_test_word wordend "xyz\uc700de fg" 0
+ text_test_word wordend "xyz윀de fg" 0
} 6
test textIndex-21.12 {text index wordend, unicode} {
- text_test_word wordend "xyz\u203fde fg" 0
+ text_test_word wordend "xyz‿de fg" 0
} 6
test textIndex-21.13 {text index wordend, unicode} {
- text_test_word wordend "xyz\u2045de fg" 0
+ text_test_word wordend "xyz⁅de fg" 0
} 3
test textIndex-21.14 {text index wordend, unicode} {
- text_test_word wordend "\uc700\uc700 abc" 8
+ text_test_word wordend "윀윀 abc" 8
} 6
test textIndex-22.5 {text index wordstart} {
@@ -905,19 +905,19 @@ test textIndex-22.10 {text index wordstart} {
text_test_word wordstart "one two three" end-5
} 7
test textIndex-22.11 {text index wordstart, unicode} {
- text_test_word wordstart "one tw\u00c7o three" 7
+ text_test_word wordstart "one twÇo three" 7
} 4
test textIndex-22.12 {text index wordstart, unicode} {
- text_test_word wordstart "ab\uc700\uc700 cdef ghi" 12
+ text_test_word wordstart "ab윀윀 cdef ghi" 12
} 10
test textIndex-22.13 {text index wordstart, unicode} {
- text_test_word wordstart "\uc700\uc700 abc" 8
+ text_test_word wordstart "윀윀 abc" 8
} 3
test textIndex-22.14 {text index wordstart, unicode, start index at internal segment start} {
catch {destroy .t}
text .t
- .t insert end "C'est du texte en fran\u00e7ais\n"
- .t insert end "\u042D\u0442\u043E\u0020\u0442\u0435\u043A\u0441\u0442\u0020\u043D\u0430\u0020\u0440\u0443\u0441\u0441\u043A\u043E\u043C"
+ .t insert end "C'est du texte en français\n"
+ .t insert end "Это текст на русском"
.t mark set insert 1.23
set res [.t index "1.23 wordstart"]
.t mark set insert 2.16
diff --git a/tests/textMark.test b/tests/textMark.test
index 043ff82..3046f67 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextMark.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -52,7 +52,7 @@ test textMark-1.4 {TkTextMarkCmd - "gravity" option} -body {
} -result {right 1.4}
test textMark-1.5 {TkTextMarkCmd - "gravity" option} -body {
.t mark set x 1.3
- .t mark g x left
+ .t mark gr x left
.t insert 1.3 x
list [.t mark gravity x] [.t index x]
} -result {left 1.3}
@@ -177,7 +177,7 @@ test textMark-6.4 {TkTextMarkNameToIndex, with mark outside -startline/-endline
} -result {1 {bad text index "mymark"} 1.0 1.0 1 {bad text index "mymark"} L 1 {bad text index "mymark"}}
test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -body {
.t mark set insert 1.0
- .t configure -start 5 -end 5
+ .t configure -startline 5 -endline 5
set res [.t index insert]
} -cleanup {
.t configure -startline {} -endline {}
diff --git a/tests/textTag.test b/tests/textTag.test
index 04a4b30..1edfcb2 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextTag.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -26,6 +26,9 @@ testConstraint haveFontSizes [expr {
[font actual $bigFont -size] == 24 }
]
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+
destroy .t
text .t -width 20 -height 10
@@ -78,7 +81,7 @@ test textTag-1.5 {tag configuration options} -body {
.t tag cget x -borderwidth
} -cleanup {
.t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3]
-} -result {2}
+} -result 2
test textTag-1.6 {configuration options} -body {
.t tag configure x -borderwidth 46q
} -cleanup {
@@ -128,7 +131,7 @@ test textTag-1.14 {tag configuration options} -body {
.t tag cget x -lmargin1
} -cleanup {
.t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3]
-} -result {10}
+} -result 10
test textTag-1.15 {configuration options} -body {
.t tag configure x -lmargin1 bad
} -cleanup {
@@ -139,7 +142,7 @@ test textTag-1.16 {tag configuration options} -body {
.t tag cget x -lmargin2
} -cleanup {
.t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3]
-} -result {10}
+} -result 10
test textTag-1.17 {configuration options} -body {
.t tag configure x -lmargin2 bad
} -cleanup {
@@ -161,7 +164,7 @@ test textTag-1.18 {tag configuration options} -body {
.t tag cget x -offset
} -cleanup {
.t tag configure x -offset [lindex [.t tag configure x -offset] 3]
-} -result {2}
+} -result 2
test textTag-1.19 {configuration options} -body {
.t tag configure x -offset 100xyz
} -cleanup {
@@ -205,7 +208,7 @@ test textTag-1.24 {tag configuration options} -body {
.t tag cget x -rmargin
} -cleanup {
.t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3]
-} -result {10}
+} -result 10
test textTag-1.25 {configuration options} -body {
.t tag configure x -rmargin bad
} -cleanup {
@@ -249,7 +252,7 @@ test textTag-1.26 {tag configuration options} -body {
.t tag cget x -spacing1
} -cleanup {
.t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3]
-} -result {10}
+} -result 10
test textTag-1.27 {configuration options} -body {
.t tag configure x -spacing1 bad
} -cleanup {
@@ -260,7 +263,7 @@ test textTag-1.28 {tag configuration options} -body {
.t tag cget x -spacing2
} -cleanup {
.t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3]
-} -result {10}
+} -result 10
test textTag-1.29 {configuration options} -body {
.t tag configure x -spacing2 bad
} -cleanup {
@@ -271,7 +274,7 @@ test textTag-1.30 {tag configuration options} -body {
.t tag cget x -spacing3
} -cleanup {
.t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3]
-} -result {10}
+} -result 10
test textTag-1.31 {configuration options} -body {
.t tag configure x -spacing3 bad
} -cleanup {
@@ -399,7 +402,7 @@ test textTag-2.14 {tag add before -startline - Bug 1615425} -body {
.tt tag add mytag 1.0 1.end
destroy .ptt .tt
set res 1
-} -result {1}
+} -result 1
test textTag-3.1 {TkTextTagCmd - "bind" option} -body {
@@ -488,7 +491,7 @@ test textTag-4.5 {TkTextTagCmd - "cget" option} -body {
test textTag-5.1 {TkTextTagCmd - "configure" option} -body {
.t tag configure
-} -returnCodes error -result {wrong # args: should be ".t tag configure tagName ?-option? ?value? ?-option value ...?"}
+} -returnCodes error -result {wrong # args: should be ".t tag configure tagName ?-option value ...?"}
test textTag-5.2 {TkTextTagCmd - "configure" option} -body {
.t tag configure x -foo
} -returnCodes error -result {unknown option "-foo"}
@@ -1342,7 +1345,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} -setup {
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
@@ -1438,7 +1441,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
} -result {3.2}
test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
@@ -1460,7 +1463,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
} -result {3.1}
test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
- haveFontSizes
+ haveFontSizes failsOnUbuntuNoXft
} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
diff --git a/tests/textWind.test b/tests/textWind.test
index 7e2d315..ee634af 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the code in the file tkTextWind.c.
# This file is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,9 +11,11 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+
deleteWindows
-set fixedFont {"Courier New" -12}
+set fixedFont {"Courier" -12}
set fixedHeight [font metrics $fixedFont -linespace]
set fixedWidth [font measure $fixedFont m]
set fixedAscent [font metrics $fixedFont -ascent]
@@ -171,7 +173,7 @@ test textWind-2.7 {TkTextWindowCmd procedure, "cget" option} -setup {
.t window cget .f -pady
} -cleanup {
destroy .f
-} -returnCodes ok -result {2}
+} -returnCodes ok -result 2
test textWind-2.8 {TkTextWindowCmd procedure} -body {
.t window co
} -returnCodes error -result {wrong # args: should be ".t window configure index ?-option value ...?"}
@@ -582,7 +584,7 @@ test textWind-6.1 {EmbWinRequestProc procedure} -setup {
[list [expr {$padx+2*$fixedWidth+25}] [expr {$pady+((30-$fixedHeight)/2)}] $fixedWidth $fixedHeight]]
-test textWind-7.1 {EmbWinLostSlaveProc procedure} -setup {
+test textWind-7.1 {EmbWinLostContentProc procedure} -setup {
.t delete 1.0 end
destroy .f
} -body {
@@ -599,7 +601,7 @@ test textWind-7.1 {EmbWinLostSlaveProc procedure} -setup {
10x20+[expr {$padx+100}]+[expr {$pady+50}] \
[list [expr {$padx+2*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]]
-test textWind-7.2 {EmbWinLostSlaveProc procedure} -setup {
+test textWind-7.2 {EmbWinLostContentProc procedure} -setup {
.t delete 1.0 end
destroy .t.f
} -body {
@@ -751,15 +753,17 @@ test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -setup
destroy .t.f
proc bgerror args {
global msg
- lappend msg $args
+ if {$msg == ""} {
+ lappend msg $args
+ }
}
} -body {
.t insert 1.0 "Some sample text"
+ set msg {}
.t window create 1.5 -create {
frame .t.f
frame .t.f.f -width 10 -height 20 -bg $color
}
- set msg {}
update idletasks
lappend msg [winfo exists .t.f.f]
} -cleanup {
@@ -771,7 +775,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
.t delete 1.0 end
proc bgerror args {
global msg
- if {[lsearch -exact $msg $args] == -1} {
+ if {[lsearch -exact $msg $args] < 0} {
lappend msg $args
}
}
@@ -790,7 +794,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
{{can't embed .t relative to .t}} \
[list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]]
-test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup {
+test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup {
.t delete 1.0 end
destroy .t2
proc bgerror args {
@@ -858,7 +862,7 @@ test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
} -body {
.t configure -wrap char
.t insert 1.0 "Some sample text"
- frame .f -width 125 -height 20 -bg $color -bd 2 -relief raised
+ frame .f -width [expr {($tWidth-12)*$fixedWidth-1}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
@@ -873,7 +877,7 @@ test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
} -body {
.t configure -wrap char
.t insert 1.0 "Some sample text"
- frame .f -width 126 -height 20 -bg $color -bd 2 -relief raised
+ frame .f -width [expr {($tWidth-12)*$fixedWidth}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
update
list [.t bbox .f] [.t bbox 1.13]
@@ -889,15 +893,15 @@ test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
} -body {
.t configure -wrap char
.t insert 1.0 "Some sample text"
- frame .f -width 127 -height 20 -bg $color -bd 2 -relief raised
+ frame .f -width [expr {($tWidth-12)*$fixedWidth+1}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
update
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
} -result [list \
- [list $padx [expr {$pady+$fixedHeight}] 127 20] \
- [list [expr {$padx+127}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]]
+ [list $padx [expr {$pady+$fixedHeight}] [expr {($tWidth-12)*$fixedWidth+1}] 20] \
+ [list [expr {$padx+($tWidth-12)*$fixedWidth+1}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]]
test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t delete 1.0 end
@@ -905,7 +909,7 @@ test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
} -body {
.t configure -wrap none
.t insert 1.0 "Some sample text"
- frame .f -width 130 -height 20 -bg $color -bd 2 -relief raised
+ frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
update
list [.t bbox .f] [.t bbox 1.13]
@@ -921,7 +925,7 @@ test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
} -body {
.t configure -wrap none
.t insert 1.0 "Some sample text"
- frame .f -width 130 -height 220 -bg $color -bd 2 -relief raised
+ frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 220 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
update
list [.t bbox .f] [.t bbox 1.13]
@@ -1405,7 +1409,7 @@ test textWind-17.1 {peer widgets and embedded windows} -setup {
update ; update
destroy .t .tt
winfo exists .f
-} -result {0}
+} -result 0
test textWind-17.2 {peer widgets and embedded windows} -setup {
destroy .t .f .tt
diff --git a/tests/tk.test b/tests/tk.test
index c5c475e..1f5ade9 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test the tk command.
# It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2002 ActiveState Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 2002 ActiveState Corporation.
package require tcltest 2.2
eval tcltest::configure $argv
@@ -30,7 +30,7 @@ test tk-2.2 {tk command: appname} -body {
test tk-2.3 {tk command: appname} -constraints unix -body {
tk appname bazfoogarply
expr {[lsearch -exact [winfo interps] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test tk-2.4 {tk command: appname} -body {
tk appname [tk appname]
} -result [tk appname]
@@ -66,21 +66,21 @@ test tk-3.7 {tk command: scaling: set new} -body {
test tk-3.8 {tk command: scaling: negative} -body {
tk scaling -1
expr {[tk scaling] > 0}
-} -result {1}
+} -result 1
test tk-3.9 {tk command: scaling: too big} -body {
tk scaling 1000000
expr {[tk scaling] < 10000}
-} -result {1}
+} -result 1
test tk-3.10 {tk command: scaling: widthmm} -body {
tk scaling 1.25
expr {int((25.4*[winfo screenwidth .])/(72*1.25) + 0.5) \
- [winfo screenmmwidth .]}
-} -result {0}
+} -result 0
test tk-3.11 {tk command: scaling: heightmm} -body {
tk scaling 1.25
expr {int((25.4*[winfo screenheight .])/(72*1.25) + 0.5) \
- [winfo screenmmheight .]}
-} -result {0}
+} -result 0
tk scaling $scaling
# Value stored to restore default settings after 4.* tests
@@ -139,7 +139,7 @@ test tk-5.5 {tk caret} -body {
} -result {-height 12 -x 10 -y 11}
test tk-5.6 {tk caret} -body {
tk caret . -x 20 -y 25 -h 30; tk caret . -hei
-} -result {30}
+} -result 30
# tk inactive
test tk-6.1 {tk inactive} -body {
@@ -159,7 +159,7 @@ test tk-6.5 {tk inactive} -body {
update
after 100
set i [tk inactive]
- expr {$i == -1 || ( $i > 90 && $i < 200 )}
+ expr {$i < 0 || ( $i > 90 && $i < 200 )}
} -result 1
test tk-7.1 {tk inactive in a safe interpreter} -body {
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
index f03cd56..8a75ba7 100644
--- a/tests/ttk/all.tcl
+++ b/tests/ttk/all.tcl
@@ -4,7 +4,7 @@
# tests. Execute it by invoking "source all.tcl" when running tktest
# in this directory.
#
-# Copyright (c) 2007 by the Tk developers.
+# Copyright © 2007 by the Tk developers.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,5 +16,6 @@ tcltest::configure -testdir [file normalize [file dirname [info script]]]
tcltest::configure -loadfile \
[file join [file dirname [tcltest::testsDirectory]] constraints.tcl]
tcltest::configure -singleproc 1
-tcltest::runAllTests
-
+set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+encoding system utf-8
+if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
index 5e929de..39a6e35 100644
--- a/tests/ttk/checkbutton.test
+++ b/tests/ttk/checkbutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test checkbutton-1.1 "Checkbutton check" -body {
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index c14db9b..48179f3 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -2,8 +2,9 @@
# ttk::combobox widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test combobox-1.0 "Combobox tests -- setup" -body {
@@ -12,7 +13,7 @@ test combobox-1.0 "Combobox tests -- setup" -body {
test combobox-1.1 "Bad -values list" -body {
.cb configure -values "bad \{list"
-} -result "unmatched open brace in list" -returnCodes 1
+} -result "unmatched open brace in list" -returnCodes error
test combobox-1.end "Combobox tests -- cleanup" -body {
destroy .cb
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 26edca9..501bad6 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -2,10 +2,13 @@
# Tile package: entry widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+
variable scrollInfo
proc scroll args {
global scrollInfo
@@ -74,7 +77,7 @@ test entry-2.1 "Create entry before scrollbar" -body {
-expand false -fill x
} -cleanup {destroy .te .tsb}
-test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body {
+test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints failsOnUbuntu -body {
pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
-expand true -fill both
.te insert end [string repeat "abc" 50]
@@ -84,7 +87,7 @@ test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body {
-expand false -fill x
update ; # no error
lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
-} -result {1} -cleanup {destroy .te .tsb}
+} -result 1 -cleanup {destroy .te .tsb}
test entry-2.2 "Initial scroll position" -body {
ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
@@ -106,7 +109,7 @@ test entry-3.0 "Series 3 setup" -body {
variable cw [font measure $fixed a]
variable ch [font metrics $fixed -linespace]
variable bd 2 ;# border + padding
- variable ux [font measure $fixed \u4e4e]
+ variable ux [font measure $fixed 乎]
pack [ttk::entry .e -font $fixed -width 20]
update
@@ -128,28 +131,28 @@ test entry-3.3 "xview" -body {
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview end
set result [.e index @0]
-} -result {7}
+} -result 7
test entry-3.4 "xview" -body {
.e delete 0 end;
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview moveto 1.0
set result [.e index @0]
-} -result {7}
+} -result 7
test entry-3.5 "xview" -body {
.e delete 0 end;
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview scroll 5 units
set result [.e index @0]
-} -result {5}
+} -result 5
test entry-3.6 "xview" -body {
.e delete 0 end;
.e insert end [string repeat abcdefghijklmnopqrstuvwxyz 5]
.e xview scroll 2 pages
set result [.e index @0]
-} -result {40}
+} -result 40
test entry-3.last "Series 3 cleanup" -body {
destroy .e
@@ -342,6 +345,18 @@ test entry-10.2 {configuration option: "-placeholderforeground"} -setup {
destroy .e
} -result {red}
+test entry-10.3 {styling option: "-placeholderforeground"} -setup {
+ pack [ttk::entry .e]
+} -body {
+ set current [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground blue
+ set res [ttk::style configure TEntry -placeholderforeground]
+ ttk::style configure TEntry -placeholderforeground $current
+ set res
+} -cleanup {
+ destroy .e
+} -result {blue}
+
test entry-11.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup {
pack [ttk::entry .e]
update
diff --git a/tests/ttk/image.test b/tests/ttk/image.test
index 5e48d5c..bb593fc 100644
--- a/tests/ttk/image.test
+++ b/tests/ttk/image.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test image-1.1 "Bad image element" -body {
@@ -11,7 +12,7 @@ test image-1.2 "Duplicate element" -setup {
ttk::style element create testElement image test.element
} -body {
ttk::style element create testElement image test.element
-} -returnCodes 1 -result "Duplicate element testElement"
+} -returnCodes error -result "Duplicate element testElement"
test image-2.0 "Deletion of displayed image (label)" -setup {
image create photo test.image -width 10 -height 10
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
index 649c35f..9ffffd8 100644
--- a/tests/ttk/labelframe.test
+++ b/tests/ttk/labelframe.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test labelframe-1.0 "Setup" -body {
@@ -10,60 +11,60 @@ test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body {
ttk::frame .lf.t
ttk::checkbutton .lf.t.cb
.lf configure -labelwidget .lf.t.cb
-} -returnCodes 1 -result "can't *" -match glob \
+} -returnCodes error -result "can't *" -match glob \
-cleanup { destroy .lf.t } ;
test labelframe-2.2 "Can't use toplevel as labelwidget" -body {
toplevel .lf.t
.lf configure -labelwidget .lf.t
-} -returnCodes 1 -result "can't *" -match glob \
+} -returnCodes error -result "can't *" -match glob \
-cleanup { destroy .lf.t } ;
test labelframe-2.3 "Can't use non-windows as -labelwidget" -body {
.lf configure -labelwidget BogusWindowName
-} -returnCodes 1 -result {bad window path name "BogusWindowName"}
+} -returnCodes error -result {bad window path name "BogusWindowName"}
test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body {
.lf configure -labelwidget .nosuchwindow
-} -returnCodes 1 -result {bad window path name ".nosuchwindow"}
+} -returnCodes error -result {bad window path name ".nosuchwindow"}
###
# See also series labelframe-4.x
#
-test labelframe-3.1 "Add child slave" -body {
+test labelframe-3.1 "Add child content" -body {
checkbutton .lf.cb -text "abcde"
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.2 "Remove child slave" -body {
+test labelframe-3.2 "Remove child content" -body {
.lf configure -labelwidget {}
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 0 {}]
-test labelframe-3.3 "Re-add child slave" -body {
+test labelframe-3.3 "Re-add child content" -body {
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.4 "Re-manage child slave" -body {
+test labelframe-3.4 "Re-manage child content" -body {
pack .lf.cb -side right
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb] [.lf cget -labelwidget]
} -result [list 1 pack {}]
-test labelframe-3.5 "Re-add child slave" -body {
+test labelframe-3.5 "Re-add child content" -body {
.lf configure -labelwidget .lf.cb
list [update; winfo viewable .lf.cb] [winfo manager .lf.cb]
} -result [list 1 labelframe]
-test labelframe-3.6 "Destroy child slave" -body {
+test labelframe-3.6 "Destroy child content" -body {
destroy .lf.cb
.lf cget -labelwidget
} -result {}
###
-# Re-run series labelframe-3.x with nonchild slaves.
+# Re-run series labelframe-3.x with nonchild content.
#
# @@@ ODDITY, 14 Nov 2005:
# @@@ labelframe-4.1 fails if .cb is a [checkbutton],
@@ -73,7 +74,7 @@ test labelframe-3.6 "Destroy child slave" -body {
# @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc
# @@@ (see manager.c r1.11). There's still probably a race condition in here.
#
-test labelframe-4.1 "Add nonchild slave" -body {
+test labelframe-4.1 "Add nonchild content" -body {
checkbutton .cb -text "abcde"
.lf configure -labelwidget .cb
update
@@ -81,32 +82,32 @@ test labelframe-4.1 "Add nonchild slave" -body {
} -result [list 1 1 labelframe]
-test labelframe-4.2 "Remove nonchild slave" -body {
+test labelframe-4.2 "Remove nonchild content" -body {
.lf configure -labelwidget {}
update;
list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb]
} -result [list 0 0 {}]
-test labelframe-4.3 "Re-add nonchild slave" -body {
+test labelframe-4.3 "Re-add nonchild content" -body {
.lf configure -labelwidget .cb
list [update; winfo viewable .cb] [winfo manager .cb]
} -result [list 1 labelframe]
-test labelframe-4.4 "Re-manage nonchild slave" -body {
+test labelframe-4.4 "Re-manage nonchild content" -body {
pack .cb -side right
list [update; winfo viewable .cb] \
[winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 pack {}]
-test labelframe-4.5 "Re-add nonchild slave" -body {
+test labelframe-4.5 "Re-add nonchild content" -body {
.lf configure -labelwidget .cb
list [update; winfo viewable .cb] \
[winfo manager .cb] \
[.lf cget -labelwidget]
} -result [list 1 labelframe .cb]
-test labelframe-4.6 "Destroy nonchild slave" -body {
+test labelframe-4.6 "Destroy nonchild content" -body {
destroy .cb
.lf cget -labelwidget
} -result {}
diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test
index 52f44b4..5dfce9b 100644
--- a/tests/ttk/layout.test
+++ b/tests/ttk/layout.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test layout-1.1 "Size computations for mixed-orientation layouts" -body {
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index ac63088..e58812a 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test notebook-1.0 "Setup" -body {
@@ -24,11 +25,11 @@ test notebook-1.3 "Cannot add toplevel" -body {
.nb add [toplevel .nb.t]
} -cleanup {
destroy .t.nb
-} -returnCodes 1 -match glob -result "can't add .nb.t*"
+} -returnCodes error -match glob -result "can't add .nb.t*"
test notebook-1.4 "Try to select bad tab" -body {
.nb select @6000,6000
-} -returnCodes 1 -match glob -result "* not found"
+} -returnCodes error -match glob -result "* not found"
#
# Now add stuff:
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index c1fc6ac..528d56b 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc propagate-geometry {} { update idletasks }
@@ -46,7 +47,7 @@ test panedwindow-1.7 "Make sure empty panedwindow still still doesn't crash" -bo
test panedwindow-1.8 "Re-forget pane" -body {
.pw forget .pw.f1
-} -returnCodes 1 -result ".pw.f1 is not managed by .pw"
+} -returnCodes error -result ".pw.f1 is not managed by .pw"
test panedwindow-1.end "Cleanup" -body {
destroy .pw
@@ -118,11 +119,11 @@ test panedwindow-3.0 "configure pane" -body {
test panedwindow-3.1 "configure pane -- errors" -body {
.pw pane 1 -weight -4
-} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+} -returnCodes error -match glob -result "-weight must be nonnegative"
test panedwindow-3.2 "add pane -- errors" -body {
.pw add [ttk::label .pw.l] -weight -1
-} -returnCodes 1 -match glob -result "-weight must be nonnegative"
+} -returnCodes error -match glob -result "-weight must be nonnegative"
test panedwindow-3.end "cleanup" -body { destroy .pw }
@@ -146,7 +147,7 @@ test panedwindow-4.1 "forget" -body {
test panedwindow-4.2 "forget forgotten" -body {
.pw forget .pw.l1
-} -returnCodes 1 -result ".pw.l1 is not managed by .pw"
+} -returnCodes error -result ".pw.l1 is not managed by .pw"
# checkorder $winlist --
# Ensure that Y coordinates windows in $winlist are strictly increasing.
@@ -262,7 +263,7 @@ test paned-propagation-1 "Initial request size" -body {
list [winfo reqwidth .pw] [winfo reqheight .pw]
} -result [list 100 105]
-test paned-propagation-2 "Slave change before map" -body {
+test paned-propagation-2 "Pane change before map" -body {
.pw.f1 configure -width 200 -height 100
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw]
@@ -274,13 +275,13 @@ test paned-propagation-3 "Map window" -body {
list [winfo width .pw] [winfo height .pw] [.pw sashpos 0]
} -result [list 200 155 100]
-test paned-propagation-4 "Slave change after map, off-axis" -body {
+test paned-propagation-4 "Pane change after map, off-axis" -body {
.pw.f1 configure -width 100 ;# should be granted
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
} -result [list 100 155 100]
-test paned-propagation-5 "Slave change after map, on-axis" -body {
+test paned-propagation-5 "Pane change after map, on-axis" -body {
.pw.f1 configure -height 50 ;# should be denied
propagate-geometry
list [winfo reqwidth .pw] [winfo reqheight .pw] [.pw sashpos 0]
diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test
index 7c888c6..8e2fdb9 100644
--- a/tests/ttk/progressbar.test
+++ b/tests/ttk/progressbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
@@ -76,7 +77,7 @@ test progressbar-2.5 "error in write trace" -body {
trace variable PB w { error "YIPES!" ;# }
.pb step
set PB ;# NOTREACHED
-} -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!"
+} -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!"
test progressbar-end "Cleanup" -body {
destroy .pb
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
index ba02954..09abcb8 100644
--- a/tests/ttk/radiobutton.test
+++ b/tests/ttk/radiobutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test radiobutton-1.1 "Radiobutton check" -body {
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 443687a..75d11e7 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}]
@@ -70,7 +71,7 @@ test scrollbar-1.3 "Change orientation" -body {
expr {$h < $w}
} -result 1
-test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -yscrollcommand {.s set}] -side left
@@ -84,22 +85,8 @@ test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -
} -cleanup {
destroy .t .s
} -result {5.0}
-test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -yscrollcommand {.s set}] -side left
- for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
- pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {5.0}
-test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -113,21 +100,7 @@ test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constr
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <Shift-MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
-test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup {
+test scrollbar-10.2.2 {<MouseWheel> event on horizontal scrollbar} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
@@ -141,20 +114,6 @@ test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints
} -cleanup {
destroy .t .s
} -result {1.4}
-test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup {
- destroy .t .s
-} -body {
- pack [text .t -xscrollcommand {.s set} -wrap none] -side top
- for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
- pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
- update
- focus -force .s
- event generate .s <MouseWheel> -delta -4
- after 200 {set eventprocessed 1} ; vwait eventprocessed
- .t index @0,0
-} -cleanup {
- destroy .t .s
-} -result {1.4}
#
# Scale tests:
@@ -165,7 +124,7 @@ test scale-1.0 "Self-destruction" -body {
ttk::scale .s -variable v
pack .s ; update
.s set 1 ; update
-} -returnCodes 1 -match glob -result "*"
+} -returnCodes error -match glob -result "*"
test scale-2.1 "-state option" -setup {
ttk::scale .s
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 38bae14..673f3bf 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test spinbox-1.0 "Spinbox tests -- setup" -body {
@@ -126,7 +127,7 @@ test spinbox-1.8.2 "option -validate" -setup {
.sb cget -validate
} -cleanup {
destroy .sb
-} -result {none}
+} -result none
test spinbox-1.8.3 "option -validate" -setup {
ttk::spinbox .sb -from 0 -to 100
@@ -148,7 +149,7 @@ test spinbox-1.8.4 "-validate option: " -setup {
set ::spinbox_test
} -cleanup {
destroy .sb
-} -result {50}
+} -result 50
test spinbox-2.0 "current command -- unset should be 0" -constraints nyi -setup {
@@ -204,22 +205,85 @@ test spinbox-3.0 "textarea should expand to fill widget" -setup {
set ::spinbox_test {}
ttk::spinbox .sb -from 0 -to 10 -textvariable SBV
} -body {
- grid .sb -sticky ew
grid columnconfigure . 0 -weight 1
+ update idletasks
+ set timer [after 500 {set ::spinbox_test timedout}]
bind . <Map> {
after idle {
wm geometry . "210x80"
- after 100 {set ::spinbox_test [.sb identify element 5 5]}
+ update idletasks
+ set ::spinbox_test [.sb identify element 25 5]
}
bind . <Map> {}
}
- after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
+ grid .sb -sticky ew
+ vwait ::spinbox_test
set ::spinbox_test
} -cleanup {
destroy .sb
unset -nocomplain ::spinbox_test SBV
} -result {textarea}
+test spinbox-4.0 "Increment with duplicates in -values, wrap" -setup {
+ ttk::spinbox .sb -values {one two three 4 5 two six} -wrap true
+ set max [expr {[llength [.sb cget -values]] + 2}]
+} -body {
+ set ::spinbox_test [.sb get]
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Increment>>
+ lappend ::spinbox_test [.sb get]
+ }
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Decrement>>
+ lappend ::spinbox_test [.sb get]
+ }
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+ unset -nocomplain ::spinbox_test max
+} -result {one two three 4 5 two six one two one six two 5 4 three two one six}
+
+test spinbox-4.1 "Increment with duplicates in -values, wrap, initial value set" -setup {
+ ttk::spinbox .sb -values {one two three 4 5 two six} -wrap true
+ set max [expr {[llength [.sb cget -values]] + 2}]
+} -body {
+ .sb set three
+ set ::spinbox_test [.sb get]
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Increment>>
+ lappend ::spinbox_test [.sb get]
+ }
+ .sb set two ; # the first "two" in the -values list becomes the current value
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Decrement>>
+ lappend ::spinbox_test [.sb get]
+ }
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+ unset -nocomplain ::spinbox_test max
+} -result {three 4 5 two six one two three 4 5 one six two 5 4 three two one six}
+
+test spinbox-4.2 "Increment with duplicates in -values, no wrap" -setup {
+ ttk::spinbox .sb -values {one two three 4 5 two six} -wrap false
+ set max [expr {[llength [.sb cget -values]] + 2}]
+} -body {
+ set ::spinbox_test [.sb get]
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Increment>>
+ lappend ::spinbox_test [.sb get]
+ }
+ for {set i 0} {$i < $max} {incr i} {
+ event generate .sb <<Decrement>>
+ lappend ::spinbox_test [.sb get]
+ }
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+ unset -nocomplain ::spinbox_test max
+} -result {one two three 4 5 two six six six two 5 4 three two one one one one}
+
+
# nostomp: NB intentional difference between ttk::spinbox and tk::spinbox;
# see also #1439266
#
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
index fd3a0c5..d7fa23a 100644
--- a/tests/ttk/treetags.test
+++ b/tests/ttk/treetags.test
@@ -1,6 +1,7 @@
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
### treeview tag invariants:
@@ -170,7 +171,7 @@ test treetags-2.3 "Virtual events delivered to focus item" -body {
test treetags-2.4 "Bad events" -body {
$tv tag bind bad <Enter> { puts "Entered!" }
-} -returnCodes 1 -result "unsupported event <Enter>*" -match glob
+} -returnCodes error -result "unsupported event <Enter>*" -match glob
test treetags-3.0 "tag configure - set" -body {
$tv tag configure tag1 -foreground blue -background red
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 43dd249..8e31fe9 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -3,8 +3,9 @@
# what it currently does)
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
# consistencyCheck --
@@ -45,33 +46,33 @@ test treeview-1.1 "columns" -body {
test treeview-1.2 "Bad columns" -body {
#.tv configure -columns {illegal "list"value}
ttk::treeview .badtv -columns {illegal "list"value}
-} -returnCodes 1 -result "list element in quotes followed by*" -match glob
+} -returnCodes error -result "list element in quotes followed by*" -match glob
test treeview-1.3 "bad displaycolumns" -body {
.tv configure -displaycolumns {a b d}
-} -returnCodes 1 -result "Invalid column index d"
+} -returnCodes error -result "Invalid column index d"
test treeview-1.4 "more bad displaycolumns" -body {
.tv configure -displaycolumns {1 2 3}
-} -returnCodes 1 -result "Column index 3 out of bounds"
+} -returnCodes error -result "Column index 3 out of bounds"
test treeview-1.5 "Don't forget to check negative numbers" -body {
.tv configure -displaycolumns {1 -2 3}
-} -returnCodes 1 -result "Column index -2 out of bounds"
+} -returnCodes error -result "Column index -2 out of bounds"
# Item creation.
#
test treeview-2.1 "insert -- not enough args" -body {
.tv insert
-} -returnCodes 1 -result "wrong # args: *" -match glob
+} -returnCodes error -result "wrong # args: *" -match glob
test treeview-2.3 "insert -- bad integer index" -body {
.tv insert {} badindex
-} -returnCodes 1 -result "expected integer *" -match glob
+} -returnCodes error -result "expected integer *" -match glob
test treeview-2.4 "insert -- bad parent node" -body {
.tv insert badparent end
-} -returnCodes 1 -result "Item badparent not found" -match glob
+} -returnCodes error -result "Item badparent not found" -match glob
test treeview-2.5 "insert -- finaly insert a node" -body {
.tv insert {} end -id newnode -text "New node"
@@ -83,7 +84,7 @@ test treeview-2.6 "insert -- make sure node was inserted" -body {
test treeview-2.7 "insert -- prevent duplicate node names" -body {
.tv insert {} end -id newnode
-} -returnCodes 1 -result "Item newnode already exists"
+} -returnCodes error -result "Item newnode already exists"
test treeview-2.8 "insert -- new node at end" -body {
.tv insert {} end -id lastnode
@@ -125,7 +126,7 @@ test treeview-2.13 "insert -- one more at beginning" -body {
test treeview-2.14 "insert -- bad options" -body {
.tv insert {} end -badoption foo
-} -returnCodes 1 -result {unknown option "-badoption"}
+} -returnCodes error -result {unknown option "-badoption"}
test treeview-2.15 "insert -- at position 0 w/no children" -body {
.tv insert newnode 0 -id newnode.n2 -text "Foo"
@@ -201,7 +202,7 @@ test treeview-3.11 "Can't detach root item" -body {
.tv detach [list {}]
update
consistencyCheck .tv
-} -returnCodes 1 -result "Cannot detach root item"
+} -returnCodes error -result "Cannot detach root item"
consistencyCheck .tv
test treeview-3.12 "Reattach" -body {
@@ -274,7 +275,7 @@ test treeview-4.3 "opened - closed node" -body {
test treeview-5.1 "item -- error checks" -body {
.tv item newnode -text "Bad values" -values "{bad}list"
-} -returnCodes 1 -result "list element in braces followed by*" -match glob
+} -returnCodes error -result "list element in braces followed by*" -match glob
test treeview-5.2 "item -- error leaves options unchanged " -body {
.tv item newnode -text
@@ -297,11 +298,11 @@ test treeview-5.5 "set cell" -body {
test treeview-5.6 "set illegal cell" -body {
.tv set newnode #0 YYY
-} -returnCodes 1 -result "Display column #0 cannot be set"
+} -returnCodes error -result "Display column #0 cannot be set"
test treeview-5.7 "set illegal cell" -body {
.tv set newnode 3 YY ;# 3 == current #columns
-} -returnCodes 1 -result "Column index 3 out of bounds"
+} -returnCodes error -result "Column index 3 out of bounds"
test treeview-5.8 "set display columns" -body {
.tv configure -displaycolumns [list 2 1 0]
@@ -317,7 +318,7 @@ test treeview-5.9 "display columns part 2" -body {
test treeview-5.10 "cannot set column -id" -body {
.tv column #1 -id X
-} -returnCodes 1 -result "Attempt to change read-only option"
+} -returnCodes error -result "Attempt to change read-only option"
test treeview-5.11 "get" -body {
.tv set newnode #1
@@ -405,7 +406,7 @@ test treeview-7.1 "move" -body {
test treeview-7.2 "illegal move" -body {
.tv move d d2 end
-} -returnCodes 1 -result "Cannot insert d as descendant of d2"
+} -returnCodes error -result "Cannot insert d as descendant of d2"
test treeview-7.3 "illegal move has no effect" -body {
consistencyCheck .tv
@@ -426,7 +427,7 @@ test treeview-7.5 "replace children - precondition" -body {
test treeview-7.6 "Replace children - illegal move" -body {
.tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3]
-} -returnCodes 1 -result "Cannot insert newnode.n1 as descendant of newnode.n1"
+} -returnCodes error -result "Cannot insert newnode.n1 as descendant of newnode.n1"
consistencyCheck .tv
@@ -457,7 +458,7 @@ test treeview-8.4 "Selection - clear" -body {
test treeview-8.5 "Selection - bad operation" -body {
.tv selection badop foo
-} -returnCodes 1 -match glob -result {bad selection operation "badop": must be *}
+} -returnCodes error -match glob -result {bad selection operation "badop": must be *}
test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body {
.tv selection set {}
@@ -466,7 +467,7 @@ test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body {
.tv selection add newnode.n1
update
set res
-} -result {1}
+} -result 1
test treeview-8.7 "<<TreeviewSelect>> on selected item deletion" -body {
.tv selection set {}
@@ -560,7 +561,7 @@ test treeview-9.3 {scrolling on see command, requested item is closed} -setup {
expr $after < $before
} -cleanup {
destroy .top
-} -result {1}
+} -result 1
### identify tests:
#
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index 53da18a..fdd3eae 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -1,6 +1,7 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc skip args {}
@@ -31,7 +32,7 @@ test ttk-6.1 "Self-destructing checkbutton" -body {
trace variable sd w [list selfdestruct .sd]
update
.sd invoke
-} -returnCodes 1
+} -returnCodes error
test ttk-6.2 "Checkbutton self-destructed" -body {
winfo exists .sd
} -result 0
@@ -145,7 +146,7 @@ test ttk-1.2 "Check style" -body {
test ttk-1.3 "Set bad style" -body {
.t configure -style "nosuchstyle"
-} -returnCodes 1 -result {Layout nosuchstyle not found}
+} -returnCodes error -result {Layout nosuchstyle not found}
test ttk-1.4 "Original style preserved" -body {
.t cget -style
@@ -234,11 +235,11 @@ foreach wc $widgetClasses {
# misc. error detection
test ttk-3.0 "Bad option" -body {
ttk::button .bad -badoption foo
-} -returnCodes 1 -result {unknown option "-badoption"} -match glob
+} -returnCodes error -result {unknown option "-badoption"} -match glob
test ttk-3.1 "Make sure widget command not created" -body {
.bad state disabled
-} -returnCodes 1 -result {invalid command name ".bad"} -match glob
+} -returnCodes error -result {invalid command name ".bad"} -match glob
test ttk-3.2 "Propagate errors from variable traces" -body {
set A 0
@@ -251,7 +252,7 @@ test ttk-3.2 "Propagate errors from variable traces" -body {
test ttk-3.3 "Constructor failure with cursor" -body {
ttk::button .b -cursor bottom_right_corner -style BadStyle
-} -returnCodes 1 -result "Layout BadStyle not found"
+} -returnCodes error -result "Layout BadStyle not found"
test ttk-3.4 "SF#2009213" -body {
ttk::style configure TScale -sliderrelief {}
@@ -387,12 +388,12 @@ test ttk-8.4 "ImageChanged" -body {
test ttk-9.1 "Traces on nonexistant namespaces" -body {
ttk::checkbutton .tcb -variable foo::bar
-} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
test ttk-9.2 "Traces on nonexistant namespaces II" -body {
ttk::checkbutton .tcb -variable X
.tcb configure -variable foo::bar
-} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob
+} -returnCodes error -result "*parent namespace doesn't exist*" -match glob
test ttk-9.3 "Restore saved options on configure error" -body {
.tcb cget -variable
@@ -457,7 +458,7 @@ test ttk-10.3 "Check class resource" -body {
test ttk-10.4 "Try to modify class resource" -body {
.f configure -class Bar
-} -returnCodes 1 -match glob -result "*read-only option*"
+} -returnCodes error -match glob -result "*read-only option*"
test ttk-10.5 "Check class resource again" -body {
.f cget -class
@@ -547,14 +548,14 @@ test ttk-12.4 "-borderwidth frame option" -body {
test ttk-13.1 "Custom styles -- bad -style option" -body {
ttk::button .tb1 -style badstyle
-} -returnCodes 1 -result "*badstyle not found*" -match glob
+} -returnCodes error -result "*badstyle not found*" -match glob
test ttk-13.4 "Custom styles -- bad -style option" -body {
ttk::button .tb1
.tb1 configure -style badstyle
} -cleanup {
destroy .tb1
-} -returnCodes 1 -result "*badstyle not found*" -match glob
+} -returnCodes error -result "*badstyle not found*" -match glob
test ttk-13.5 "Custom layouts -- missing element definition" -body {
ttk::style layout badstyle {
@@ -572,17 +573,17 @@ test ttk-13.5 "Custom layouts -- missing element definition" -body {
test ttk-14.1 "-variable in nonexistant namespace" -body {
ttk::checkbutton .tw -variable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-14.2 "-textvariable in nonexistant namespace" -body {
ttk::label .tw -textvariable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-14.3 "-textvariable in nonexistant namespace" -body {
ttk::entry .tw -textvariable ::nsn::foo
-} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \
+} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \
-match glob -cleanup { destroy .tw }
test ttk-15.1 {Bug 3062331} -setup {
@@ -628,27 +629,27 @@ proc wrong#varargs {varpart args} {
test ttk-ensemble-0 "style element create: insufficient args" -body {
ttk::style
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs arg ttk::style option]
test ttk-ensemble-1 "style element create: insufficient args" -body {
ttk::style element
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs arg ttk::style element option]
test ttk-ensemble-2 "style element create: insufficient args" -body {
ttk::style element create
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs {-option value} ttk::style element create name type]
test ttk-ensemble-3 "style element create: insufficient args" -body {
ttk::style element create plain.background
-} -returnCodes 1 -result \
+} -returnCodes error -result \
[wrong#varargs {-option value} ttk::style element create name type]
test ttk-ensemble-4 "style element create: insufficient args" -body {
ttk::style element create plain.background from
-} -returnCodes 1 -result [wrong#args theme ?element?]
+} -returnCodes error -result [wrong#args theme ?element?]
test ttk-ensemble-5 "style element create: valid" -body {
ttk::style element create plain.background from default
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
index 5755943..5430903 100644
--- a/tests/ttk/validate.test
+++ b/tests/ttk/validate.test
@@ -3,8 +3,8 @@
## Derived from core test suite entry-19.1 through entry-19.20
##
-package require Tk 8.5
-package require tcltest 2.1
+package require Tk
+package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
index bb88fef..ec4e9e7 100644
--- a/tests/ttk/vsapi.test
+++ b/tests/ttk/vsapi.test
@@ -1,12 +1,13 @@
# -*- tcl -*-
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint xpnative \
- [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}]
+ [expr {"xpnative" in [ttk::style theme names]}]
test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body {
ttk::style element create smallclose vsapi \
diff --git a/tests/unixButton.test b/tests/unixButton.test
index f0dcde5..5a55c5e 100644
--- a/tests/unixButton.test
+++ b/tests/unixButton.test
@@ -3,9 +3,9 @@
# widgets defined in tkUnixButton.c). It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index c0a5bac..8315ae3 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -2,8 +2,8 @@
# tkUnixEmbed.c. It is organized in the standard fashion for Tcl
# tests.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,12 +11,15 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
namespace eval ::_test_tmp {}
# ------------------------------------------------------------------------------
# Proc ::_test_tmp::testInterp
# ------------------------------------------------------------------------------
-# Command that creates an unsafe child interpreter and tries to load Tk.
+# Command that creates an child interpreter and tries to load Tk.
# This code is borrowed from safePrimarySelection.test
# This is necessary for loading Tktest if the tests are done in the build
# directory without installing Tk. In that case the usual auto_path loading
@@ -114,7 +117,7 @@ test unixEmbed-1.3 {TkpUseWindow procedure, inheriting colormap} -constraints {
colorsFree .x
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints {
unix nonPortable
} -setup {
@@ -127,7 +130,7 @@ test unixEmbed-1.4 {TkpUseWindow procedure, inheriting colormap} -constraints {
colorsFree .x
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints {
unix testembed notAqua
@@ -150,21 +153,21 @@ test unixEmbed-1.5a {TkpUseWindow procedure, creating Container records} -constr
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
frame .f2 -container 1 -width 200 -height 50
pack .f1 .f2
- slave alias w winfo id .f1
- slave eval {
+ child alias w winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t -use [w]
list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}]
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{{XXX {} {} .t}} 0}
test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints {
@@ -190,23 +193,23 @@ test unixEmbed-1.6a {TkpUseWindow procedure, creating Container records} -constr
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
frame .f2 -container 1 -width 200 -height 50
pack .f1 .f2
- slave alias w1 winfo id .f1
- slave alias w2 winfo id .f2
- slave eval {
+ child alias w1 winfo id .f1
+ child alias w2 winfo id .f2
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
toplevel .t2 -use [w2]
testembed
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{XXX {} {} .t2} {XXX {} {} .t1}}
test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints {
@@ -253,21 +256,21 @@ test unixEmbed-2.1a {EmbeddedEventProc procedure} -constraints {
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
testembed
}
destroy .f1
update
- slave eval {
+ child eval {
testembed
}
} -cleanup {
@@ -295,14 +298,14 @@ test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints {
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
testembed
@@ -310,7 +313,7 @@ test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints {
testembed
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {}
test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints {
@@ -361,22 +364,22 @@ test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints
test unixEmbed-3.1a {ContainerEventProc procedure, detect creation} -constraints {
unix testembed
} -setup {
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
+ child alias w1 winfo id .f1
set x [testembed]
- slave eval {
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
wm withdraw .t1
}
list $x [testembed]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}}
test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints {
@@ -418,14 +421,14 @@ test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -c
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1] -bd 2 -relief raised
update
@@ -434,7 +437,7 @@ test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -c
wm geometry .t1
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {200x200+0+0}
test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints {
@@ -462,14 +465,14 @@ test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -c
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -478,7 +481,7 @@ test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -c
wm geometry .t1
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {300x100+0+0}
test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints {
@@ -506,22 +509,22 @@ test unixEmbed-3.5a {ContainerEventProc procedure, geometry requests} -constrain
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
.t1 configure -width 300 -height 80
update
}
- list [winfo width .f1] [winfo height .f1] [slave eval {wm geometry .t1}]
+ list [winfo width .f1] [winfo height .f1] [child eval {wm geometry .t1}]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {300 80 300x80+0+0}
test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints {
@@ -551,14 +554,14 @@ test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints {
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
set x unmapped
@@ -569,7 +572,7 @@ test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints {
set x
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {mapped}
test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints {
@@ -599,16 +602,16 @@ test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
+ child alias w1 winfo id .f1
bind .f1 <Destroy> {set x dead}
set x alive
- slave eval {
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -617,7 +620,7 @@ test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints
update
list $x [winfo exists .f1]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {dead 0}
@@ -648,14 +651,14 @@ test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraint
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -664,7 +667,7 @@ test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraint
winfo geometry .t1
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {180x100+0+0}
test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints {
@@ -691,15 +694,15 @@ test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
update
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
}
@@ -707,7 +710,7 @@ test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints
destroy .f1
list $x [testembed]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result "{{XXX .f1 {} {}}} {}"
@@ -737,14 +740,14 @@ test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints {
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
bind .t1 <FocusIn> {lappend x "focus in %W"}
@@ -754,9 +757,9 @@ test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints {
}
focus -force .f1
update
- slave eval {set x}
+ child eval {set x}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{focus in .t1}}
test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constraints {
@@ -785,14 +788,14 @@ test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constra
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -802,7 +805,7 @@ test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constra
focus -force .f1
update
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {}
test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints {
@@ -833,14 +836,14 @@ test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints {
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
set x {}
@@ -850,12 +853,12 @@ test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints {
}
focus -force .f1
update
- set x [slave eval {update; set x }]
+ set x [child eval {update; set x }]
focus .
update
- list $x [slave eval {update; set x}]
+ list $x [child eval {update; set x}]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}}
@@ -885,14 +888,14 @@ test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -const
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -903,7 +906,7 @@ test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -const
list $x [winfo geom .t1]
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{configure .t1 300 120} 300x120+0+0}
test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints {
@@ -931,15 +934,15 @@ test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -const
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
place .f1 -width 200 -height 200
update
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
update
@@ -950,7 +953,7 @@ test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -const
list $x [winfo geom .t1]
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{configure .t1 200 200} 200x200+0+0}
@@ -976,7 +979,7 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain
update
bind .t1 <Key> {lappend y {key %A}}
set y {}
- event generate .t1 <Keys> -keysym a
+ event generate .t1 <Key> -keysym a
set y
}]
update
@@ -988,25 +991,25 @@ test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constrain
# TkpRedirectKeyEvent is not implemented in win or aqua. If someone
# implements it they should change the constraints for this test.
test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
- unix notAqua
+ unix notAqua failsOnXQuarz
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
deleteWindows
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
}
focus -force .
bind . <Key> {lappend x {key %A %E}}
set x {}
- set y [slave eval {
+ set y [child eval {
update
bind .t1 <Key> {lappend y {key %A}}
set y {}
@@ -1016,7 +1019,7 @@ test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constrai
update
list $x $y
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
bind . <Key> {}
} -result {{{key a 1}} {}}
@@ -1054,14 +1057,14 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
unix
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1]
}
@@ -1070,7 +1073,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
update
bind . <Key> {lappend x {key %A}}
set x {}
- set y [slave eval {
+ set y [child eval {
update
bind .t1 <Key> {lappend y {key %A}}
set y {}
@@ -1080,13 +1083,13 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt
update
list $x $y
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
bind . <Key> {}
} -result {{} {{key b}}}
test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints {
- unix notAqua
+ unix notAqua failsOnUbuntu failsOnXQuarz
} -setup {
deleteWindows
} -body {
@@ -1113,30 +1116,30 @@ test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints {
} -result {{{} .t1} .f1}
test unixEmbed-8.1a {TkpClaimFocus procedure} -constraints unix -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
frame .f2 -width 200 -height 50
pack .f1 .f2
update
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken
}
# This should clear focus from the application embedded in .f1
focus -force .f2
update
- list [slave eval {
+ list [child eval {
set x [list [focus]]
focus .t1
update
lappend x [focus]
}] [focus]
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{{} .t1} .f1}
test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup {
@@ -1188,9 +1191,9 @@ test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints
deleteWindows
} -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}}
test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints {
- unix testembed notAqua
+ unix testembed notAqua
} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
@@ -1211,14 +1214,14 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain
unix testembed
} -setup {
deleteWindows
- catch {interp delete slave}
- ::_test_tmp::testInterp slave
- load {} Tktest slave
+ catch {interp delete child}
+ ::_test_tmp::testInterp child
+ load {} Tktest child
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
- slave alias w1 winfo id .f1
- slave eval {
+ child alias w1 winfo id .f1
+ child eval {
destroy [winfo child .]
toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken
set x {}
@@ -1227,48 +1230,48 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain
lappend x [testembed]
}
} -cleanup {
- interp delete slave
+ interp delete child
deleteWindows
} -result {{{XXX {} {} .t1}} {}}
test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix
+ unix failsOnUbuntu failsOnXQuarz
} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
- update
pack .f1
- update
+ update idletasks
toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
+ update idletasks
wm geometry .t1 +40+50
- update
+ update idletasks
wm geometry .t1
} -cleanup {
deleteWindows
} -result {150x80+0+0}
test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints {
- unix
+ unix failsOnUbuntu failsOnXQuarz
} -setup {
- deleteWindows
+ deleteWindows
} -body {
frame .f1 -container 1 -width 200 -height 50
pack .f1
+ update idletasks
toplevel .t1 -use [winfo id .f1] -width 150 -height 80
- update
+ update idletasks
wm geometry .t1 70x300+10+20
- update
+ update idletasks
wm geometry .t1
} -cleanup {
deleteWindows
} -result {70x300+0+0}
test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints {
- unix
+ unix
} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .t
pack [frame .t.f -container 1 -width 200 -height 200] -fill both
@@ -1282,9 +1285,9 @@ test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints {
deleteWindows
} -result .embed
test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints {
- unix pressbutton
+ unix pressbutton
} -setup {
- deleteWindows
+ deleteWindows
} -body {
toplevel .main
set result {}
diff --git a/tests/unixFont.test b/tests/unixFont.test
index 177dab5..0684bc5 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -8,14 +8,18 @@
# fonts having or not having certain properties, which may not be valid
# at all sites.
#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
if {[tk windowingsystem] eq "x11"} {
set xlsf [auto_execok xlsfonts]
}
@@ -69,30 +73,30 @@ proc getsize {} {
test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} {
list [catch {font measure {} xyz} msg] $msg
} {1 {font "" doesn't exist}}
-test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 {
+test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} {
font measure fixed 0
-} {6}
+} 6
test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 {
font actual {-size 10}
set x {}
} {}
test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \
- {x11 noExceed hasTimesNew} {
+ {x11 noExceed hasTimesNew failsOnUbuntu} {
set x {}
lappend x [lindex [font actual {-family "Times New Roman"}] 1]
lappend x [lindex [font actual {-family "New York"}] 1]
lappend x [lindex [font actual {-family "Times"}] 1]
} {times times times}
test unixfont-2.3 {TkpGetFontFromAttributes procedure: Courier relatives} \
- {x11 noExceed hasCourierNew} {
+ {x11 noExceed hasCourierNew failsOnUbuntu} {
set x {}
lappend x [lindex [font actual {-family "Courier New"}] 1]
lappend x [lindex [font actual {-family "Monaco"}] 1]
lappend x [lindex [font actual {-family "Courier"}] 1]
} {courier courier courier}
test unixfont-2.4 {TkpGetFontFromAttributes procedure: Helvetica relatives} \
- {x11 noExceed hasArial} {
+ {x11 noExceed hasArial failsOnUbuntu} {
set x {}
lappend x [lindex [font actual {-family "Arial"}] 1]
lappend x [lindex [font actual {-family "Geneva"}] 1]
@@ -102,21 +106,21 @@ test unixfont-2.5 {TkpGetFontFromAttributes procedure: fallback} x11 {
font actual {-xyz-xyz-*-*-*-*-*-*-*-*-*-*-*-*}
set x {}
} {}
-test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} x11 {
+test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} {x11 failsOnUbuntu} {
lindex [font actual {-family fixed -size 10}] 1
} {fixed}
test unixfont-2.7 {TkpGetFontFromAttributes: fixed family not available!} x11 {
# no test available
} {}
-test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} x11 {
+test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} {
lindex [font actual {-family fixed -size 31}] 1
} {fixed}
-test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed} {
+test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} {
lindex [font actual {-family courier}] 1
} {courier}
-test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 {
+test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} {
lindex [font actual {-family courier -size 37}] 3
-} {37}
+} 37
test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 {
# On Linux, XListFonts() was returning names for fonts that do not
# actually exist, causing the subsequent XLoadQueryFont() to fail
@@ -166,15 +170,15 @@ test unixfont-5.7 {Tk_MeasureChars procedure: already saw space in line} x11 {
.b.l config -text "000000 00000"
getsize
} "[expr $ax*6] [expr $ay*2]"
-test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} x11 {
+test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} {x11 failsOnUbuntu} {
.b.l config -text "00 000 00000"
getsize
} "[expr $ax*7] [expr $ay*2]"
-test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 {
+test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11 failsOnUbuntu} {
.b.c dchars $t 0 end
.b.c insert $t 0 "0000"
.b.c index $t @[expr int($ax*2.5)],1
-} {2}
+} 2
test unixfont-5.10 {Tk_MeasureChars procedure: TK_AT_LEAST_ONE} x11 {
.b.l config -text "000000000000"
getsize
@@ -186,7 +190,7 @@ test unixfont-5.11 {Tk_MeasureChars: TK_AT_LEAST_ONE + not even one char fit!} x
.b.l config -wrap $a
set x
} "$ax [expr $ay*6]"
-test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} x11 {
+test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} {x11 failsOnUbuntu} {
.b.l config -text "000 \n000"
getsize
} "[expr $ax*6] [expr $ay*2]"
@@ -243,7 +247,7 @@ test unixfont-8.1 {AllocFont procedure: use old font} x11 {
} {}
test unixfont-8.2 {AllocFont procedure: parse information from XLFD} x11 {
expr {[lindex [font actual {-family times -size 0}] 3] == 0}
-} {0}
+} 0
test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
catch {unset fontArray}
# check that font actual returns the correct attributes.
@@ -253,9 +257,9 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 {
catch {unset fontArray}
set result
} {-family -overstrike -size -slant -underline -weight}
-test unixfont-8.4 {AllocFont procedure: classify characters} x11 {
+test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
- incr x [font measure $courier "\u4000"] ;# 6
+ incr x [font measure $courier "䀀"] ;# 6
incr x [font measure $courier "\002"] ;# 4
incr x [font measure $courier "\012"] ;# 2
incr x [font measure $courier "\101"] ;# 1
@@ -263,8 +267,8 @@ test unixfont-8.4 {AllocFont procedure: classify characters} x11 {
} [expr $cx*13]
test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 {
font metrics $courier -fixed
-} {1}
-test unixfont-8.6 {AllocFont procedure: setup widths of special chars} x11 {
+} 1
+test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} {
set x 0
incr x [font measure $courier "\001"] ;# 4
incr x [font measure $courier "\002"] ;# 4
@@ -292,7 +296,7 @@ test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 {
set x {}
} {}
-test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 {
+test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu failsOnXQuarz} {
.b.c dchars $t 0 end
.b.c insert $t 0 "0\a0"
set x {}
@@ -301,7 +305,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 {
lappend x [.b.c index $t @[expr $ax*2],0]
lappend x [.b.c index $t @[expr $ax*3],0]
} {0 1 1 2}
-test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} x11 {
+test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu failsOnXQuarz} {
.b.c dchars $t 0 end
.b.c insert $t 0 "0\0010"
set x {}
diff --git a/tests/unixMenu.test b/tests/unixMenu.test
index 63e4849..3acffcc 100644
--- a/tests/unixMenu.test
+++ b/tests/unixMenu.test
@@ -3,8 +3,8 @@
# file tests the Macintosh-specific features of the menu
# system.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/unixSelect.test b/tests/unixSelect.test
index a702587..75e16e4 100644
--- a/tests/unixSelect.test
+++ b/tests/unixSelect.test
@@ -4,7 +4,7 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1999 by Scriptics Corporation.
+# Copyright © 1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -115,13 +115,13 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints
} -body {
pack [entry .e]
update
- .e insert 0 \u00fcber
+ .e insert 0 über
.e selection range 0 end
dobg {string length [selection get]}
} -cleanup {
cleanupbg
destroy .e
-} -result {4}
+} -result 4
test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -constraints {
x11
@@ -131,13 +131,13 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc\u0444
+ .e insert 0 üф
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result \u00fc?
+} -result ü?
test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints {
x11
@@ -148,11 +148,11 @@ test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue \u00fc\u0444
+ set selValue üф
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] [string length $x]
+ list [string equal üф $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
@@ -172,12 +172,12 @@ test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -cons
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue [string repeat x 3999]\u00fc\u0444[string repeat x 3999]
+ set selValue [string repeat x 3999]üф[string repeat x 3999]
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
list [string equal \
- [string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \
+ [string repeat x 3999]üф[string repeat x 3999] $x] \
[string length $x]
}]
lappend result $selInfo
@@ -194,11 +194,11 @@ test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -co
selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \
{handler COMPOUND_TEXT}
selection own .
- set selValue \u00fc\u0444
+ set selValue üф
set selInfo {}
set result [dobg {
set x [selection get -type COMPOUND_TEXT]
- list [string equal \u00fc\u0444 $x] [string length $x]
+ list [string equal üф $x] [string length $x]
}]
lappend result $selInfo
} -cleanup {
@@ -211,7 +211,7 @@ test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints {
setupbg
} -body {
dobg [subst -nobackslashes {entry .e; pack .e; update
- .e insert 0 \u00fcber$longValue
+ .e insert 0 über$longValue
.e selection range 0 end}]
string length [selection get]
} -cleanup {
@@ -226,13 +226,13 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc
+ .e insert 0 [string repeat x 3999]ü
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc
+} -result [string repeat x 3999]ü
test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
x11
@@ -242,13 +242,13 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc[string repeat x 3999]
+ .e insert 0 ü[string repeat x 3999]
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result \u00fc[string repeat x 3999]
+} -result ü[string repeat x 3999]
test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
x11
@@ -258,13 +258,13 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints {
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
+ .e insert 0 [string repeat x 3999]ü[string repeat x 4000]
.e selection range 0 end
}
selection get
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc[string repeat x 4000]
+} -result [string repeat x 3999]ü[string repeat x 4000]
# Now some tests to make sure that the right thing is done when
# transferring UTF8 selections, to prevent [Bug 614650] and its ilk
# from rearing its ugly head again.
@@ -277,13 +277,13 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc
+ .e insert 0 [string repeat x 3999]ü
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc
+} -result [string repeat x 3999]ü
test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -293,13 +293,13 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc[string repeat x 3999]
+ .e insert 0 ü[string repeat x 3999]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result \u00fc[string repeat x 3999]
+} -result ü[string repeat x 3999]
test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -309,13 +309,13 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000]
+ .e insert 0 [string repeat x 3999]ü[string repeat x 4000]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat x 3999]\u00fc[string repeat x 4000]
+} -result [string repeat x 3999]ü[string repeat x 4000]
test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
x11
@@ -325,13 +325,13 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
} -body {
pack [entry .e]
update
- .e insert 0 \u00fcber\u0444
+ .e insert 0 überф
.e selection range 0 end
dobg {string length [selection get -type UTF8_STRING]}
} -cleanup {
destroy .e
cleanupbg
-} -result {5}
+} -result 5
test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints {
x11
@@ -341,13 +341,13 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -con
dobg {
pack [entry .e]
update
- .e insert 0 \u00fc\u0444
+ .e insert 0 üф
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result \u00fc\u0444
+} -result üф
test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -357,13 +357,13 @@ test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .e insert 0 [string repeat [string repeat Ää 50]\n 21]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result [string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -373,13 +373,13 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [entry .e]
update
- .e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .e insert 0 i[string repeat [string repeat Ää 50]\n 21]
.e selection range 0 end
}
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result i[string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -389,7 +389,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [text .t]
update
- .t insert 1.0 [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .t insert 1.0 [string repeat [string repeat Ää 50]\n 21]
# Has to be selected in a separate stage
.t tag add sel 1.0 21.end+1c
}
@@ -397,7 +397,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result [string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints {
x11
@@ -407,7 +407,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
dobg {
pack [text .t]
update
- .t insert 1.0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+ .t insert 1.0 i[string repeat [string repeat Ää 50]\n 21]
# Has to be selected in a separate stage
.t tag add sel 1.0 21.end+1c
}
@@ -415,7 +415,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const
selection get -type UTF8_STRING
} -cleanup {
cleanupbg
-} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21]
+} -result i[string repeat [string repeat Ää 50]\n 21]
test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints {
unix
diff --git a/tests/unixWm.test b/tests/unixWm.test
index 28c8159..dd1aa22 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -2,9 +2,9 @@
# the window manager, including the "wm" command. It is organized
# in the standard fashion for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -13,22 +13,15 @@ tcltest::loadTestedCommands
namespace import -force ::tk::test:loadTkCommand
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
proc sleep ms {
global x
after $ms {set x 1}
vwait x
}
-# The macOS window manager shows an animation when a window is deiconified.
-# Tests which check the geometry of a window after deiconifying it should
-# wait for the animation to finish.
-
- proc animationDelay {} {
- if {[tk windowingsystem] == "aqua"} {
- sleep 250
- }
- }
-
# Procedure to set up a collection of top-level windows
proc makeToplevels {} {
@@ -46,9 +39,10 @@ proc makeToplevels {} {
# larger than the height of the menubar (normally 23 pixels).
if {[tk windowingsystem] eq "aqua"} {
- set Y0 23
- set Y2 25
- set Y5 28
+ set mb [expr [menubarheight] + 1]
+ set Y0 $mb
+ set Y2 [expr $mb + 2]
+ set Y5 [expr $mb + 5]
} else {
set Y0 0
set Y2 2
@@ -56,7 +50,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
set i 1
-foreach geom "+23+80 +80+23 +0+$Y0" {
+foreach geom "+$Y0+80 +80+$Y0 +0+$Y0" {
destroy .t
test unixWm-1.$i {initial window position} unix {
toplevel .t -width 200 -height 150
@@ -82,7 +76,7 @@ update
scan [wm geom .t] %dx%d+%d+%d width height x y
set xerr [expr 150-$x]
set yerr [expr 150-$y]
-foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
+foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-2.$i {moving window while mapped} unix {
wm geom .t $geom
update
@@ -94,14 +88,14 @@ foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
}
set i 1
-foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
+foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
test unixWm-3.$i {moving window while iconified} unix {
wm iconify .t
- sleep 200
+ update idletasks
wm geom .t $geom
- update
+ update idletasks
wm deiconify .t
- animationDelay
+ update idletasks
scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y
format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \
[eval expr $y$ysign$yerr]
@@ -113,11 +107,11 @@ set i 1
foreach geom "+20+80 +100+40 +0+$Y0" {
test unixWm-4.$i {moving window while withdrawn} unix {
wm withdraw .t
- sleep 200
+ update idletasks
wm geom .t $geom
- update
+ update idletasks
wm deiconify .t
- animationDelay
+ update idletasks
wm geom .t
} 100x150$geom
incr i
@@ -194,27 +188,27 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} {
destroy .t
toplevel .t -width 200 -height 100
-wm geom .t +10+23
+wm geom .t +10+$Y0
wm minsize .t 1 1
update
test unixWm-6.1 {size changes} unix {
.t config -width 180 -height 150
update
wm geom .t
-} 180x150+10+23
+} 180x150+10+$Y0
test unixWm-6.2 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
update
wm geom .t
-} 250x60+10+23
+} 250x60+10+$Y0
test unixWm-6.3 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
wm geom .t {}
update
wm geom .t
-} 170x140+10+23
+} 170x140+10+$Y0
test unixWm-6.4 {size changes} {unix nonPortable userInteraction} {
wm minsize .t 1 1
update
@@ -296,11 +290,12 @@ test unixWm-8.3 {icon windows} unix {
toplevel .t -width 100 -height 30
list [catch {wm iconwindow .t b c} msg] $msg
} {1 {wrong # args: should be "wm iconwindow window ?pathName?"}}
-test unixWm-8.4 {icon windows} unix {
+test unixWm-8.4 {icon windows} {unix failsOnUbuntu} {
destroy .t
destroy .icon
toplevel .t -width 100 -height 30
wm geom .t +0+0
+ update idletasks
set result [wm iconwindow .t]
toplevel .icon -width 50 -height 50 -bg red
wm iconwindow .t .icon
@@ -310,7 +305,7 @@ test unixWm-8.4 {icon windows} unix {
update
lappend result [winfo ismapped .t] [winfo ismapped .icon]
wm iconify .t
- update
+ update idletasks
lappend result [winfo ismapped .t] [winfo ismapped .icon]
} {.icon icon {} withdrawn 1 0 0 0}
test unixWm-8.5 {icon windows} unix {
@@ -348,7 +343,6 @@ test unixWm-8.8 {icon windows} unix {
wm geom .t +0+0
tkwait visibility .t ;# Needed to keep tvtwm happy.
wm iconwindow .t .icon
- sleep 500
lappend result [winfo ismapped .t] [winfo ismapped .icon]
} {1 1 0}
test unixWm-8.9 {icon windows} {unix nonPortable} {
@@ -420,25 +414,23 @@ test unixWm-9.3 {TkWmMapWindow procedure, iconic windows} unix {
toplevel .t -width 100 -height 300 -bg blue
wm geom .t +0+0
wm iconify .t
- sleep 500
winfo ismapped .t
-} {0}
+} 0
test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix {
destroy .t
- sleep 500
toplevel .t -width 100 -height 50 -bg blue
tkwait visibility .t
wm iconwindow . .t
update
set result [winfo ismapped .t]
-} {0}
+} 0
test unixWm-9.5 {TkWmMapWindow procedure, normal windows} unix {
destroy .t
toplevel .t -width 200 -height 20
wm geom .t +0+0
update
winfo ismapped .t
-} {1}
+} 1
test unixWm-10.1 {TkWmDeadWindow procedure, canceling UpdateGeometry idle handler} unix {
destroy .t
@@ -643,7 +635,7 @@ test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix {
destroy .icon
set result
} {1 {can't deiconify .icon: it is an icon for .t}}
-test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} unix {
+test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu} {
wm iconify .t
set result {}
lappend result [winfo ismapped .t] [wm state .t]
@@ -672,7 +664,7 @@ test unixWm-18.1 {Tk_WmCmd procedure, "frame" option} unix {
} {1 {wrong # args: should be "wm frame window"}}
test unixWm-18.2 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
expr [wm frame .t] == [winfo id .t]
-} {0}
+} 0
test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
destroy .t2
toplevel .t2
@@ -682,7 +674,7 @@ test unixWm-18.3 {Tk_WmCmd procedure, "frame" option} {unix nonPortable} {
set result [expr [wm frame .t2] == [winfo id .t2]]
destroy .t2
set result
-} {1}
+} 1
test unixWm-19.1 {Tk_WmCmd procedure, "geometry" option} unix {
list [catch {wm geometry .t 12 13} msg] $msg
@@ -793,7 +785,7 @@ test unixWm-21.4 {Tk_WmCmd procedure, "group" option, make window exist} {unix t
set result [expr [testwrapper .t2] - [lindex $hints 8]]
destroy .t2
set result
-} {0}
+} 0
test unixWm-21.5 {Tk_WmCmd procedure, "group" option, create leader wrapper} {unix testwrapper} {
destroy .t2
destroy .t3
@@ -861,26 +853,26 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix {
set result [list [catch {wm iconify .t2} msg] $msg]
destroy .t2
set result
-} {1 {can't iconify .t2: it is an icon for .t}}
-test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix {
+} {1 {can't iconify ".t2": it is an icon for ".t"}}
+test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} {
destroy .t2
toplevel .t2
wm geom .t2 +0+0
- update
+ update idletasks
wm iconify .t2
- update
+ update idletasks
set result [winfo ismapped .t2]
destroy .t2
set result
-} {0}
-test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix {
+} 0
+test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} {
destroy .t2
toplevel .t2
wm geom .t2 -0+0
- update
+ update idletasks
set result [winfo ismapped .t2]
wm iconify .t2
- update
+ update idletasks
lappend result [winfo ismapped .t2]
destroy .t2
set result
@@ -1309,7 +1301,7 @@ test unixWm-37.3 {Tk_WmCmd procedure, "transient" option} {unix testwrapper} {
destroy .t2
set result
} {{} {} .t 0 {} {}}
-test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {unix testwrapper} {
+test unixWm-37.4 {TkWmDeadWindow, destroy on toplevel should clear transient} {unix testwrapper} {
destroy .t2
toplevel .t2
destroy .t3
@@ -1320,7 +1312,7 @@ test unixWm-37.4 {TkWmDeadWindow, destroy on master should clear transient} {uni
update
list [wm transient .t2] [testprop [testwrapper .t2] WM_TRANSIENT_FOR]
} {{} {}}
-test unixWm-37.5 {Tk_WmCmd procedure, "transient" option, create master wrapper} {unix testwrapper} {
+test unixWm-37.5 {Tk_WmCmd procedure, "transient" option, create toplevel wrapper} {unix testwrapper} {
destroy .t2
destroy .t3
toplevel .t2 -width 120 -height 300
@@ -1384,12 +1376,13 @@ test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already
test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix {
destroy .t
toplevel .t -width 400 -height 150
- wm geometry .t +0+0
tkwait visibility .t
+ wm geometry .t +0+0
+ update idletasks
set result {}
lappend result [winfo width .t] [winfo height .t]
.t configure -width 200 -height 300
- sleep 500
+ update idletasks
lappend result [winfo width .t] [winfo height .t]
} {400 150 200 300}
test unixWm-41.2 {ConfigureEvent procedure, menubars} {nonPortable testmenubar} {
@@ -1443,7 +1436,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix {
# No tests for ReparentEvent or ComputeReparentGeometry; I can't figure
# out how to exercise these procedures reliably.
-test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix {
+test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu} {
destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
@@ -1453,11 +1446,11 @@ test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix {
bind .t <Unmap> {set x "unmapped"}
set x {no event}
wm iconify .t
- animationDelay
+ update idletasks
lappend result $x [winfo ismapped .t]
set x {no event}
wm deiconify .t
- animationDelay
+ update idletasks
lappend result $x [winfo ismapped .t]
} {unmapped 0 mapped 1}
@@ -1560,7 +1553,7 @@ test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix {
} {100 1}
destroy .t
toplevel .t -width 80 -height 60
-test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
+test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} {
tkwait visibility .t
wm overrideredirect .t 1
update
@@ -1570,7 +1563,7 @@ test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix {
} [list 5 [expr [winfo screenheight .t] - 70]]
destroy .t
toplevel .t -width 80 -height 60
-test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix {
+test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} {unix failsOnXQuarz} {
tkwait visibility .t
wm overrideredirect .t 1
update
@@ -1620,7 +1613,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper
[expr [lindex $property 7]] [expr [lindex $property 8]] \
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {40 30 320 210 10 5}
-test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} {
+test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu failsOnXQuarz} {
destroy .t
toplevel .t -width 80 -height 60
wm minsize .t 30 40
@@ -1648,7 +1641,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr
[expr [lindex $property 7]] [expr [lindex $property 8]] \
[expr [lindex $property 9]] [expr [lindex $property 10]]
} {60 40 53 320 233 10 5}
-test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper} {
+test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu failsOnXQuarz} {
destroy .t
toplevel .t -width 80 -height 60
frame .t.menu -height 23 -width 50
@@ -1744,10 +1737,10 @@ test unixWm-48.10 {ParseGeometry procedure} unix {
} {1 {bad geometry specifier "+20+10z"}}
test unixWm-48.11 {ParseGeometry procedure} unix {
catch {wm geometry .t +-10+20}
-} {0}
+} 0
test unixWm-48.12 {ParseGeometry procedure} unix {
catch {wm geometry .t +30+-10}
-} {0}
+} 0
test unixWm-48.13 {ParseGeometry procedure, resize causes window to move} unix {
destroy .t
toplevel .t -width 200 -height 200
@@ -1802,7 +1795,7 @@ if {[tk windowingsystem] == "aqua"} {
# Windows are assumed to have a border (invisible in Gnome 3).
set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t}
}
-test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} unix {
+test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu failsOnXQuarz} {
update
toplevel .t -width 300 -height 400 -bg green
wm geom .t +100+100
@@ -1850,7 +1843,7 @@ test unixWm-50.3 {
Tk_CoordsToWindow procedure, finding a toplevel with embedding
} tempNotWin {
deleteWindows
- catch {interp delete slave}
+ catch {interp delete child}
toplevel .t -width 300 -height 400 -bg blue
wm geom .t +100+100
@@ -1858,10 +1851,10 @@ test unixWm-50.3 {
place .t.f -x 150 -y 50
tkwait visibility .t.f
update
- interp create slave
- load {} Tk slave
- slave alias frameid winfo id .t.f
- slave eval {
+ interp create child
+ load {} Tk child
+ child alias frameid winfo id .t.f
+ child eval {
wm withdraw .
toplevel .x -width 100 -height 80 -use [frameid] -bg yellow
tkwait visibility .x
@@ -1869,9 +1862,9 @@ test unixWm-50.3 {
set x [winfo rootx .x]
set y [winfo rooty .x]
}
- set result [list [slave eval {winfo containing [expr $x - 1] [expr $y + 50]}] \
- [slave eval {winfo containing $x [expr $y + 50]}]]
- interp delete slave
+ set result [list [child eval {winfo containing [expr $x - 1] [expr $y + 50]}] \
+ [child eval {winfo containing $x [expr $y + 50]}]]
+ interp delete child
set x [winfo rootx .t]
set y [winfo rooty .t]
lappend result [winfo containing [expr $x + 200] [expr $y + 49]] \
@@ -1881,17 +1874,17 @@ test unixWm-50.3 {
test unixWm-50.4 {Tk_CoordsToWindow procedure, window in other application} unix {
destroy .t
- catch {interp delete slave}
+ catch {interp delete child}
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +100+100
tkwait visibility .t
update
- interp create slave
- load {} Tk slave
- slave eval {wm geometry . 200x200+100+100; tkwait visibility . ; update}
+ interp create child
+ load {} Tk child
+ child eval {wm geometry . 200x200+100+100; tkwait visibility . ; update}
set result [list [winfo containing 200 200] \
- [slave eval {winfo containing 200 200}]]
- interp delete slave
+ [child eval {winfo containing 200 200}]]
+ interp delete child
set result
} {{} .}
test unixWm-50.5 {Tk_CoordsToWindow procedure, handling menubars} {unix testmenubar} {
@@ -1953,13 +1946,13 @@ test unixWm-50.7 {Tk_CoordsToWindow procedure, more basics} unix {
test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
destroy .t
toplevel .t -width 400 -height 300 -bg green
- wm geom .t +0+0
+ wm geom .t +0+30
frame .t.f -width 200 -height 100 -bd 2 -relief raised
place .t.f -x 100 -y 100
frame .t.f.f -width 200 -height 100 -bd 2 -relief raised
place .t.f.f -x 100 -y 0
update
- set x [winfo rooty .t]
+ set x [winfo rootx .t]
set y [expr [winfo rooty .t] + 150]
list [winfo containing [expr $x + 50] $y] \
[winfo containing [expr $x + 150] $y] \
@@ -1967,10 +1960,9 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
[winfo containing [expr $x + 350] $y] \
[winfo containing [expr $x + 450] $y]
} {.t .t.f .t.f.f .t {}}
-test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
+test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu} {
destroy .t
destroy .t2
- sleep 500 ;# Give window manager time to catch up.
toplevel .t -width 200 -height 200 -bg green
wm geometry .t +0+0
tkwait visibility .t
@@ -1979,7 +1971,7 @@ test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix {
tkwait visibility .t2
set result [list [winfo containing 100 100]]
wm iconify .t2
- animationDelay
+ update idletasks
lappend result [winfo containing 100 100]
} {.t2 .t}
test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
@@ -1989,9 +1981,10 @@ test unixWm-50.10 {Tk_CoordsToWindow procedure, unmapped windows} unix {
frame .t.f -width 150 -height 150 -bd 2 -relief raised
place .t.f -x 25 -y 25
tkwait visibility .t.f
+ update idletasks
set result [list [winfo containing 100 100]]
place forget .t.f
- update
+ update idletasks
lappend result [winfo containing 100 100]
} {.t.f .t}
deleteWindows
@@ -2021,7 +2014,6 @@ test unixWm-51.3 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
set result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
destroy .raise2
- sleep 500
list $result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
} {.raise2 .raise1}
@@ -2032,7 +2024,6 @@ test unixWm-51.4 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
lower .raise3 .raise1
set result [winfo containing 100 100]
destroy .raise1
- sleep 500
lappend result [winfo containing 100 100]
} {.raise1 .raise3}
test unixWm-51.5 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable} {
@@ -2047,7 +2038,6 @@ test unixWm-51.5 {TkWmRestackToplevel procedure, basic tests} {unix nonPortable}
set result [winfo containing [winfo rootx .raise1] \
[winfo rooty .raise1]]
destroy .raise1
- sleep 500
list $result [winfo containing [winfo rootx .raise2] \
[winfo rooty .raise2]]
} {.raise1 .raise3}
@@ -2062,7 +2052,7 @@ test unixWm-51.6 {TkWmRestackToplevel procedure, window to be stacked isn't mapp
wm geometry .t2 +0+0
winfo containing 100 100
} {.t}
-test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix {
+test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} {unix failsOnXQuarz} {
foreach w {.t .t2 .t3} {
destroy $w
update
@@ -2070,11 +2060,9 @@ test unixWm-51.7 {TkWmRestackToplevel procedure, other window isn't mapped} unix
wm geometry $w +0+0
}
raise .t .t2
- sleep 2000
update
set result [list [winfo containing 100 100]]
lower .t3
- sleep 2000
lappend result [winfo containing 100 100]
} {.t3 .t}
test unixWm-51.8 {TkWmRestackToplevel procedure, overrideredirect windows} unix {
@@ -2250,7 +2238,7 @@ test unixWm-54.2 {TkpMakeMenuWindow procedure, setting override_redirect} {unix
set result [wm overrideredirect .m]
destroy .m
set result
-} {1}
+} 1
# No tests for TkGetPointerCoords, CreateWrapper, or GetMaxSize.
diff --git a/tests/util.test b/tests/util.test
index d457b50..d88ee57 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the procedures in the file
# tkUtil.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -34,27 +34,27 @@ test util-1.5 {Tk_GetScrollInfo procedure} -body {
} -returnCodes error -result {wrong # args: should be ".l yview scroll number pages|units"}
test util-1.6 {Tk_GetScrollInfo procedure} -body {
.l yview scroll xyz units
-} -returnCodes error -result {expected integer but got "xyz"}
+} -returnCodes error -result {expected floating-point number but got "xyz"}
test util-1.7 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 pages
.l nearest 0
-} -result {6}
+} -result 6
test util-1.8 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 pages
.l nearest 0
-} -result {9}
+} -result 9
test util-1.9 {Tk_GetScrollInfo procedure} -body {
.l yview 0
.l yview scroll 2 units
.l nearest 0
-} -result {2}
+} -result 2
test util-1.10 {Tk_GetScrollInfo procedure} -body {
.l yview 15
.l yview scroll -2 units
.l nearest 0
-} -result {13}
+} -result 13
test util-1.11 {Tk_GetScrollInfo procedure} -body {
.l yview scroll 3 zips
} -returnCodes error -result {bad argument "zips": must be pages or units}
diff --git a/tests/visual.test b/tests/visual.test
index 13d6fd2..f6ad376 100644
--- a/tests/visual.test
+++ b/tests/visual.test
@@ -2,9 +2,9 @@
# procedures in the file tkVisual.c. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -455,7 +455,7 @@ test visual-7.1 {Tk_GetColormap, "new"} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test visual-7.2 {Tk_GetColormap, "new"} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -468,7 +468,7 @@ test visual-7.2 {Tk_GetColormap, "new"} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test visual-7.3 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -484,7 +484,7 @@ test visual-7.3 {Tk_GetColormap, copy from other window} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test visual-7.4 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
@@ -500,7 +500,7 @@ test visual-7.4 {Tk_GetColormap, copy from other window} -constraints {
colorsFree .t2
} -cleanup {
deleteWindows
-} -result {0}
+} -result 0
test visual-7.5 {Tk_GetColormap, copy from other window} -constraints {
defaultPseudocolor8 nonPortable
} -setup {
diff --git a/tests/visual_bb.test b/tests/visual_bb.test
index eda67e4..36612a9 100644
--- a/tests/visual_bb.test
+++ b/tests/visual_bb.test
@@ -23,7 +23,7 @@ proc runTest {file} {
global testNum
test "2.$testNum" "testing $file" {userInteraction} {
- uplevel \#0 source [file join [testsDirectory] $file]
+ uplevel #0 [list source -encoding utf-8 [file join [testsDirectory] $file]]
concat ""
} {}
incr testNum
diff --git a/tests/winButton.test b/tests/winButton.test
index 88b4345..50906c8 100644
--- a/tests/winButton.test
+++ b/tests/winButton.test
@@ -3,9 +3,9 @@
# widgets defined in tkWinButton.c). It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winClipboard.test b/tests/winClipboard.test
index 2f72966..7240fa6 100644
--- a/tests/winClipboard.test
+++ b/tests/winClipboard.test
@@ -6,8 +6,8 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1997 by Sun Microsystems, Inc.
-# Copyright (c) 1998-2000 by Scriptics Corporation.
+# Copyright © 1997 by Sun Microsystems, Inc.
+# Copyright © 1998-2000 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -70,24 +70,23 @@ test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints {
clipboard clear
} -body {
set map [list "\r" "\\r" "\n" "\\n"]
- clipboard append "line 1\u00c7\nline 2"
+ clipboard append "line 1Ç\nline 2"
list [string map $map [selection get -selection CLIPBOARD]]\
[string map $map [testclipboard]]
} -cleanup {
clipboard clear
-} -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"]
+} -result [list "line 1Ç\\nline 2" "line 1Ç\\nline 2"]
test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints {
win testclipboard
} -setup {
clipboard clear
} -body {
- clipboard append "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"
+ clipboard append "привет миф"
list [selection get -selection CLIPBOARD] [testclipboard]
} -cleanup {
clipboard clear
-} -result [list "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"\
- "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"]
+} -result [list "привет миф" "привет миф"]
test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} -constraints {
win testclipboard
diff --git a/tests/winDialog.test b/tests/winDialog.test
index e70ae3f..e0daf24 100755
--- a/tests/winDialog.test
+++ b/tests/winDialog.test
@@ -3,9 +3,9 @@
# the common dialog boxes. It is organized in the standard
# fashion for Tcl tests.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 1998-1999 ActiveState Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
+# Copyright © 1998-1999 ActiveState Corporation.
package require tcltest 2.2
namespace import ::tcltest::*
@@ -118,7 +118,7 @@ test winDialog-1.1 {Tk_ChooseColorObjCmd} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-1.2 {Tk_ChooseColorObjCmd} -constraints {
testwinevent
} -body {
@@ -161,7 +161,7 @@ test winDialog-1.5 {Tk_ChooseColorObjCmd: -title} -constraints {
set x {}
start {
set clr [tk_chooseColor -initialcolor "#ff9933" \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"]
+ -title "Привет"]
}
then {
if {[catch {
@@ -171,7 +171,7 @@ test winDialog-1.5 {Tk_ChooseColorObjCmd: -title} -constraints {
lappend x [Click ok]
}
lappend x $clr
-} -result [list "\u041f\u0440\u0438\u0432\u0435\u0442" 0 "#ff9933"]
+} -result [list "Привет" 0 "#ff9933"]
test winDialog-1.6 {Tk_ChooseColorObjCmd: -parent} -constraints {
testwinevent
} -setup {
@@ -229,7 +229,7 @@ test winDialog-5.1 {GetFileName: no arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-5.2 {GetFileName: one argument} -constraints {
nt
} -body {
@@ -242,7 +242,7 @@ test winDialog-5.3 {GetFileName: many arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-5.4 {GetFileName: Tcl_GetIndexFromObj() != TCL_OK} -constraints {
nt
} -body {
@@ -259,7 +259,7 @@ test winDialog-5.5 {GetFileName: Tcl_GetIndexFromObj() == TCL_OK} -constraints {
# https://core.tcl-lang.org/tk/tktview/4a0451f5291b3c9168cc560747dae9264e1d2ef6
# $x is expected to be empty
append x $y
-} -result {0}
+} -result 0
test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints {
nt
} -body {
@@ -545,7 +545,7 @@ test winDialog-5.12.3 {tk_getSaveFile: initial directory: .} -constraints {
test winDialog-5.12.4 {tk_getSaveFile: initial directory: unicode} -constraints {
nt testwinevent
} -body {
- set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"]
+ set dir [tcltest::makeDirectory "ŧéŝŧ"]
unset -nocomplain x
start {set x [tk_getSaveFile \
-initialdir $dir \
@@ -631,7 +631,7 @@ test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints {
test winDialog-5.12.9 {tk_getOpenFile: initial directory: unicode} -constraints {
nt testwinevent
} -body {
- set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"]
+ set dir [tcltest::makeDirectory "ŧéŝŧ"]
set path [tcltest::makeFile "" testfile $dir]
unset -nocomplain x
start {set x [tk_getOpenFile \
@@ -726,7 +726,7 @@ test winDialog-5.16 {GetFileName: parent} -constraints {
destroy .t
}
return $x
-} -result {1}
+} -result 1
test winDialog-5.17 {GetFileName: title} -constraints {
nt testwinevent
} -body {
@@ -736,7 +736,7 @@ test winDialog-5.17 {GetFileName: title} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
if {[vista?]} {
# In the newer file dialogs, the file type widget does not even exist
# if no file types specified
@@ -841,18 +841,18 @@ test winDialog-5.24 {GetFileName: file types: MakeFilter() succeeds} -constraint
Click cancel
}
return $x
-} -result {0}
+} -result 0
test winDialog-5.25 {GetFileName: file types: MakeFilter() succeeds} -constraints {
nt
} -body {
# MacOS type that is correct, but has embedded high-bit chars.
- start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {\u2022\u2022\u2022\u2022}}}}]}
+ start {set x [catch {tk_getSaveFile -filetypes {{"foo" .foo {••••}}}}]}
then {
Click cancel
}
return $x
-} -result {0}
+} -result 0
test winDialog-6.1 {MakeFilter} -constraints {emptyTest nt} -body {}
@@ -877,7 +877,7 @@ test winDialog-9.1 {Tk_ChooseDirectoryObjCmd: no arguments} -constraints {
}]
# $x should be "" on a Cancel
append x $y
-} -result {0}
+} -result 0
test winDialog-9.2 {Tk_ChooseDirectoryObjCmd: one argument} -constraints {
nt
} -body {
@@ -892,7 +892,7 @@ test winDialog-9.3 {Tk_ChooseDirectoryObjCmd: many arguments} -constraints {
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-9.4 {Tk_ChooseDirectoryObjCmd: Tcl_GetIndexFromObj() != TCL_OK} -constraints {
nt
} -body {
@@ -905,7 +905,7 @@ test winDialog-9.5 {Tk_ChooseDirectoryObjCmd: Tcl_GetIndexFromObj() == TCL_OK} -
then {
Click cancel
}
-} -result {0}
+} -result 0
test winDialog-9.6 {Tk_ChooseDirectoryObjCmd: valid option, but missing value} -constraints {
nt
} -body {
@@ -1033,7 +1033,7 @@ test winDialog-10.9 {Tk_FontchooserObjCmd: -title} -constraints {
} -body {
start {
tk fontchooser configure -command ApplyFont \
- -title "\u041f\u0440\u0438\u0432\u0435\u0442"
+ -title "Привет"
tk fontchooser show
}
then {
@@ -1041,7 +1041,7 @@ test winDialog-10.9 {Tk_FontchooserObjCmd: -title} -constraints {
Click cancel
}
set a(text)
-} -result "\u041f\u0440\u0438\u0432\u0435\u0442"
+} -result "Привет"
if {[testConstraint testwinevent]} {
catch {testwinevent debug 0}
diff --git a/tests/winFont.test b/tests/winFont.test
index 23c09c9..1a8c115 100644
--- a/tests/winFont.test
+++ b/tests/winFont.test
@@ -6,8 +6,8 @@
# underlined?"); these tests attempt to exercise the code in question,
# but there are no results that can be checked.
#
-# Copyright (c) 1996-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -37,12 +37,12 @@ test winfont-2.1 {TkpGetFontFromAttributes procedure: pointsize} -constraints {
win
} -body {
expr {[font actual {-size -10} -size] > 0}
-} -result {1}
+} -result 1
test winfont-2.2 {TkpGetFontFromAttributes procedure: pointsize} -constraints {
win
} -body {
expr {[font actual {-family Arial} -size] > 0}
-} -result {1}
+} -result 1
test winfont-2.3 {TkpGetFontFromAttributes procedure: normal weight} -constraints {
win
} -body {
@@ -221,7 +221,7 @@ test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constra
.t.c index $t @[expr {int($cx*2.5)}],1
} -cleanup {
destroy .t.c
-} -result {2}
+} -result 2
test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} -constraints {
win
@@ -337,7 +337,7 @@ test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints {
expr {$x < ($width*10)}
} -cleanup {
destroy .t.l
-} -result {1}
+} -result 1
test winfont-6.1 {Tk_DrawChars procedure: loop test} -constraints win -setup {
@@ -375,12 +375,12 @@ test winfont-7.3 {AllocFont procedure: extract info from textmetric} -constraint
win
} -body {
font metric {arial 10 bold italic underline overstrike} -fixed
-} -result {0}
+} -result 0
test winfont-7.4 {AllocFont procedure: extract info from textmetric} -constraints {
win
} -body {
font metric systemfixed -fixed
-} -result {1}
+} -result 1
# cleanup
cleanupTests
diff --git a/tests/winMenu.test b/tests/winMenu.test
index b77e9a9..d3e7f83 100644
--- a/tests/winMenu.test
+++ b/tests/winMenu.test
@@ -3,8 +3,8 @@
# file tests the Macintosh-specific features of the menu
# system.
#
-# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winMsgbox.test b/tests/winMsgbox.test
index 0181103..cf7a05f 100644
--- a/tests/winMsgbox.test
+++ b/tests/winMsgbox.test
@@ -1,6 +1,6 @@
# This file is a Tcl script to test the Windows specific message box
#
-# Copyright (c) 2007 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2007 Pat Thoyts <patthoyts@users.sourceforge.net>
package require tcltest 2.2
namespace import ::tcltest::*
@@ -224,14 +224,14 @@ test winMsgbox-2.3 {tk_messageBox message (unicode)} -constraints {
} -body {
global windowInfo
set title "winMsgbox-2.2 [pid]"
- set message "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ set message "Поиск страниц"
after 100 [list GetWindowInfo $title 2]
set r [tk_messageBox -type ok -title $title -message $message]
array set info $windowInfo
lappend r $info(childtext)
} -cleanup {
wm deiconify .
-} -result [list ok "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+} -result [list ok "Поиск страниц"]
test winMsgbox-2.4 {tk_messageBox message (empty)} -constraints {
win getwindowinfo
@@ -276,15 +276,15 @@ test winMsgbox-3.2 {tk_messageBox detail (unicode)} -constraints {
} -body {
global windowInfo
set title "winMsgbox-3.1 [pid]"
- set message "\u041f\u043e\u0438\u0441\u043a"
- set detail "\u0441\u0442\u0440\u0430\u043d\u0438\u0446"
+ set message "Поиск"
+ set detail "страниц"
after 100 [list GetWindowInfo $title 2]
set r [tk_messageBox -type ok -title $title -message $message -detail $detail]
array set info $windowInfo
lappend r $info(childtext)
} -cleanup {
wm deiconify .
-} -result [list ok "\u041f\u043e\u0438\u0441\u043a\n\n\u0441\u0442\u0440\u0430\u043d\u0438\u0446"]
+} -result [list ok "Поиск\n\nстраниц"]
# -------------------------------------------------------------------------
diff --git a/tests/winSend.test b/tests/winSend.test
index 31c800e..e8186df 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -2,12 +2,12 @@
# other procedures in the file tkSend.c. It is organized in the
# standard fashion for Tcl tests.
#
-# Copyright (c) 1994 Sun Microsystems, Inc.
-# Copyright (c) 1994-1996 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 Sun Microsystems, Inc.
+# Copyright © 1994-1996 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -152,7 +152,7 @@ test winSend-3.1 {TkGetInterpNames} winSend {
set origLength [llength $currentInterps]
set newLength [llength [winfo interps]]
expr {($newLength - 2) == $origLength}
-} {1}
+} 1
test winSend-4.1 {DeleteProc - changing name of app} winSend {
newApp a
@@ -171,7 +171,7 @@ test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
}
}
list [send $interp {send [tk appname] {expr {2 / 1}}}]
-} {2}
+} 2
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
@@ -268,7 +268,7 @@ test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
}
set command "dde services Tk {}"
list [catch "send \{$interp\} \{$command\}"]
-} {0}
+} 0
test winSend-7.1 {DDEExitProc} winSend {
newApp testApp
@@ -312,10 +312,10 @@ test winSend-10.7 {Tk_DDEObjCmd - services wrong num args} winSend {
} {1 {wrong # args: should be "dde services serviceName topicName"}}
test winSend-10.8 {Tk_DDEObjCmd - null service name} winSend {
list [catch {dde services {} {tktest #2}}]
-} {0}
+} 0
test winSend-10.9 {Tk_DDEObjCmd - null topic name} winSend {
list [catch {dde services {Tk} {}}]
-} {0}
+} 0
test winSend-10.10 {Tk_DDEObjCmd - execute - nothing to execute} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
diff --git a/tests/winWm.test b/tests/winWm.test
index 0064c5a..f4183cd 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -5,8 +5,8 @@
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
-# Copyright (c) 1996 by Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1996 by Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -14,6 +14,7 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
test winWm-1.1 {TkWmMapWindow} -constraints win -setup {
destroy .t
@@ -274,7 +275,7 @@ test winWm-6.2 {wm attributes} -constraints win -setup {
wm attributes .t -disabled
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test winWm-6.3 {wm attributes} -constraints win -setup {
destroy .t
} -body {
@@ -485,7 +486,7 @@ test winWm-9.0 "Bug #2799589 - delayed activation of destroyed window" -constrai
rename winwm90$cmd {}
}
destroy .tx .t .sd
-} -result {ok}
+} -result ok
test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup {
proc winwm91click {w} {
@@ -530,9 +531,9 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win
rename winwm91$cmd {}
}
destroy .tx .t .sd
-} -result {ok}
+} -result ok
-test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup {
+test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints failsOnUbuntu -setup {
destroy .t
toplevel .t
set winwm92 {}
@@ -541,15 +542,15 @@ test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -setup
} -body {
pack .t.f.x
pack .t.f
- lappend aid [after 2000 {set ::winwm92 timeout}] [after 100 {
+ lappend aid [after 5000 {set ::winwm92 timeout}] [after 500 {
wm manage .t.f
wm iconify .t
- lappend aid [after 100 {
+ lappend aid [after 500 {
wm forget .t.f
wm deiconify .t
- lappend aid [after 100 {
+ lappend aid [after 500 {
pack .t.f
- lappend aid [after 100 {
+ lappend aid [after 500 {
set ::winwm92 [expr {
[winfo rooty .t.f.x] == 0 ? "failed" : "ok"}]}]
}]
diff --git a/tests/window.test b/tests/window.test
index fea695a..44f0b2a 100644
--- a/tests/window.test
+++ b/tests/window.test
@@ -1,8 +1,8 @@
# This file is a Tcl script to test the procedures in the file
# tkWindow.c. It is organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1995 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1995 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
diff --git a/tests/winfo.test b/tests/winfo.test
index 49a92a6..ff3d6b5 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -1,9 +1,9 @@
# This file is a Tcl script to test out the "winfo" command. It is
# organized in the standard fashion for Tcl tests.
#
-# Copyright (c) 1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
@@ -11,6 +11,9 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# eatColors --
# Creates a toplevel window and allocates enough colors in it to
# use up all the slots in the colormap.
@@ -174,7 +177,7 @@ test winfo-4.7 {"winfo containing" command} -setup {
expr {($x == ".") || ($x == "")}
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test winfo-5.1 {"winfo interps" command} -body {
@@ -188,10 +191,10 @@ test winfo-5.3 {"winfo interps" command} -body {
} -returnCodes error -result {bad window path name "geek"}
test winfo-5.4 {"winfo interps" command} -constraints unix -body {
expr {[lsearch -exact [winfo interps] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test winfo-5.5 {"winfo interps" command} -constraints unix -body {
expr {[lsearch -exact [winfo interps -displayof .] [tk appname]] >= 0}
-} -result {1}
+} -result 1
test winfo-6.1 {"winfo exists" command} -body {
@@ -202,10 +205,10 @@ test winfo-6.2 {"winfo exists" command} -body {
} -returnCodes error -result {wrong # args: should be "winfo exists window"}
test winfo-6.3 {"winfo exists" command} -body {
winfo exists gorp
-} -result {0}
+} -result 0
test winfo-6.4 {"winfo exists" command} -body {
winfo exists .
-} -result {1}
+} -result 1
test winfo-6.5 {"winfo exists" command} -setup {
destroy .b
} -body {
@@ -290,13 +293,13 @@ test winfo-9.2 {"winfo viewable" command} -body {
} -returnCodes error -result {bad window path name "foo"}
test winfo-9.3 {"winfo viewable" command} -body {
winfo viewable .
-} -result {1}
-test winfo-9.4 {"winfo viewable" command} -body {
+} -result 1
+test winfo-9.4 {"winfo viewable" command} -constraints failsOnUbuntu -body {
wm iconify .
winfo viewable .
} -cleanup {
wm deiconify .
-} -result {0}
+} -result 0
test winfo-9.5 {"winfo viewable" command} -setup {
deleteWindows
} -body {
@@ -320,7 +323,7 @@ test winfo-9.6 {"winfo viewable" command} -setup {
} -cleanup {
deleteWindows
} -result {0 0}
-test winfo-9.7 {"winfo viewable" command} -setup {
+test winfo-9.7 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
deleteWindows
} -body {
frame .f1 -width 100 -height 100 -relief raised -bd 2
@@ -344,7 +347,7 @@ test winfo-10.2 {"winfo visualid" command} -body {
} -returnCodes error -result {bad window path name "gorp"}
test winfo-10.3 {"winfo visualid" command} -body {
expr {2 + [winfo visualid .] - [winfo visualid .]}
-} -result {2}
+} -result 2
test winfo-11.1 {"winfo visualid" command} -body {
@@ -358,14 +361,14 @@ test winfo-11.3 {"winfo visualid" command} -body {
} -returnCodes error -result {wrong # args: should be "winfo visualsavailable window ?includeids?"}
test winfo-11.4 {"winfo visualid" command} -body {
llength [lindex [winfo visualsa .] 0]
-} -result {2}
+} -result 2
test winfo-11.5 {"winfo visualid" command} -body {
llength [lindex [winfo visualsa . includeids] 0]
-} -result {3}
+} -result 3
test winfo-11.6 {"winfo visualid" command} -body {
set x [lindex [lindex [winfo visualsa . includeids] 0] 2]
expr {$x + 2 - $x}
-} -result {2}
+} -result 2
test winfo-12.1 {GetDisplayOf procedure} -body {
diff --git a/tests/wm.test b/tests/wm.test
index 2978c1b..5fd5ee1 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -2,16 +2,16 @@
# manager, including the "wm" command. It is organized in the standard fashion
# for Tcl tests.
#
-# Copyright (c) 1992-1994 The Regents of the University of California.
-# Copyright (c) 1994-1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1992-1994 The Regents of the University of California.
+# Copyright © 1994-1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# All rights reserved.
# This file tests window manager interactions that work across platforms.
# Window manager tests that only work on a specific platform should be placed
# in unixWm.test or winWm.test.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -27,13 +27,18 @@ proc stdWindow {} {
update
}
+testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}]
+testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
+
# [raise] and [lower] may return before the window manager has completed the
# operation. The raiseDelay procedure idles for a while to give the operation
# a chance to complete.
#
proc raiseDelay {} {
- after 100; update
+ after 100;
+ update
+ update idletasks
}
# How to carry out a small delay while processing events
@@ -783,7 +788,7 @@ test wm-iconify-2.3 {Misc errors} -body {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2
-} -result {can't iconify .t2: it is an icon for .t}
+} -result {can't iconify ".t2": it is an icon for ".t"}
# test embedded window for Windows
test wm-iconify-2.4.1 {Misc errors} -constraints win -setup {
destroy .t2
@@ -793,7 +798,7 @@ test wm-iconify-2.4.1 {Misc errors} -constraints win -setup {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2 .r.f
-} -result {can't iconify .t2: the container does not support the request}
+} -result {can't iconify ".t2": the container does not support the request}
# test embedded window for other platforms
test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
destroy .t2
@@ -803,15 +808,15 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
wm iconify .t2
} -returnCodes error -cleanup {
destroy .t2 .r.f
-} -result {can't iconify .t2: it is an embedded window}
+} -result {can't iconify ".t2": it is an embedded window}
-test wm-iconify-3.1 {iconify behavior} -body {
+test wm-iconify-3.1 {iconify behavior} -constraints failsOnUbuntu -body {
toplevel .t2
wm geom .t2 -0+0
- update
+ update idletasks
set result [winfo ismapped .t2]
wm iconify .t2
- update
+ update idletasks
lappend result [winfo ismapped .t2]
} -cleanup {
destroy .t2
@@ -1413,7 +1418,7 @@ test wm-stackorder-2.7 {stacking order: no children returns self} -setup {
deleteWindows
-test wm-stackorder-3.1 {unmapped toplevel} -body {
+test wm-stackorder-3.1 {unmapped toplevel} -constraints failsOnUbuntu -body {
toplevel .t1 ; update
toplevel .t2 ; update
wm iconify .t1
@@ -1484,14 +1489,14 @@ test wm-stackorder-4.1 {wm stackorder isabove|isbelow} -body {
wm stackorder . isabove .t
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test wm-stackorder-4.2 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .t
wm stackorder . isbelow .t
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
@@ -1499,7 +1504,7 @@ test wm-stackorder-4.3 {wm stackorder isabove|isbelow} -body {
wm stackorder .t isa .
} -cleanup {
destroy .t
-} -result {0}
+} -result 0
test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body {
toplevel .t ; update
raise .
@@ -1507,7 +1512,7 @@ test wm-stackorder-4.4 {wm stackorder isabove|isbelow} -body {
wm stackorder .t isb .
} -cleanup {
destroy .t
-} -result {1}
+} -result 1
deleteWindows
test wm-stackorder-5.1 {a menu is not a toplevel} -body {
@@ -1523,7 +1528,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body {
destroy .t
} -result {.t .}
test wm-stackorder-5.2 {A normal toplevel can't be raised above an \
- overrideredirect toplevel on unix} -constraints x11 -body {
+ overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu failsOnXQuarz} -body {
toplevel .t
tkwait visibility .t
wm overrideredirect .t 1
@@ -1547,7 +1552,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \
destroy .t
} -result 1
test wm-stackorder-5.3 {An overrideredirect window\
- can be explicitly lowered} -body {
+ can be explicitly lowered} -constraints failsOnXQuarz -body {
toplevel .t
tkwait visibility .t
wm overrideredirect .t 1
@@ -1595,7 +1600,7 @@ test wm-title-2.1 {setting and reading values} -setup {
test wm-transient-1.1 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
wm transient .t 1 2
-} -result {wrong # args: should be "wm transient window ?master?"}
+} -result {wrong # args: should be "wm transient window ?window?"}
test wm-transient-1.2 {usage} -returnCodes error -body {
catch {destroy .t} ; toplevel .t
wm transient .t foo
@@ -1606,9 +1611,9 @@ test wm-transient-1.3 {usage} -returnCodes error -body {
} -result {bad window path name "foo"}
deleteWindows
test wm-transient-1.4 {usage} -returnCodes error -body {
- toplevel .master
+ toplevel .top
toplevel .subject
- wm transient .subject .master
+ wm transient .subject .top
wm iconify .subject
} -cleanup {
deleteWindows
@@ -1630,13 +1635,13 @@ test wm-transient-1.6 {usage} -returnCodes error -body {
wm transient .dummy .icon
} -cleanup {
deleteWindows
-} -result {can't make ".icon" a master: it is an icon for .top}
+} -result {can't make ".icon" a container: it is an icon for .top}
test wm-transient-1.7 {usage} -returnCodes error -body {
- toplevel .master
- wm transient .master .master
+ toplevel .top
+ wm transient .top .top
} -cleanup {
deleteWindows
-} -result {setting ".master" as master creates a transient/master cycle}
+} -result {can't set ".top" as container: would cause management loop}
test wm-transient-1.8 {usage} -returnCodes error -body {
toplevel .t1
toplevel .t2
@@ -1646,75 +1651,75 @@ test wm-transient-1.8 {usage} -returnCodes error -body {
wm transient .t1 .t3
} -cleanup {
deleteWindows
-} -result {setting ".t3" as master creates a transient/master cycle}
+} -result {can't set ".t3" as container: would cause management loop}
test wm-transient-1.9 {usage} -returnCodes error -body {
- toplevel .master
- frame .master.f
- wm transient .master .master.f
+ toplevel .top
+ frame .top.f
+ wm transient .top .top.f
} -cleanup {
deleteWindows
-} -result {setting ".master" as master creates a transient/master cycle}
+} -result {can't set ".top" as container: would cause management loop}
-test wm-transient-2.1 {basic get/set of master} -setup {
+test wm-transient-2.1 {basic get/set of toplevel} -setup {
set results [list]
} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
lappend results [wm transient .subject]
- wm transient .subject .master
+ wm transient .subject .top
lappend results [wm transient .subject]
wm transient .subject {}
lappend results [wm transient .subject]
} -cleanup {
deleteWindows
-} -result {{} .master {}}
-test wm-transient-2.2 {first toplevel parent of non-toplevel master is used} -body {
- toplevel .master
- frame .master.f
+} -result {{} .top {}}
+test wm-transient-2.2 {first toplevel parent of non-toplevel container window is used} -body {
+ toplevel .top
+ frame .top.f
toplevel .subject
- wm transient .subject .master.f
+ wm transient .subject .top.f
wm transient .subject
} -cleanup {
deleteWindows
-} -result {.master}
+} -result {.top}
test wm-transient-3.1 {transient toplevel is withdrawn
- when mapped if master is withdrawn} -body {
- toplevel .master
- wm withdraw .master
+ when mapped if toplevel is withdrawn} -body {
+ toplevel .top
+ wm withdraw .top
update
toplevel .subject
- wm transient .subject .master
+ wm transient .subject .top
update
list [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
} -result {withdrawn 0}
test wm-transient-3.2 {already mapped transient toplevel
- takes on withdrawn state of master} -body {
- toplevel .master
- wm withdraw .master
+ takes on withdrawn state of toplevel} -body {
+ toplevel .top
+ wm withdraw .top
update
toplevel .subject
update
- wm transient .subject .master
+ wm transient .subject .top
update
list [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
} -result {withdrawn 0}
-test wm-transient-3.3 {withdraw/deiconify on the master
+test wm-transient-3.3 {withdraw/deiconify on the toplevel
also does a withdraw/deiconify on the transient} -setup {
set results [list]
} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
update
- wm transient .subject .master
- wm withdraw .master
+ wm transient .subject .top
+ wm withdraw .top
update
lappend results [wm state .subject] [winfo ismapped .subject]
- wm deiconify .master
+ wm deiconify .top
update
lappend results [wm state .subject] [winfo ismapped .subject]
} -cleanup {
@@ -1722,44 +1727,44 @@ test wm-transient-3.3 {withdraw/deiconify on the master
} -result {withdrawn 0 normal 1}
test wm-transient-4.1 {transient toplevel is withdrawn
- when mapped if master is iconic} -body {
- toplevel .master
- wm iconify .master
+ when mapped if toplevel is iconic} -constraints {failsOnUbuntu failsOnXQuarz} -body {
+ toplevel .top
+ wm iconify .top
update
toplevel .subject
- wm transient .subject .master
+ wm transient .subject .top
update
list [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
} -result {withdrawn 0}
test wm-transient-4.2 {already mapped transient toplevel
- is withdrawn if master is iconic} -body {
- toplevel .master
+ is withdrawn if toplevel is iconic} -constraints failsOnUbuntu -body {
+ toplevel .top
raiseDelay
- wm iconify .master
- update
+ wm iconify .top
+ update idletasks
toplevel .subject
- update
- wm transient .subject .master
- update
+ update idletasks
+ wm transient .subject .top
+ update idletasks
list [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
} -result {withdrawn 0}
-test wm-transient-4.3 {iconify/deiconify on the master
- does a withdraw/deiconify on the transient} -setup {
+test wm-transient-4.3 {iconify/deiconify on the toplevel
+ does a withdraw/deiconify on the transient} -constraints failsOnUbuntu -setup {
set results [list]
} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
- update
- wm transient .subject .master
- wm iconify .master
- update
+ update idletasks
+ wm transient .subject .top
+ wm iconify .top
+ update idletasks
lappend results [wm state .subject] [winfo ismapped .subject]
- wm deiconify .master
- update
+ wm deiconify .top
+ update idletasks
lappend results [wm state .subject] [winfo ismapped .subject]
} -cleanup {
deleteWindows
@@ -1769,53 +1774,53 @@ test wm-transient-5.1 {an error during transient command should not
cause the map/unmap binding to be deleted} -setup {
set results [list]
} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
update
- wm transient .subject .master
+ wm transient .subject .top
# Expect a bad window path error here
lappend results [catch {wm transient .subject .bad}]
- wm withdraw .master
+ wm withdraw .top
update
lappend results [wm state .subject]
- wm deiconify .master
+ wm deiconify .top
update
lappend results [wm state .subject]
} -cleanup {
deleteWindows
} -result {1 withdrawn normal}
-test wm-transient-5.2 {remove transient property when master
+test wm-transient-5.2 {remove transient property when toplevel
is destroyed} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
- wm transient .subject .master
+ wm transient .subject .top
update
- destroy .master
+ destroy .top
update
wm transient .subject
} -cleanup {
deleteWindows
} -result {}
test wm-transient-5.3 {remove transient property from window
- that had never been mapped when master is destroyed} -body {
- toplevel .master
+ that had never been mapped when toplevel is destroyed} -body {
+ toplevel .top
toplevel .subject
- wm transient .subject .master
- destroy .master
+ wm transient .subject .top
+ destroy .top
wm transient .subject
} -cleanup {
deleteWindows
} -result {}
test wm-transient-6.1 {a withdrawn transient does not track
- state changes in the master} -body {
- toplevel .master
+ state changes in the toplevel} -body {
+ toplevel .top
toplevel .subject
update
- wm transient .subject .master
+ wm transient .subject .top
wm withdraw .subject
- wm withdraw .master
- wm deiconify .master
+ wm withdraw .top
+ wm deiconify .top
# idle handler should not map the transient
update
wm state .subject
@@ -1823,24 +1828,24 @@ test wm-transient-6.1 {a withdrawn transient does not track
deleteWindows
} -result {withdrawn}
test wm-transient-6.2 {a withdrawn transient does not track
- state changes in the master} -setup {
+ state changes in the toplevel} -setup {
set results [list]
} -body {
- toplevel .master
+ toplevel .top
toplevel .subject
update
- wm transient .subject .master
+ wm transient .subject .top
wm withdraw .subject
- wm withdraw .master
- wm deiconify .master
+ wm withdraw .top
+ wm deiconify .top
# idle handler should not map the transient
update
lappend results [wm state .subject]
wm deiconify .subject
lappend results [wm state .subject]
- wm withdraw .master
+ wm withdraw .top
lappend results [wm state .subject]
- wm deiconify .master
+ wm deiconify .top
# idle handler should map transient
update
lappend results [wm state .subject]
@@ -1848,15 +1853,15 @@ test wm-transient-6.2 {a withdrawn transient does not track
deleteWindows
} -result {withdrawn normal withdrawn normal}
test wm-transient-6.3 {a withdrawn transient does not track
- state changes in the master} -body {
- toplevel .master
+ state changes in the toplevel} -body {
+ toplevel .top
toplevel .subject
update
# withdraw before making window a transient
wm withdraw .subject
- wm transient .subject .master
- wm withdraw .master
- wm deiconify .master
+ wm transient .subject .top
+ wm withdraw .top
+ wm deiconify .top
# idle handler should not map the transient
update
wm state .subject
@@ -1864,7 +1869,7 @@ test wm-transient-6.3 {a withdrawn transient does not track
deleteWindows
} -result {withdrawn}
-# wm-transient-7.*: See SF Tk Bug #592201 "wm transient fails with two masters"
+# wm-transient-7.*: See SF Tk Bug #592201 "wm transient fails with two toplevels"
# wm-transient-7.3 through 7.5 all caused panics on Unix in Tk 8.4b1.
# 7.1 and 7.2 added to catch (potential) future errors.
#
@@ -1878,16 +1883,16 @@ test wm-transient-7.1 {Destroying transient} -body {
} -cleanup {
deleteWindows
}
-test wm-transient-7.2 {Destroying master} -body {
- toplevel .t
+test wm-transient-7.2 {Destroying toplevel} -body {
+ toplevel .top
toplevel .transient
- wm transient .transient .t
- destroy .t
+ wm transient .transient .top
+ destroy .top
wm transient .transient
} -cleanup {
deleteWindows
} -result {}
-test wm-transient-7.3 {Reassign transient, destroy old master} -body {
+test wm-transient-7.3 {Reassign transient, destroy old toplevel} -body {
toplevel .t1
toplevel .t2
toplevel .transient
@@ -1899,7 +1904,7 @@ test wm-transient-7.3 {Reassign transient, destroy old master} -body {
} -cleanup {
deleteWindows
}
-test wm-transient-7.4 {Reassign transient, destroy new master} -body {
+test wm-transient-7.4 {Reassign transient, destroy new toplevel} -body {
toplevel .t1
toplevel .t2
toplevel .transient
@@ -1924,12 +1929,12 @@ test wm-transient-7.5 {Reassign transient, destroy transient} -body {
deleteWindows
}
-test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup {
+test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
deleteWindows
set result {}
} -body {
- # Verifies that transients stay on top of their masters, even if they were
- # made transients when those masters were withdrawn.
+ # Verifies that transients stay on top of their toplevels, even if they were
+ # made transients when those toplevels were withdrawn.
toplevel .t1; wm withdraw .t1; update
toplevel .t2; wm transient .t2 .t1; update
lappend result [winfo ismapped .t1] [winfo ismapped .t2]
@@ -2001,7 +2006,7 @@ test wm-state-2.7 {state change before map} -body {
} -cleanup {
deleteWindows
} -result {iconic}
-test wm-state-2.8 {state change after map} -body {
+test wm-state-2.8 {state change after map} -constraints failsOnUbuntu -body {
toplevel .t
update
wm state .t iconic
@@ -2009,7 +2014,7 @@ test wm-state-2.8 {state change after map} -body {
} -cleanup {
deleteWindows
} -result {iconic}
-test wm-state-2.9 {state change after map} -body {
+test wm-state-2.9 {state change after map} -constraints failsOnUbuntu -body {
toplevel .t
update
wm iconify .t
@@ -2277,7 +2282,7 @@ test wm-forget-1.1 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
toplevel .parent
update
@@ -2286,7 +2291,7 @@ test wm-forget-1.2 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
toplevel .parent
toplevel .parent.child
@@ -2295,7 +2300,7 @@ test wm-forget-1.3 "bug #2009788: forget toplevel can cause crash" -body {
winfo exists .parent.child
} -cleanup {
deleteWindows
-} -result {1}
+} -result 1
test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body {
toplevel .parent
toplevel .parent.child
@@ -2310,6 +2315,11 @@ test wm-forget-1.4 "pack into unmapped toplevel causes crash" -body {
test wm-forget-2 {bug [e9112ef96e] - [wm forget] doesn't completely} -setup {
catch {destroy .l .f.b .f}
set res {}
+ if {[tk windowingsystem] == "aqua"} {
+ proc doUpdate {} {update idletasks}
+ } else {
+ proc doUpdate {} {update}
+ }
} -body {
label .l -text "Top Dot"
frame .f
@@ -2317,16 +2327,15 @@ test wm-forget-2 {bug [e9112ef96e] - [wm forget] doesn't completely} -setup {
pack .l -side top
pack .f.b
pack .f -side bottom
- update
set res [winfo manager .f]
pack forget .f
- update
+ doUpdate
lappend res [winfo manager .f]
wm manage .f
- update
+ doUpdate
lappend res [winfo manager .f]
wm forget .f
- update
+ doUpdate
lappend res [winfo manager .f]
} -cleanup {
destroy .l .f.b .f
diff --git a/tests/xmfbox.test b/tests/xmfbox.test
index f50329c..8d6dbeb 100644
--- a/tests/xmfbox.test
+++ b/tests/xmfbox.test
@@ -5,8 +5,8 @@
# runs in a modal loop, the only way to test it sufficiently is
# to call the internal Tcl procedures in xmfbox.tcl directly.
#
-# Copyright (c) 1997 Sun Microsystems, Inc.
-# Copyright (c) 1998-1999 by Scriptics Corporation.
+# Copyright © 1997 Sun Microsystems, Inc.
+# Copyright © 1998-1999 by Scriptics Corporation.
# Contributions from Don Porter, NIST, 2002. (not subject to US copyright)
# All rights reserved.
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 271cb07..edf0587 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -632,8 +632,8 @@ $(TKTEST_EXE): $(TKTEST_OBJS) $(TK_LIB_FILE)
$(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)"
tktest-real: ${TK_STUB_LIB_FILE}
- ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \
- $(WISH_LIBS) $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE)
+ ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ $(WISH_LIBS) \
+ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} $(CC_SEARCH_FLAGS) -o $(TKTEST_EXE)
# # FIXME: This xttest rule seems to be broken in a number of ways. It should
# # use CC_SEARCH_FLAGS, it does not include the shared lib location logic from
@@ -760,8 +760,8 @@ install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE}
fi
@EXTRA_INSTALL_BINARIES@
@echo "Installing pkg-config file to $(LIB_INSTALL_DIR)/pkgconfig/"
- @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig
- @$(INSTALL_DATA) tk.pc $(LIB_INSTALL_DIR)/pkgconfig/tk.pc
+ @$(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/pkgconfig"
+ @$(INSTALL_DATA) tk.pc "$(LIB_INSTALL_DIR)/pkgconfig/tk.pc"
install-libraries: libraries
@for i in "$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)/images" \
@@ -1236,7 +1236,7 @@ tkUnixRFont.o: $(UNIX_DIR)/tkUnixRFont.c
$(CC) -c $(CC_SWITCHES) $(XFT_CFLAGS) $(UNIX_DIR)/tkUnixRFont.c
tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c tkConfig.sh
- $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
+ $(CC) -c $(CC_SWITCHES) \
$(UNIX_DIR)/tkUnixInit.c
tkUnixKey.o: $(UNIX_DIR)/tkUnixKey.c
@@ -1312,7 +1312,7 @@ tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXImage.c
tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh
- $(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
+ $(CC) -c $(CC_SWITCHES) \
$(MAC_OSX_DIR)/tkMacOSXInit.c
tkMacOSXKeyboard.o: $(MAC_OSX_DIR)/tkMacOSXKeyboard.c
@@ -1561,7 +1561,7 @@ rpm: all
#
# Target to create a proper Tk distribution from information in the
-# master source directory. DISTDIR must be defined to indicate where
+# source directory. DISTDIR must be defined to indicate where
# to put the distribution. DISTDIR must be an absolute path name.
#
@@ -1580,9 +1580,14 @@ $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure
$(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure
cd $(MAC_OSX_DIR); autoheader; touch $@
-dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros genstubs
+$(TOP_DIR)/manifest.uuid:
+ printf "git." >$(TOP_DIR)/manifest.uuid
+ git rev-parse HEAD >>$(TOP_DIR)/manifest.uuid
+
+dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure $(TOP_DIR)/doc/man.macros $(TOP_DIR)/manifest.uuid
rm -rf $(DISTDIR)
$(INSTALL_DATA_DIR) $(DISTDIR)/unix
+ $(DIST_INSTALL_DATA) $(TOP_DIR)/manifest.uuid $(DISTDIR)
$(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix
$(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix
$(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tk.spec \
diff --git a/unix/configure b/unix/configure
index dceb0a1..e942099 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4239,9 +4239,9 @@ fi
if test "$GCC" = yes; then :
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
case "${CC}" in
- *++)
+ *++|*++-*)
;;
*)
CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement"
@@ -4514,7 +4514,7 @@ fi
LD_SEARCH_FLAGS=""
;;
CYGWIN_*)
- SHLIB_CFLAGS=""
+ SHLIB_CFLAGS="-fno-common"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
DL_OBJS="tclLoadDl.o"
@@ -4897,7 +4897,7 @@ fi
fi
;;
Linux*|GNU*|NetBSD-Debian)
- SHLIB_CFLAGS="-fPIC"
+ SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
CFLAGS_OPTIMIZE="-O2"
@@ -5033,7 +5033,6 @@ fi
;;
DragonFly-*|FreeBSD-*)
# This configuration from FreeBSD Ports.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="${CC} -shared"
SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@"
SHLIB_SUFFIX=".so"
@@ -5421,7 +5420,6 @@ fi
QNX-6*)
# QNX RTP
# This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="ld -Bshareable -x"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -5765,9 +5763,12 @@ fi
AIX-*) ;;
BSD/OS*) ;;
CYGWIN_*) ;;
- IRIX*) ;;
- NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
+ HP_UX*) ;;
Darwin-*) ;;
+ IRIX*) ;;
+ Linux*|GNU*) ;;
+ NetBSD-*|OpenBSD-*) ;;
+ OSF1-V*) ;;
SCO_SV-3.2*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac
@@ -6923,7 +6924,7 @@ else
int
main ()
{
-struct passwd pwd; pwd.pw_gecos;
+struct passwd pwd; (void)pwd.pw_gecos;
;
return 0;
}
@@ -8083,8 +8084,9 @@ $as_echo "static library" >&6; }
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
+ EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -sectcreate __TEXT __credits_html Credits.html'
EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
- ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in"
+ ac_config_files="$ac_config_files Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in"
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
@@ -8118,6 +8120,7 @@ $as_echo "#define TK_FRAMEWORK 1" >>confdefs.h
EXTRA_INSTALL="install-private-headers html-tk"
EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Credits.html "$(LIB_INSTALL_DIR)/Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua = yes; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
@@ -8127,6 +8130,7 @@ $as_echo "#define TK_FRAMEWORK 1" >>confdefs.h
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) Credits.html "$(BIN_INSTALL_DIR)/../Resources"'
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
# Don't use AC_DEFINE for the following as the framework version define
@@ -8966,6 +8970,7 @@ do
case $ac_config_target in
"Tk-Info.plist") CONFIG_FILES="$CONFIG_FILES Tk-Info.plist:../macosx/Tk-Info.plist.in" ;;
"Wish-Info.plist") CONFIG_FILES="$CONFIG_FILES Wish-Info.plist:../macosx/Wish-Info.plist.in" ;;
+ "Credits.html") CONFIG_FILES="$CONFIG_FILES Credits.html:../macosx/Credits.html.in" ;;
"Tk.framework") CONFIG_COMMANDS="$CONFIG_COMMANDS Tk.framework" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;;
"tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh:../unix/tkConfig.sh.in" ;;
diff --git a/unix/configure.ac b/unix/configure.ac
index b765f13..3c3d427 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -230,7 +230,7 @@ AC_CHECK_TYPE([uintptr_t], [
AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [
AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd pwd; pwd.pw_gecos;],
+ [struct passwd pwd; (void)pwd.pw_gecos;],
tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)])
if test $tcl_cv_pwd_pw_gecos = yes; then
AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?])
@@ -617,8 +617,9 @@ if test "`uname -s`" = "Darwin" ; then
echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000'
TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist'
EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist'
+ EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -sectcreate __TEXT __credits_html Credits.html'
EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic'
- AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in])
+ AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in])
for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done
TK_YEAR="`date +%Y`"
fi
@@ -655,6 +656,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
EXTRA_INSTALL="install-private-headers html-tk"
EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html'
EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Credits.html "$(LIB_INSTALL_DIR)/Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
if test $tk_aqua = yes; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done'
@@ -664,6 +666,7 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"'
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"'
+ EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) Credits.html "$(BIN_INSTALL_DIR)/../Resources"'
fi
EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
# Don't use AC_DEFINE for the following as the framework version define
diff --git a/unix/install-sh b/unix/install-sh
index 7c34c3f..21b733a 100644..100755
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-04-20.01; # UTC
+scriptversion=2020-07-26.22; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,25 +35,21 @@ scriptversion=2011-04-20.01; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
+tab=' '
nl='
'
-IFS=" "" $nl"
+IFS=" $tab$nl"
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
-# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -68,22 +64,15 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
posix_mkdir=
# Desired mode of installed file.
mode=0755
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@@ -97,7 +86,7 @@ dir_arg=
dst_arg=
copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -120,7 +109,7 @@ Options:
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
- -S $stripprog installed files.
+ -S OPTION $stripprog installed files using OPTION.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
@@ -138,45 +127,60 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
-S) stripcmd="$stripprog $2"
- shift;;
+ shift;;
- -t) dst_arg=$2
- shift;;
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- -T) no_target_directory=true;;
+ -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
shift
done
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@@ -190,6 +194,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
done
fi
@@ -198,12 +206,21 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
@@ -219,16 +236,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -236,9 +253,9 @@ fi
for src
do
- # Protect names starting with `-'.
+ # Protect names problematic for 'test' and other utilities.
case $src in
- -*) src=./$src;;
+ -* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -260,185 +277,150 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
-
dst=$dst_arg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst;;
- esac
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
+ # If destination is a directory, append the input filename.
if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
- dst=$dstdir/`basename "$src"`
+ dstbase=`basename "$src"`
+ case $dst in
+ */) dst=$dst$dstbase;;
+ *) dst=$dst/$dstbase;;
+ esac
dstdir_status=0
else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
+ dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
+ case $dstdir in
+ */) dstdirslash=$dstdir;;
+ *) dstdirslash=$dstdir/;;
+ esac
+
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ # The $RANDOM variable is not portable (e.g., dash). Use it
+ # here however when possible just to lower collision chance.
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+ trap '
+ ret=$?
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+ exit $ret
+ ' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p'.
+ if (umask $mkdir_umask &&
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
- mkdir_mode=
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ trap '' 0;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
- # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- -*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
esac
- eval "$initialize_posix_glob"
-
oIFS=$IFS
IFS=/
- $posix_glob set -f
+ set -f
set fnord $dstdir
shift
- $posix_glob set +f
+ set +f
IFS=$oIFS
prefixes=
for d
do
- test -z "$d" && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -451,14 +433,25 @@ do
else
# Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
+ dsttmp=${dstdirslash}_inst.$$_
+ rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+ (umask $cp_umask &&
+ { test -z "$stripcmd" || {
+ # Create $dsttmp read-write so that cp doesn't create it read-only,
+ # which would cause strip to fail.
+ if test -z "$doit"; then
+ : >"$dsttmp" # No need to fork-exec 'touch'.
+ else
+ $doit touch "$dsttmp"
+ fi
+ }
+ } &&
+ $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -473,15 +466,12 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
- eval "$initialize_posix_glob" &&
- $posix_glob set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- $posix_glob set +f &&
-
+ set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -494,24 +484,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
@@ -520,9 +510,9 @@ do
done
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
-# End:
+# End: \ No newline at end of file
diff --git a/unix/installManPage b/unix/installManPage
index 935bbcd..00c6cc5 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -43,7 +43,7 @@ if test -f $ManPage ; then : ; else
echo "source manual page file must exist"
exit 1
fi
-if test -d $Dir ; then : ; else
+if test -d "$Dir" ; then : ; else
echo "target directory must exist"
exit 1
fi
@@ -99,7 +99,7 @@ SrcDir=`dirname $ManPage`
### Process Page to Create Target Pages
###
-Specials="FindPhoto FontId MeasureChar"
+Specials="DString Thread Notifier RegExp library packagens pkgMkIndex safesock FindPhoto FontId MeasureChar"
for n in $Specials; do
if [ "$Name" = "$n" ] ; then
Names="$n $Names"
@@ -109,15 +109,15 @@ done
First=""
for Target in $Names; do
Target=$Target.$Section$Suffix
- rm -f $Dir/$Target $Dir/$Target.*
+ rm -f "$Dir/$Target" "$Dir/$Target.*"
if test -z "$First" ; then
First=$Target
sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
- $ManPage > $Dir/$First
- chmod 644 $Dir/$First
- $Gzip $Dir/$First
+ $ManPage > "$Dir/$First"
+ chmod 644 "$Dir/$First"
+ $Gzip "$Dir/$First"
else
- ln $SymOrLoc$First$Gz $Dir/$Target$Gz
+ ln "$SymOrLoc$First$Gz" "$Dir/$Target$Gz"
fi
done
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 0a2920b..8ee17e1 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -966,9 +966,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
AS_IF([test "$GCC" = yes], [
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
case "${CC}" in
- *++)
+ *++|*++-*)
;;
*)
CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement"
@@ -1084,7 +1084,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LD_SEARCH_FLAGS=""
;;
CYGWIN_*)
- SHLIB_CFLAGS=""
+ SHLIB_CFLAGS="-fno-common"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
DL_OBJS="tclLoadDl.o"
@@ -1269,7 +1269,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
;;
Linux*|GNU*|NetBSD-Debian)
- SHLIB_CFLAGS="-fPIC"
+ SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
CFLAGS_OPTIMIZE="-O2"
@@ -1364,7 +1364,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
;;
DragonFly-*|FreeBSD-*)
# This configuration from FreeBSD Ports.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="${CC} -shared"
SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]"
SHLIB_SUFFIX=".so"
@@ -1558,7 +1557,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
QNX-6*)
# QNX RTP
# This may work for all QNX, but it was only reported for v6.
- SHLIB_CFLAGS="-fPIC"
SHLIB_LD="ld -Bshareable -x"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
@@ -1786,9 +1784,12 @@ dnl # preprocessing tests use only CPPFLAGS.
AIX-*) ;;
BSD/OS*) ;;
CYGWIN_*) ;;
- IRIX*) ;;
- NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;;
+ HP_UX*) ;;
Darwin-*) ;;
+ IRIX*) ;;
+ Linux*|GNU*) ;;
+ NetBSD-*|OpenBSD-*) ;;
+ OSF1-V*) ;;
SCO_SV-3.2*) ;;
*) SHLIB_CFLAGS="-fPIC" ;;
esac])
@@ -2131,7 +2132,7 @@ AC_DEFUN([SC_TIME_HANDLER], [
fi
AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
- AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
+ AC_TRY_COMPILE([#include <time.h>], [struct tm tm; (void)tm.tm_gmtoff;],
tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
if test $tcl_cv_member_tm_gmtoff = yes ; then
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
@@ -2476,7 +2477,10 @@ AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
if test ["$tcl_ok"] = 1; then
AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
- AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
+ AC_TRY_RUN([[
+#include <stdlib.h>
+#include <string.h>
+int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
[tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown))
if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
tcl_ok=1
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c
index 9e6c112..db44bb7 100644
--- a/unix/tkAppInit.c
+++ b/unix/tkAppInit.c
@@ -15,6 +15,7 @@
#undef BUILD_tk
#undef STATIC_BUILD
#include "tk.h"
+#include "tkPort.h"
#ifdef TK_TEST
#ifdef __cplusplus
@@ -120,6 +121,13 @@ Tcl_AppInit(
}
Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
+#if defined(USE_CUSTOM_EXIT_PROC)
+ if (TkpWantsExitProc()) {
+ /* The cast below avoids warnings from old gcc compilers. */
+ Tcl_SetExitProc((void *)TkpExitProc);
+ }
+#endif
+
#ifdef TK_TEST
if (Tktest_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in
index 6753fb5..d4150a0 100644
--- a/unix/tkConfig.h.in
+++ b/unix/tkConfig.h.in
@@ -4,6 +4,9 @@
#ifndef _TKCONFIG
#define _TKCONFIG
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
#undef HAVE_AVAILABILITYMACROS_H
@@ -37,15 +40,12 @@
/* Define to 1 if you have the `open64' function. */
#undef HAVE_OPEN64
-/* Define to 1 if you have the `pthread_atfork' function. */
-#undef HAVE_PTHREAD_ATFORK
-
-/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
-#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
-
/* Does struct password have a pw_gecos field? */
#undef HAVE_PW_GECOS
+/* Do we have <stdbool.h>? */
+#undef HAVE_STDBOOL_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -112,9 +112,6 @@
/* Do we have fd_set? */
#undef NO_FD_SET
-/* Do we have <stdlib.h>? */
-#undef NO_STDLIB_H
-
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@@ -127,6 +124,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@@ -157,7 +157,7 @@
/* What is the default extension for shared libraries? */
#undef TCL_SHLIB_EXT
-/* Are wide integers to be implemented with C 'long's? */
+/* Do 'long' and 'long long' have the same size (64-bit)? */
#undef TCL_WIDE_INT_IS_LONG
/* What type should be used to define wide integers? */
@@ -172,12 +172,17 @@
/* Are TkAqua debug messages enabled? */
#undef TK_MAC_DEBUG
-/* Do we want to use the threaded memory allocator? */
-#undef USE_THREAD_ALLOC
-
-/* Define to 1 if your processor stores words with the most significant byte
- first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
/* Are Darwin SUSv3 extensions available? */
#undef _DARWIN_C_SOURCE
@@ -200,9 +205,6 @@
/* Do we want the reentrant OS API? */
#undef _REENTRANT
-/* Do we want the thread-safe OS API? */
-#undef _THREAD_SAFE
-
/* Do we want to use the XOPEN network library? */
#undef _XOPEN_SOURCE
@@ -232,7 +234,7 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index df70cb0..633b057 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -16,7 +16,7 @@
# include <X11/extensions/scrnsaver.h>
# ifdef __APPLE__
/* Support for weak-linked libXss. */
-# define HaveXSSLibrary() (XScreenSaverQueryInfo != NULL)
+# define HaveXSSLibrary() (&XScreenSaverQueryInfo != NULL)
# else
/* Other platforms always link libXss. */
# define HaveXSSLibrary() (1)
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 8d13db7..8d293f6 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -326,10 +326,8 @@ TkpDrawCheckIndicator(
TkButton *
TkpCreateButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkButton *)ckalloc(sizeof(UnixButton));
}
@@ -807,8 +805,6 @@ TkpDisplayButton(
butPtr->borderWidth, relief);
}
if (butPtr->highlightWidth > 0) {
- GC gc;
-
if (butPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h
index fa1f120..b59f7ae 100644
--- a/unix/tkUnixDefault.h
+++ b/unix/tkUnixDefault.h
@@ -22,6 +22,7 @@
* TROUGH - Background color for troughs in scales and scrollbars.
* INDICATOR - Color for indicator when button is selected.
* DISABLED - Foreground color when widget is disabled.
+ * PLACEHOLDER_FG - Foreground color for placeholder text.
*/
#define BLACK "#000000"
@@ -33,6 +34,7 @@
#define TROUGH "#b3b3b3"
#define INDICATOR WHITE
#define DISABLED "#a3a3a3"
+#define PLACEHOLDER_FG "#b3b3b3" /* grey70 */
/*
* Defaults for labels, buttons, checkbuttons, and radiobuttons:
@@ -153,7 +155,7 @@
#define DEF_ENTRY_INSERT_WIDTH "2"
#define DEF_ENTRY_JUSTIFY "left"
#define DEF_ENTRY_PLACEHOLDER ""
-#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3"
+#define DEF_ENTRY_PLACEHOLDERFG PLACEHOLDER_FG
#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 1b7b50d..60da06b 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -705,7 +705,7 @@ TkpGetNativeFont(
if (name[0] == '-') {
if (name[1] != '*') {
- char *dash;
+ const char *dash;
dash = strchr(name + 1, '-');
if ((dash == NULL) || (isspace(UCHAR(dash[-1])))) {
@@ -1373,6 +1373,9 @@ Tk_DrawChars(
* with access to all the characters on the line for context. On X11 this
* context isn't consulted, so we just call Tk_DrawChars().
*
+ * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this
+ * function is unused (and possibly unfinished). See [7655f65ae7].
+ *
* Results:
* None.
*
@@ -1410,6 +1413,38 @@ TkpDrawCharsInContext(
rangeLength, x+widthUntilStart, y);
}
+void
+TkpDrawAngledCharsInContext(
+ 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. */
+ double x, double y, /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+ double angle) /* What angle to put text at, in degrees. */
+{
+ int widthUntilStart;
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
+
+ (void) numBytes; /*unused*/
+
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
+ TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle);
+}
+
/*
*-------------------------------------------------------------------------
*
@@ -1678,7 +1713,7 @@ InitFont(
* 1/3 the width of a capital I.
*/
- fontPtr->barHeight = fontPtr->widths['I'] / 3;
+ fontPtr->barHeight = fontPtr->widths[(unsigned char)'I'] / 3;
if (fontPtr->barHeight == 0) {
fontPtr->barHeight = 1;
}
@@ -2074,10 +2109,10 @@ FindSubFontForChar(
nameList = ListFonts(fontPtr->display, "*", &numNames);
for (i = 0; i < numNames; i++) {
- fallback = strchr(nameList[i] + 1, '-') + 1;
- strchr(fallback, '-')[0] = '\0';
- if (SeenName(fallback, &ds) == 0) {
- subFontPtr = CanUseFallback(fontPtr, fallback, ch,
+ char *fallbck = strchr(nameList[i] + 1, '-') + 1;
+ strchr(fallbck, '-')[0] = '\0';
+ if (SeenName(fallbck, &ds) == 0) {
+ subFontPtr = CanUseFallback(fontPtr, fallbck, ch,
fixSubFontPtrPtr);
if (subFontPtr != NULL) {
XFreeFontNames(nameList);
diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c
index 1a5cb7d..f774a2d 100644
--- a/unix/tkUnixKey.c
+++ b/unix/tkUnixKey.c
@@ -305,6 +305,14 @@ TkpGetKeySym(
TkKeyEvent* kePtr = (TkKeyEvent*) eventPtr;
/*
+ * X11 keycodes always lie in the inclusive range [8,255].
+ */
+
+ if (eventPtr->xkey.keycode > 0xff) {
+ return NoSymbol;
+ }
+
+ /*
* Refresh the mapping information if it's stale. This must happen before
* we do any input method processing. [Bug 3599312]
*/
@@ -360,11 +368,15 @@ TkpGetKeySym(
* alphabetic, then switch back to the unshifted keysym.
*/
+#ifndef XK_Oslash
+ /* XK_Oslash is the official name, but might not be present in older X11 headers */
+# define XK_Oslash XK_Ooblique
+#endif
if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
&& (dispPtr->lockUsage == LU_CAPS)) {
if (!(((sym >= XK_A) && (sym <= XK_Z))
|| ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
- || ((sym >= XK_Ooblique) && (sym <= XK_Thorn)))) {
+ || ((sym >= XK_Oslash) && (sym <= XK_Thorn)))) {
index &= ~1;
sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
0, index);
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 7c7ed26..a36effa 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -11,7 +11,6 @@
#include "tkUnixInt.h"
#include "tkMenu.h"
-#include "default.h"
/*
* Constants used for menu drawing.
@@ -145,10 +144,8 @@ TkpNewMenu(
void
TkpDestroyMenu(
- TkMenu *menuPtr)
+ TCL_UNUSED(TkMenu *))
{
- (void)menuPtr;
-
/*
* Nothing to do.
*/
@@ -173,10 +170,8 @@ TkpDestroyMenu(
void
TkpDestroyMenuEntry(
- TkMenuEntry *mEntryPtr)
+ TCL_UNUSED(TkMenuEntry *))
{
- (void)mEntryPtr;
-
/*
* Nothing to do.
*/
@@ -243,10 +238,8 @@ TkpConfigureMenuEntry(
int
TkpMenuNewEntry(
- TkMenuEntry *mePtr)
+ TCL_UNUSED(TkMenuEntry *))
{
- (void)mePtr;
-
return TCL_OK;
}
@@ -298,14 +291,10 @@ TkpSetWindowMenuBar(
void
TkpSetMainMenubar(
- Tcl_Interp *interp,
- Tk_Window tkwin,
- const char *menuName)
+ TCL_UNUSED(Tcl_Interp *),
+ TCL_UNUSED(Tk_Window),
+ TCL_UNUSED(const char *))
{
- (void)interp;
- (void)tkwin;
- (void)menuName;
-
/*
* Nothing to do.
*/
@@ -333,14 +322,12 @@ static void
GetMenuIndicatorGeometry(
TkMenu *menuPtr, /* The menu we are drawing. */
TkMenuEntry *mePtr, /* The entry we are interested in. */
- Tk_Font tkfont, /* The precalculated font */
- const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
int borderWidth;
- (void)tkfont;
- (void)fmPtr;
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
@@ -535,7 +522,7 @@ DrawMenuEntryAccelerator(
if (menuPtr->menuType == MENUBAR) {
left += 5;
}
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
mePtr->accelLength, left,
(y + (height + fmPtr->ascent - fmPtr->descent) / 2));
}
@@ -565,17 +552,13 @@ DrawMenuEntryIndicator(
Tk_3DBorder border, /* The background color */
XColor *indicatorColor, /* The color to draw indicators with */
XColor *disableColor, /* The color use use when disabled */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */
int x, /* The left of the entry rect */
int y, /* The top of the entry rect */
- int width, /* Width of menu entry */
+ TCL_UNUSED(int), /* Width of menu entry */
int height) /* Height of menu entry */
{
- (void)tkfont;
- (void)fmPtr;
- (void)width;
-
/*
* Draw check-button indicator.
*/
@@ -638,21 +621,16 @@ DrawMenuEntryIndicator(
static void
DrawMenuSeparator(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
Drawable d, /* The drawable we are using */
- GC gc, /* The gc to draw into */
- Tk_Font tkfont, /* The font to draw with */
- const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
+ TCL_UNUSED(GC), /* The gc to draw into */
+ TCL_UNUSED(Tk_Font), /* The font to draw with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */
int x, int y,
int width, int height)
{
XPoint points[2];
Tk_3DBorder border;
- (void)mePtr;
- (void)gc;
- (void)tkfont;
- (void)fmPtr;
-
if (menuPtr->menuType == MENUBAR) {
return;
}
@@ -871,10 +849,8 @@ DrawMenuUnderline(
Tk_Font tkfont, /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
int x, int y,
- int width, int height)
+ TCL_UNUSED(int), int height)
{
- (void)width;
-
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
@@ -952,14 +928,13 @@ TkpPostMenu(
int
TkpPostTearoffMenu(
- Tcl_Interp *dummy, /* The interpreter of the menu */
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */
TkMenu *menuPtr, /* The menu we are posting */
int x, int y, int index) /* The root X,Y coordinates where the
* specified entry will be posted */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- (void)dummy;
if (index >= (int)menuPtr->numEntries) {
index = menuPtr->numEntries - 1;
@@ -1043,17 +1018,13 @@ TkpPostTearoffMenu(
static void
GetMenuSeparatorGeometry(
- TkMenu *menuPtr, /* The menu we are measuring */
- TkMenuEntry *mePtr, /* The entry we are measuring */
- Tk_Font tkfont, /* The precalculated font */
+ TCL_UNUSED(TkMenu *), /* The menu we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
+ TCL_UNUSED(Tk_Font), /* The precalculated font */
const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
int *widthPtr, /* The resulting width */
int *heightPtr) /* The resulting height */
{
- (void)menuPtr;
- (void)mePtr;
- (void)tkfont;
-
*widthPtr = 0;
*heightPtr = fmPtr->linespace;
}
@@ -1077,15 +1048,13 @@ GetMenuSeparatorGeometry(
static void
GetTearoffEntryGeometry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are measuring */
+ TCL_UNUSED(TkMenuEntry *), /* 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 */
{
- (void)mePtr;
-
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
*heightPtr = 0;
*widthPtr = 0;
} else {
@@ -1120,15 +1089,13 @@ TkpComputeMenubarGeometry(
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int width, height, i, j, x, y, currentRowHeight, maxWidth;
int maxWindowWidth, lastRowBreak, lastEntry;
- int borderWidth, activeBorderWidth, helpMenuIndex = -1;
+ int activeBorderWidth, helpMenuIndex = -1;
TkMenuEntry *mePtr;
if (menuPtr->tkwin == NULL) {
return;
}
- Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
- &borderWidth);
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
&activeBorderWidth);
maxWidth = 0;
@@ -1150,7 +1117,7 @@ TkpComputeMenubarGeometry(
/*
* 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 measureing and drawing routines.
+ * and pass them down to all of the measuring and drawing routines.
* We will measure the font metrics of the menu once, and if an entry
* has a font set, we will measure it as we come to it, and then we
* decide which set to give the geometry routines.
@@ -1297,23 +1264,19 @@ TkpComputeMenubarGeometry(
static void
DrawTearoffEntry(
TkMenu *menuPtr, /* The menu we are drawing */
- TkMenuEntry *mePtr, /* The entry we are drawing */
+ TCL_UNUSED(TkMenuEntry *), /* 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 */
+ TCL_UNUSED(GC), /* The gc we are drawing with */
+ TCL_UNUSED(Tk_Font), /* The font we are drawing with */
+ TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */
int x, int y,
int width, int height)
{
XPoint points[2];
int segmentWidth, maxX;
Tk_3DBorder border;
- (void)mePtr;
- (void)gc;
- (void)tkfont;
- (void)fmPtr;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
return;
}
@@ -1356,13 +1319,10 @@ DrawTearoffEntry(
void
TkpInitializeMenuBindings(
- Tcl_Interp *interp, /* The interpreter to set. */
- Tk_BindingTable bindingTable)
+ TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */
+ TCL_UNUSED(Tk_BindingTable))
/* The table to add to. */
{
- (void)interp;
- (void)bindingTable;
-
/*
* Nothing to do.
*/
@@ -1408,16 +1368,16 @@ SetHelpMenu(
cascadeEntryPtr != NULL;
cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
if ((cascadeEntryPtr->menuPtr->menuType == MENUBAR)
- && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL)
- && (menuPtr->masterMenuPtr->tkwin != NULL)) {
- TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
+ && (cascadeEntryPtr->menuPtr->mainMenuPtr->tkwin != NULL)
+ && (menuPtr->mainMenuPtr->tkwin != NULL)) {
+ TkMenu *mainMenuPtr = cascadeEntryPtr->menuPtr->mainMenuPtr;
char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName(
- masterMenuPtr->tkwin)) + strlen(".help") + 1);
+ mainMenuPtr->tkwin)) + strlen(".help") + 1);
- strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin));
+ strcpy(helpMenuName, Tk_PathName(mainMenuPtr->tkwin));
strcat(helpMenuName, ".help");
if (strcmp(helpMenuName,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin)) == 0) {
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin)) == 0) {
cascadeEntryPtr->entryFlags |= ENTRY_HELP_MENU;
} else {
cascadeEntryPtr->entryFlags &= ~ENTRY_HELP_MENU;
@@ -1887,12 +1847,9 @@ TkpComputeStandardMenuGeometry(
void
TkpMenuNotifyToplevelCreate(
- Tcl_Interp *dummy, /* The interp the menu lives in. */
- const char *menuName) /* The name of the menu to reconfigure. */
+ TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
+ TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */
{
- (void)dummy;
- (void)menuName;
-
/*
* Nothing to do.
*/
diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c
index 407dc30..062d18e 100644
--- a/unix/tkUnixMenubu.c
+++ b/unix/tkUnixMenubu.c
@@ -25,17 +25,15 @@
* Returns a newly allocated TkMenuButton structure.
*
* Side effects:
- * Registers an event handler for the widget.
+ * None
*
*----------------------------------------------------------------------
*/
TkMenuButton *
TkpCreateMenuButton(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkMenuButton *)ckalloc(sizeof(TkMenuButton));
}
@@ -282,8 +280,6 @@ TkpDisplayMenuButton(
mbPtr->borderWidth, mbPtr->relief);
}
if (mbPtr->highlightWidth != 0) {
- GC gc;
-
if (mbPtr->flags & GOT_FOCUS) {
gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap);
} else {
diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h
index 347c9d8..7aca5d6 100644
--- a/unix/tkUnixPort.h
+++ b/unix/tkUnixPort.h
@@ -173,4 +173,10 @@
sprintf((buf), "%#08lx", (unsigned long) (w))
#endif
+/*
+ * Used by tkWindow.c
+ */
+
+#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event)
+
#endif /* _UNIXPORT */
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index c154f96..41ba938 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -208,7 +208,7 @@ GetTkFontAttributes(
slant = XFT_SLANT_ROMAN;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("family %s size %d weight %d slant %d\n",
family, (int)size, weight, slant);
#endif /* DEBUG_FONTSEL */
@@ -453,7 +453,7 @@ TkpGetNativeFont(
{
UnixFtFont *fontPtr;
FcPattern *pattern;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetNativeFont %s\n", name);
#endif /* DEBUG_FONTSEL */
@@ -491,7 +491,7 @@ TkpGetFontFromAttributes(
int weight, slant;
UnixFtFont *fontPtr;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("TkpGetFontFromAttributes %s-%d %d %d\n", faPtr->family,
faPtr->size, faPtr->weight, faPtr->slant);
#endif /* DEBUG_FONTSEL */
@@ -671,7 +671,7 @@ TkpGetSubFonts(
void
TkpGetFontAttrsForChar(
- Tk_Window tkwin, /* Window on the font's display */
+ TCL_UNUSED(Tk_Window), /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
@@ -682,7 +682,6 @@ TkpGetFontAttrsForChar(
/* UCS-4 character to map */
XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0);
/* Actual font used to render the character */
- (void)tkwin;
GetTkFontAttributes(ftFont, faPtr);
faPtr->underline = fontPtr->font.fa.underline;
@@ -719,7 +718,7 @@ Tk_MeasureChars(
int clen, curX, newX, curByte, newByte, sawNonSpace;
int termByte = 0, termX = 0, errorFlag = 0;
Tk_ErrorHandler handler;
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
char string[256];
int len = 0;
#endif /* DEBUG_FONTSEL */
@@ -756,7 +755,7 @@ Tk_MeasureChars(
sawNonSpace = 1;
}
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len++] = (char) c;
#endif /* DEBUG_FONTSEL */
ftFont = GetFont(fontPtr, c, 0.0);
@@ -796,7 +795,7 @@ Tk_MeasureChars(
curByte = newByte;
}
Tk_DeleteErrorHandler(handler);
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
string[len] = '\0';
printf("MeasureChars %s length %d bytes %d\n", string, curX, curByte);
#endif /* DEBUG_FONTSEL */
@@ -936,7 +935,7 @@ Tk_DrawChars(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1071,7 +1070,7 @@ TkDrawAngledChars(
int originX, originY;
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1180,7 +1179,7 @@ TkDrawAngledChars(
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
if (fontPtr->ftDraw == 0) {
-#if DEBUG_FONTSEL
+#ifdef DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
@@ -1306,6 +1305,89 @@ TkDrawAngledChars(
}
}
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDrawCharsInContext --
+ *
+ * Draw a string of characters on the screen like Tk_DrawChars(), but
+ * with access to all the characters on the line for context. On X11 this
+ * context isn't consulted, so we just call Tk_DrawChars().
+ *
+ * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this
+ * function is unused (and possibly unfinished). See [7655f65ae7].
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+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. */
+{
+ int widthUntilStart;
+
+ (void) numBytes; /*unused*/
+
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
+ Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x+widthUntilStart, y);
+}
+
+void
+TkpDrawAngledCharsInContext(
+ 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. */
+ double x, double y, /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+ double angle) /* What angle to put text at, in degrees. */
+{
+ int widthUntilStart;
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
+
+ (void) numBytes; /*unused*/
+
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
+ TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle);
+}
+
void
TkUnixSetXftClipRegion(
Region clipRegion) /* The clipping region to install. */
diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c
index b090c4f..a603432 100644
--- a/unix/tkUnixScale.c
+++ b/unix/tkUnixScale.c
@@ -50,10 +50,8 @@ static void DisplayVerticalValue(TkScale *scalePtr,
TkScale *
TkpCreateScale(
- Tk_Window tkwin)
+ TCL_UNUSED(Tk_Window))
{
- (void)tkwin;
-
return (TkScale *)ckalloc(sizeof(TkScale));
}
@@ -577,7 +575,7 @@ TkpDisplayScale(
Tcl_DStringAppend(&buf, scalePtr->command, -1);
Tcl_DStringAppend(&buf, " ", -1);
Tcl_DStringAppend(&buf, string, -1);
- result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0);
+ result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL);
Tcl_DStringFree(&buf);
if (result != TCL_OK) {
Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 58c3abc..527bc4c 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -545,7 +545,6 @@ TkSelEventProc(
Atom type;
int format, result;
unsigned long numItems, bytesAfter;
- Tcl_DString ds;
for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) {
if (retrPtr == NULL) {
@@ -591,6 +590,7 @@ TkSelEventProc(
if ((type == XA_STRING) || (type == dispPtr->textAtom)
|| (type == dispPtr->compoundTextAtom)) {
Tcl_Encoding encoding;
+ Tcl_DString ds;
if (format != 8) {
Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf(
@@ -1522,15 +1522,12 @@ static void
SelCvtFromX8(
char *propPtr, /* Property value from X. */
int numValues, /* Number of 8-bit values in property. */
- Atom type, /* Type of property Should not be XA_STRING
+ TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING
* (if so, don't bother calling this function
* at all). */
- Tk_Window tkwin, /* Window to use for atom conversion. */
+ TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */
Tcl_DString *dsPtr) /* Where to store the converted string. */
{
- (void)type;
- (void)tkwin;
-
/*
* Convert each long in the property to a string value, which is a
* hexadecimal string. We build the list in a Tcl_DString because this is
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 6cf711c..92fd8bb 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -943,7 +943,7 @@ Tk_SetAppName(
int
Tk_SendObjCmd(
- ClientData dummy, /* Information about sender (only dispPtr
+ TCL_UNUSED(void *), /* Information about sender (only dispPtr
* field is used). */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -971,7 +971,6 @@ Tk_SendObjCmd(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_Interp *localInterp; /* Used when the interpreter to send the
* command to is within the same process. */
- (void)dummy;
/*
* Process options, if any.
@@ -1357,13 +1356,12 @@ TkSendCleanup(
static int
SendInit(
- Tcl_Interp *dummy, /* Interpreter to use for error reporting (no
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting (no
* errors are ever returned, but the
* interpreter is needed anyway). */
TkDisplay *dispPtr) /* Display to initialize. */
{
XSetWindowAttributes atts;
- (void)dummy;
/*
* Create the window used for communication, and set up an event handler
@@ -1779,13 +1777,12 @@ AppendPropCarefully(
static int
AppendErrorProc(
ClientData clientData, /* Command to mark complete, or NULL. */
- XErrorEvent *errorPtr) /* Information about error. */
+ TCL_UNUSED(XErrorEvent *)) /* Information about error. */
{
PendingCommand *pendingPtr = (PendingCommand *)clientData;
PendingCommand *pcPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)errorPtr;
if (pendingPtr == NULL) {
return 0;
@@ -1878,11 +1875,10 @@ DeleteProc(
static Tk_RestrictAction
SendRestrictProc(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
XEvent *eventPtr) /* Event that just arrived. */
{
TkDisplay *dispPtr;
- (void)dummy;
if (eventPtr->type != PropertyNotify) {
return TK_DEFER_EVENT;
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 155a988..13a599e 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -27,8 +27,8 @@ typedef struct ProtocolHandler {
/* 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[1]; /* Tcl command to invoke when a client message
+ Tcl_Interp *interp; /* Interpreter in which to invoke command. */
+ char command[TKFLEXARRAY]; /* 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
@@ -82,7 +82,7 @@ typedef struct TkWmInfo {
* (corresponds to hints.window_group).
* Malloc-ed. Note: this field doesn't get
* updated if leader is destroyed. */
- TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property,
+ TkWindow *containerPtr; /* Container window for TRANSIENT_FOR property,
* or NULL. */
Tk_Window icon; /* Window to use as icon for this window, or
* NULL. */
@@ -259,7 +259,7 @@ typedef struct TkWmInfo {
* window (controlled by "wm resizable" command).
* WM_WITHDRAWN - non-zero means that this window has explicitly
* been withdrawn. If it's a transient, it should
- * not mirror state changes in the master.
+ * not mirror state changes in the container.
*/
#define WM_NEVER_MAPPED 1
@@ -312,12 +312,12 @@ static void MenubarReqProc(ClientData clientData,
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
static const Tk_GeomMgr menubarMgrType = {
"menubar", /* name */
MenubarReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
/*
@@ -571,7 +571,7 @@ TkWmNewWindow(
memset(wmPtr, 0, sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
- wmPtr->masterPtr = NULL;
+ wmPtr->containerPtr = NULL;
wmPtr->numTransients = 0;
wmPtr->hints.flags = InputHint | StateHint;
wmPtr->hints.input = True;
@@ -684,12 +684,12 @@ TkWmMapWindow(
UpdateTitle(winPtr);
UpdatePhotoIcon(winPtr);
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
/*
- * Don't map a transient if the master is not mapped.
+ * Don't map a transient if the container is not mapped.
*/
- if (!Tk_IsMapped(wmPtr->masterPtr)) {
+ if (!Tk_IsMapped(wmPtr->containerPtr)) {
wmPtr->withdrawn = 1;
wmPtr->hints.initial_state = WithdrawnState;
}
@@ -700,7 +700,7 @@ TkWmMapWindow(
*/
XSetTransientForHint(winPtr->display, wmPtr->wrapperPtr->window,
- wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
+ wmPtr->containerPtr->wmInfoPtr->wrapperPtr->window);
}
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
@@ -909,16 +909,16 @@ TkWmDeadWindow(
}
/*
- * Reset all transient windows whose master is the dead window.
+ * Reset all transient windows whose container is the dead window.
*/
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr) {
+ if (wmPtr2->containerPtr == winPtr) {
wmPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
+ Tk_DeleteEventHandler((Tk_Window) wmPtr2->containerPtr,
StructureNotifyMask, WmWaitMapProc, wmPtr2->winPtr);
- wmPtr2->masterPtr = NULL;
+ wmPtr2->containerPtr = NULL;
if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr, "WM_TRANSIENT_FOR"));
@@ -933,19 +933,19 @@ TkWmDeadWindow(
}
/* ASSERT: numTransients == 0 [Bug 1789819] */
- if (wmPtr->masterPtr != NULL) {
- wmPtr2 = wmPtr->masterPtr->wmInfoPtr;
+ if (wmPtr->containerPtr != NULL) {
+ wmPtr2 = wmPtr->containerPtr->wmInfoPtr;
/*
- * If we had a master, tell them that we aren't tied to them anymore
+ * If we had a container, tell them that we aren't tied to them anymore
*/
if (wmPtr2 != NULL) {
wmPtr2->numTransients--;
}
- Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
+ Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr,
StructureNotifyMask, WmWaitMapProc, winPtr);
- wmPtr->masterPtr = NULL;
+ wmPtr->containerPtr = NULL;
}
ckfree(wmPtr);
winPtr->wmInfoPtr = NULL;
@@ -1181,7 +1181,7 @@ Tk_WmObjCmd(
static int
WmAspectCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1189,7 +1189,6 @@ WmAspectCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int numer1, denom1, numer2, denom2;
- (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1384,14 +1383,13 @@ WmGetAttribute(
static int
WmAttributesCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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;
- (void)tkwin;
if (objc == 3) { /* wm attributes $win */
Tcl_Obj *result = Tcl_NewListObj(0,0);
@@ -1449,7 +1447,7 @@ WmAttributesCmd(
static int
WmClientCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1457,7 +1455,6 @@ WmClientCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1636,7 +1633,7 @@ WmColormapwindowsCmd(
static int
WmCommandCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1646,7 +1643,6 @@ WmCommandCmd(
const char *argv3;
int cmdArgc;
const char **cmdArgv;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
@@ -1706,14 +1702,13 @@ WmCommandCmd(
static int
WmDeiconifyCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -1757,7 +1752,7 @@ WmDeiconifyCmd(
static int
WmFocusmodelCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1769,7 +1764,6 @@ WmFocusmodelCmd(
enum options {
OPT_ACTIVE, OPT_PASSIVE };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?");
@@ -1813,17 +1807,13 @@ WmFocusmodelCmd(
static int
WmForgetCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
- (void)tkwin;
- (void)interp;
- (void)objc;
- (void)objv;
if (Tk_IsTopLevel(frameWin)) {
TkFocusJoin(winPtr);
@@ -1870,7 +1860,7 @@ WmForgetCmd(
static int
WmFrameCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1879,7 +1869,6 @@ WmFrameCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
Window window;
char buf[TCL_INTEGER_SPACE];
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -1913,7 +1902,7 @@ WmFrameCmd(
static int
WmGeometryCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1923,7 +1912,6 @@ WmGeometryCmd(
char xSign, ySign;
int width, height;
const char *argv3;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
@@ -1974,7 +1962,7 @@ WmGeometryCmd(
static int
WmGridCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -1982,7 +1970,6 @@ WmGridCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int reqWidth, reqHeight, widthInc, heightInc;
- (void)tkwin;
if ((objc != 3) && (objc != 7)) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2149,7 +2136,7 @@ WmGroupCmd(
static int
WmIconbitmapCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2158,7 +2145,6 @@ WmIconbitmapCmd(
WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
const char *argv3;
- (void)tkwin;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -2210,14 +2196,13 @@ WmIconbitmapCmd(
static int
WmIconifyCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -2231,7 +2216,7 @@ WmIconifyCmd(
NULL);
return TCL_ERROR;
}
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient",
winPtr->pathName));
@@ -2240,14 +2225,14 @@ WmIconifyCmd(
}
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
}
if (winPtr->flags & TK_EMBEDDED) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an embedded window",
+ "can't iconify \"%s\": it is an embedded window",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -2339,7 +2324,7 @@ WmIconmaskCmd(
static int
WmIconnameCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2347,7 +2332,6 @@ WmIconnameCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -2391,7 +2375,7 @@ WmIconnameCmd(
static int
WmIconphotoCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2402,7 +2386,6 @@ WmIconphotoCmd(
Tk_PhotoImageBlock block;
int i, size = 0, width, height, index = 0, x, y, isDefault = 0;
unsigned long *iconPropertyData;
- (void)tkwin;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2542,7 +2525,7 @@ WmIconphotoCmd(
static int
WmIconpositionCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2550,7 +2533,6 @@ WmIconpositionCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?");
@@ -2617,7 +2599,7 @@ WmIconwindowCmd(
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -2720,17 +2702,14 @@ WmIconwindowCmd(
static int
WmManageCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
- (void)objc;
- (void)objv;
if (!Tk_IsTopLevel(frameWin)) {
if (!Tk_IsManageable(frameWin)) {
@@ -2785,7 +2764,7 @@ WmManageCmd(
static int
WmMaxsizeCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2793,7 +2772,6 @@ WmMaxsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -2845,7 +2823,7 @@ WmMaxsizeCmd(
static int
WmMinsizeCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2853,7 +2831,6 @@ WmMinsizeCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -2897,7 +2874,7 @@ WmMinsizeCmd(
static int
WmOverrideredirectCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2905,7 +2882,6 @@ WmOverrideredirectCmd(
{
int boolean, curValue;
XSetWindowAttributes atts;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
@@ -2956,7 +2932,7 @@ WmOverrideredirectCmd(
static int
WmPositionfromCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -2968,7 +2944,6 @@ WmPositionfromCmd(
enum options {
OPT_PROGRAM, OPT_USER };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?");
@@ -3024,7 +2999,7 @@ WmPositionfromCmd(
static int
WmProtocolCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3035,7 +3010,6 @@ WmProtocolCmd(
Atom protocol;
const char *cmd;
TkSizeT cmdLength;
- (void)tkwin;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
@@ -3135,7 +3109,7 @@ WmProtocolCmd(
static int
WmResizableCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3143,7 +3117,6 @@ WmResizableCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int width, height;
- (void)tkwin;
if ((objc != 3) && (objc != 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
@@ -3195,7 +3168,7 @@ WmResizableCmd(
static int
WmSizefromCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3207,7 +3180,6 @@ WmSizefromCmd(
enum options {
OPT_PROGRAM, OPT_USER };
int index;
- (void)tkwin;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?");
@@ -3388,7 +3360,7 @@ WmStackorderCmd(
static int
WmStateCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3400,7 +3372,6 @@ WmStateCmd(
enum options {
OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN };
int index;
- (void)tkwin;
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?state?");
@@ -3432,7 +3403,7 @@ WmStateCmd(
"OVERRIDE_REDIRECT", NULL);
return TCL_ERROR;
}
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient",
winPtr->pathName));
@@ -3495,7 +3466,7 @@ WmStateCmd(
static int
WmTitleCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -3503,7 +3474,6 @@ WmTitleCmd(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- (void)tkwin;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -3556,28 +3526,28 @@ WmTransientCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- TkWindow *masterPtr = wmPtr->masterPtr, *w;
+ TkWindow *containerPtr = wmPtr->containerPtr, *w;
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
- if (masterPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr));
+ if (containerPtr != NULL) {
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) containerPtr));
}
return TCL_OK;
}
if (Tcl_GetString(objv[3])[0] == '\0') {
- if (masterPtr != NULL) {
+ if (containerPtr != NULL) {
/*
- * If we had a master, tell them that we aren't tied to them
+ * If we had a container, tell them that we aren't tied to them
* anymore
*/
- masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) masterPtr, StructureNotifyMask,
+ containerPtr->wmInfoPtr->numTransients--;
+ Tk_DeleteEventHandler((Tk_Window) containerPtr, StructureNotifyMask,
WmWaitMapProc, winPtr);
/*
@@ -3587,22 +3557,22 @@ WmTransientCmd(
*/
}
- wmPtr->masterPtr = NULL;
+ wmPtr->containerPtr = NULL;
} else {
- Tk_Window masterWin;
+ Tk_Window container;
- if (TkGetWindowFromObj(interp, tkwin, objv[3], &masterWin)!=TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &container)!=TCL_OK) {
return TCL_ERROR;
}
- masterPtr = (TkWindow *) masterWin;
- while (!Tk_TopWinHierarchy(masterPtr)) {
+ containerPtr = (TkWindow *) container;
+ while (!Tk_TopWinHierarchy(containerPtr)) {
/*
- * Ensure that the master window is actually a Tk toplevel.
+ * Ensure that the container window is actually a Tk toplevel.
*/
- masterPtr = masterPtr->parentPtr;
+ containerPtr = containerPtr->parentPtr;
}
- Tk_MakeWindowExist((Tk_Window) masterPtr);
+ Tk_MakeWindowExist((Tk_Window) containerPtr);
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -3612,52 +3582,52 @@ WmTransientCmd(
return TCL_ERROR;
}
- wmPtr2 = masterPtr->wmInfoPtr;
+ wmPtr2 = containerPtr->wmInfoPtr;
if (wmPtr2->wrapperPtr == NULL) {
CreateWrapper(wmPtr2);
}
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
}
- for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->masterPtr) {
+ for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
+ w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
- Tk_PathName(masterPtr)));
+ "can't set \"%s\" as container: would cause management loop",
+ Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
}
}
- if (masterPtr != wmPtr->masterPtr) {
+ if (containerPtr != wmPtr->containerPtr) {
/*
- * Remove old master map/unmap binding before setting the new
- * master. The event handler will ensure that transient states
- * reflect the state of the master.
+ * Remove old container map/unmap binding before setting the new
+ * container. The event handler will ensure that transient states
+ * reflect the state of the container.
*/
- if (wmPtr->masterPtr != NULL) {
- wmPtr->masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
+ if (wmPtr->containerPtr != NULL) {
+ wmPtr->containerPtr->wmInfoPtr->numTransients--;
+ Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr,
StructureNotifyMask, WmWaitMapProc, winPtr);
}
- masterPtr->wmInfoPtr->numTransients++;
- Tk_CreateEventHandler((Tk_Window) masterPtr,
+ containerPtr->wmInfoPtr->numTransients++;
+ Tk_CreateEventHandler((Tk_Window) containerPtr,
StructureNotifyMask, WmWaitMapProc, winPtr);
- wmPtr->masterPtr = masterPtr;
+ wmPtr->containerPtr = containerPtr;
}
}
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
- if (wmPtr->masterPtr != NULL && !Tk_IsMapped(wmPtr->masterPtr)) {
+ if (wmPtr->containerPtr != NULL && !Tk_IsMapped(wmPtr->containerPtr)) {
if (TkpWmSetState(winPtr, WithdrawnState) == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"couldn't send withdraw message to window manager",
@@ -3666,10 +3636,10 @@ WmTransientCmd(
return TCL_ERROR;
}
} else {
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
XSetTransientForHint(winPtr->display,
wmPtr->wrapperPtr->window,
- wmPtr->masterPtr->wmInfoPtr->wrapperPtr->window);
+ wmPtr->containerPtr->wmInfoPtr->wrapperPtr->window);
} else {
XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window,
Tk_InternAtom((Tk_Window) winPtr,"WM_TRANSIENT_FOR"));
@@ -3698,14 +3668,13 @@ WmTransientCmd(
static int
WmWithdrawCmd(
- Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(Tk_Window), /* 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. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)tkwin;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
@@ -3746,7 +3715,7 @@ WmUpdateGeom(
/*
* Invoked when a MapNotify or UnmapNotify event is delivered for a toplevel
- * that is the master of a transient toplevel.
+ * that is the container of a transient toplevel.
*/
static void
@@ -3755,9 +3724,9 @@ WmWaitMapProc(
XEvent *eventPtr) /* Information about event. */
{
TkWindow *winPtr = (TkWindow *)clientData;
- TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr;
+ TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr;
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
return;
}
@@ -4525,12 +4494,11 @@ WrapperEventProc(
static void
TopLevelReqProc(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
WmInfo *wmPtr = winPtr->wmInfoPtr;
- (void)dummy;
if (wmPtr == NULL) {
return;
diff --git a/win/Makefile.in b/win/Makefile.in
index 82baeb2..c4744f1 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -71,11 +71,8 @@ MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
# Directory in which to install manual entries for the built-in Tk commands:
MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
-# Libraries built with optimization switches have this additional extension
-TK_DBGX = @TK_DBGX@
-
# Directory in which to install the pkgIndex.tcl file for loadable Tk
-PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)$(TK_DBGX)
+PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)
# Package index file for loadable Tk
PKG_INDEX = $(PKG_INSTALL_DIR)/pkgIndex.tcl
@@ -129,20 +126,22 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
DLLSUFFIX = @DLLSUFFIX@
LIBSUFFIX = @LIBSUFFIX@
EXESUFFIX = @EXESUFFIX@
+VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
+DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_LIB_FILE = @TK_LIB_FILE@
TK_DLL_FILE = @TK_DLL_FILE@
TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX}
-TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${LIBSUFFIX}
+TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX}
SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
STATIC_LIBRARIES = $(TK_LIB_FILE)
WISH = wish$(VER)${EXESUFFIX}
-TKTEST = tktest${EXEEXT}
-CAT32 = cat32$(EXEEXT)
-MAN2TCL = man2tcl$(EXEEXT)
+TKTEST = tktest${EXESUFFIX}
+CAT32 = cat32${EXESUFFIX}
+MAN2TCL = man2tcl${EXESUFFIX}
@SET_MAKE@
@@ -168,7 +167,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
#CFLAGS = $(CFLAGS_DEBUG)
#CFLAGS = $(CFLAGS_OPTIMIZE)
#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
-CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING
+CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0
# Special compiler flags to use when building man2tcl on Windows.
MAN2TCLFLAGS = @MAN2TCLFLAGS@
@@ -184,15 +183,12 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@
LDFLAGS_CONSOLE = @LDFLAGS_CONSOLE@
LDFLAGS_WINDOW = @LDFLAGS_WINDOW@
-EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
STLIB_LD = @STLIB_LD@
SHLIB_LD = @SHLIB_LD@
SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
-VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
-DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@
RMDIR = rm -rf
MKDIR = mkdir -p
@@ -710,7 +706,7 @@ tkWindow.$(OBJEXT): configure Makefile
depend:
cleanhelp:
- $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl${EXEEXT}
+ $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe
clean: cleanhelp
$(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out
diff --git a/win/configure b/win/configure
index 0b4ea50..c7c59ef 100755
--- a/win/configure
+++ b/win/configure
@@ -664,7 +664,6 @@ EXTRA_CFLAGS
CFG_TK_EXPORT_FILE_SUFFIX
CFG_TK_UNSHARED_LIB_SUFFIX
CFG_TK_SHARED_LIB_SUFFIX
-TCL_DBGX
TCL_PATCH_LEVEL
TCL_MINOR_VERSION
TCL_MAJOR_VERSION
@@ -675,7 +674,6 @@ TK_STUB_LIB_FLAG
TK_STUB_LIB_FILE
TK_DLL_FILE
TK_LIB_FILE
-TK_DBGX
TK_PATCH_LEVEL
TK_MINOR_VERSION
TK_MAJOR_VERSION
@@ -3821,15 +3819,6 @@ $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\""
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -4232,7 +4221,7 @@ $as_echo_n "checking compiler flags... " >&6; }
$as_echo "using static flags" >&6; }
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
@@ -4247,7 +4236,7 @@ $as_echo "using shared flags" >&6; }
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -4255,19 +4244,19 @@ $as_echo "using shared flags" >&6; }
SHLIB_LD='${CC} -shared'
SHLIB_LD_LIBS='${LIBS}'
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \
- -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\$@)"
+ -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -4350,7 +4339,7 @@ $as_echo " Using 64-bit $MACHINE mode" >&6; }
$as_echo "using static flags" >&6; }
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
@@ -4358,7 +4347,7 @@ $as_echo "using shared flags" >&6; }
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
LIBRARIES="\${SHARED_LIBRARIES}"
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[4-9]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -4370,9 +4359,9 @@ $as_echo "using shared flags" >&6; }
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.lib"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -4751,7 +4740,6 @@ fi
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
$as_echo "#define NDEBUG 1" >>confdefs.h
@@ -4763,7 +4751,6 @@ $as_echo "no" >&6; }
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5
$as_echo "yes (standard debugging)" >&6; }
@@ -4798,8 +4785,6 @@ $as_echo "enabled $tcl_ok debugging" >&6; }
fi
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
@@ -4858,7 +4843,7 @@ $as_echo "$result" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5
$as_echo_n "checking for tclsh in Tcl build directory... " >&6; }
- BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}
+ BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5
$as_echo "$BUILD_TCLSH" >&6; }
@@ -4917,7 +4902,11 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
-eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}"
+if test ${SHARED_BUILD} = 0 ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
+fi
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
@@ -4949,18 +4938,10 @@ CFG_TK_EXPORT_FILE_SUFFIX=${TK_EXPORT_FILE_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0 -o "$TCL_NEEDS_EXP_FILE" = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -5007,8 +4988,6 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`
-
-
# win/tcl.m4 doesn't set (LDFLAGS)
diff --git a/win/configure.ac b/win/configure.ac
index ca9263f..56b8813 100644
--- a/win/configure.ac
+++ b/win/configure.ac
@@ -134,8 +134,6 @@ AC_CHECK_HEADER([vssym32.h], [AC_DEFINE(HAVE_VSSYM32_H)], [],
SC_ENABLE_SYMBOLS
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
@@ -162,7 +160,11 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
-eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}"
+if test ${SHARED_BUILD} = 0 ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
+fi
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
@@ -194,18 +196,10 @@ CFG_TK_EXPORT_FILE_SUFFIX=${TK_EXPORT_FILE_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0 -o "$TCL_NEEDS_EXP_FILE" = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -226,7 +220,6 @@ AC_SUBST(TK_VERSION)
AC_SUBST(TK_MAJOR_VERSION)
AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_PATCH_LEVEL)
-AC_SUBST(TK_DBGX)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_DLL_FILE)
AC_SUBST(TK_STUB_LIB_FILE)
@@ -242,7 +235,6 @@ AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
-AC_SUBST(TCL_DBGX)
AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX)
AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX)
AC_SUBST(CFG_TK_EXPORT_FILE_SUFFIX)
diff --git a/win/makefile.vc b/win/makefile.vc
index b2d3996..56c9dea 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -58,7 +58,7 @@
# 64-bit compiler, if your SDK has it.
#
# Examples:
-# Assumign Tcl sources lie in ../../tcl
+# Assuming Tcl sources lie in ../../tcl
# c:\tcl_src\win\>nmake -f makefile.vc release
# If Tcl sources are not in ../../tcl, use the TCLDIR macro to specify dir
# c:\tcl_src\win\>nmake -f makefile.vc release TCLDIR=c:\src\tcl
@@ -66,7 +66,7 @@
# c:\tcl_src\win\>nmake -f makefile.vc test
# Install Tk in location specified by INSTALLDIR macro
# c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
-# Build release with PDF files
+# Build release with PDB files
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs
# Build debug version
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols
diff --git a/win/rules.vc b/win/rules.vc
index 490f9c3..f3e5439 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -415,9 +415,6 @@ _INSTALLDIR=$(_INSTALLDIR)\lib
# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
# MACHINE - same as $(ARCH) - legacy
# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
-# CFG_ENCODING - set to an character encoding.
-# TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't
-# see where it is used
cc32 = $(CC) # built-in default.
link32 = link
@@ -503,10 +500,6 @@ _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -ou
_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
!endif
-!ifndef CFG_ENCODING
-CFG_ENCODING = \"cp1252\"
-!endif
-
################################################################
# 4. Build the nmakehlp program
# This is a helper app we need to overcome nmake's limiting
@@ -514,7 +507,7 @@ CFG_ENCODING = \"cp1252\"
# information about supported compiler options etc.
#
# Tcl itself will always use the nmakehlp.c program which is
-# in its own source. This is the "master" copy and kept updated.
+# in its own source. It will be kept updated there.
#
# Extensions built against an installed Tcl will use the installed
# copy of Tcl's nmakehlp.c if there is one and their own version
@@ -730,11 +723,8 @@ MSVCRT = 0
!else
!if [nmakehlp -f $(OPTS) "msvcrt"]
!message *** Doing msvcrt
-MSVCRT = 1
-!else
-!if !$(STATIC_BUILD)
-MSVCRT = 1
!else
+!if $(STATIC_BUILD)
MSVCRT = 0
!endif
!endif
@@ -743,17 +733,12 @@ MSVCRT = 0
!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
!message *** Doing staticpkg
TCL_USE_STATIC_PACKAGES = 1
-!else
-TCL_USE_STATIC_PACKAGES = 0
!endif
!if [nmakehlp -f $(OPTS) "nothreads"]
!message *** Compile explicitly for non-threaded tcl
TCL_THREADS = 0
USE_THREAD_ALLOC= 0
-!else
-TCL_THREADS = 1
-USE_THREAD_ALLOC= 1
!endif
!if "$(TCL_MAJOR_VERSION)" == "8"
@@ -1051,7 +1036,7 @@ BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
!endif
-!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
+!if !$(DEBUG) || $(TCL_VERSION) > 86 || $(DEBUG) && $(UNCHECKED)
SUFX = $(SUFX:g=)
!endif
@@ -1300,7 +1285,7 @@ INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include
# baselibs - minimum Windows libraries required. Parent makefile can
# define PRJ_LIBS before including rules.rc if additional libs are needed
-OPTDEFINES = /DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) /DSTDC_HEADERS
+OPTDEFINES = /DSTDC_HEADERS
!if $(VCVERSION) >= 1600
OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1
!else
@@ -1677,7 +1662,7 @@ default-shell: default-setup $(PROJECT)
!ifdef RCFILE
# Note: don't use $** in below rule because there may be other dependencies
-# and only the "master" rc must be passed to the resource compiler
+# and only the "main" rc must be passed to the resource compiler
$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
$(RESCMD) $(RCDIR)\$(PROJECT).rc
@@ -1731,7 +1716,7 @@ DISABLE_IMPLICIT_RULES = 0
!if !$(DISABLE_IMPLICIT_RULES)
# Implicit rule definitions - only for building library objects. For stubs and
-# main application, the master makefile should define explicit rules.
+# main application, the makefile should define explicit rules.
{$(ROOT)}.c{$(TMP_DIR)}.obj::
$(CCPKGCMD) @<<
diff --git a/win/tcl.m4 b/win/tcl.m4
index ca04f84..8c2228d 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -280,15 +280,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\""
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -410,7 +401,6 @@ AC_DEFUN([SC_ENABLE_SHARED], [
# Sets to $(CFLAGS_OPTIMIZE) if false
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
#
#------------------------------------------------------------------------
@@ -421,7 +411,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
AC_MSG_RESULT([no])
@@ -429,7 +418,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
@@ -651,7 +639,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
AC_MSG_RESULT([using shared flags])
@@ -665,7 +653,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -673,19 +661,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD='${CC} -shared'
SHLIB_LD_LIBS='${LIBS}'
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \
- -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)"
+ -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -750,14 +738,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
AC_MSG_RESULT([using shared flags])
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
LIBRARIES="\${SHARED_LIBRARIES}"
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[[4-9]]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -769,9 +757,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@"
# DLLSUFFIX is separate because it is the building block for
# users of tclConfig.sh that may build shared or static.
- DLLSUFFIX="\${DBGX}.dll"
- LIBSUFFIX="\${DBGX}.lib"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -1069,7 +1057,7 @@ AC_DEFUN([SC_PROG_TCLSH], [
AC_DEFUN([SC_BUILD_TCLSH], [
AC_MSG_CHECKING([for tclsh in Tcl build directory])
- BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}
+ BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${EXEEXT}
AC_MSG_RESULT($BUILD_TCLSH)
AC_SUBST(BUILD_TCLSH)
])
diff --git a/win/tkConfig.sh.in b/win/tkConfig.sh.in
index c511312..d93e649 100644
--- a/win/tkConfig.sh.in
+++ b/win/tkConfig.sh.in
@@ -25,8 +25,9 @@ TK_DEFS='@DEFS@'
# Flag, 1: we built a shared lib, 0 we didn't
TK_SHARED_BUILD=@TK_SHARED_BUILD@
-# This indicates if Tk was build with debugging symbols
-TK_DBGX=@TK_DBGX@
+# TK_DBGX used to be used to distinguish debug vs. non-debug builds.
+# This was a righteous pain so the core doesn't do that any more.
+TK_DBGX=
# The name of the Tk library (may be either a .a file or a shared library):
TK_LIB_FILE='@TK_LIB_FILE@'
diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c
index 49ffd83..9ff374e 100644
--- a/win/tkWin32Dll.c
+++ b/win/tkWin32Dll.c
@@ -135,7 +135,7 @@ DllMain(
"leaq %[registration], %%rdx" "\n\t"
"movq %%gs:0, %%rax" "\n\t"
"movq %%rax, 0x0(%%rdx)" "\n\t" /* link */
- "leaq 1f, %%rax" "\n\t"
+ "leaq 1f(%%rip), %%rax" "\n\t"
"movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */
"movq %%rbp, 0x10(%%rdx)" "\n\t" /* rbp */
"movq %%rsp, 0x18(%%rdx)" "\n\t" /* rsp */
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 78e3b6c..ab43304 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -58,6 +58,7 @@ static const SystemColorEntry sysColors[] = {
{"InfoText", COLOR_INFOTEXT},
{"Menu", COLOR_MENU},
{"MenuText", COLOR_MENUTEXT},
+ {"PlaceHolderText", COLOR_GRAYTEXT},
{"Scrollbar", COLOR_SCROLLBAR},
{"Window", COLOR_WINDOW},
{"WindowFrame", COLOR_WINDOWFRAME},
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 63f3add..a8abb77 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -104,7 +104,7 @@ TkGetCursorByName(
/*
* All cursor names are valid lists of one element (for
- * Unix-compatability), even unadorned system cursor names.
+ * Unix-compatibility), even unadorned system cursor names.
*/
if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index 33756f8..eaceb42 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -158,7 +158,7 @@
#define DEF_ENTRY_INSERT_WIDTH "2"
#define DEF_ENTRY_JUSTIFY "left"
#define DEF_ENTRY_PLACEHOLDER ""
-#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3"
+#define DEF_ENTRY_PLACEHOLDERFG "SystemPlaceHolderText"
#define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace"
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 9f53396..54fb4d0 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1086,7 +1086,7 @@ ParseOFNOptions(
}
ZeroMemory(optsPtr, sizeof(*optsPtr));
- // optsPtr->forceXPStyle = 1;
+ /* optsPtr->forceXPStyle = 1; */
optsPtr->tkwin = (Tk_Window)clientData;
optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */
Tcl_DStringInit(&optsPtr->utfDirString);
@@ -2711,10 +2711,10 @@ ChooseDirectoryValidateProc(
if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) {
SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir);
- // enable the OK button
+ /* enable the OK button */
SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
} else {
- // disable the OK button
+ /* disable the OK button */
SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
}
UpdateWindow(hwnd);
@@ -3187,13 +3187,13 @@ HookProc(
if (IsWindow(hwndCtrl)) {
EnableWindow(hwndCtrl, FALSE);
}
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 1; /* we handled the message */
}
if (WM_DESTROY == msg) {
phd->hwnd = NULL;
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 0;
}
@@ -3211,7 +3211,7 @@ HookProc(
ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf);
}
if (phd && phd->parent) {
- TkSendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
}
return 1;
}
@@ -3525,7 +3525,7 @@ FontchooserShowCmd(
ApplyLogfont(hdPtr->interp, hdPtr->cmdObj, hdc, &lf);
}
if (hdPtr->parent) {
- TkSendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
}
}
Tcl_SetServiceMode(oldMode);
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 75578de..50f2f3b 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -1361,7 +1361,10 @@ TkDrawAngledChars(
* Draw a string of characters on the screen like Tk_DrawChars(), but
* with access to all the characters on the line for context. On Windows
* this context isn't consulted, so we just call Tk_DrawChars().
- *
+ *
+ * Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this
+ * function is unused (and possibly unfinished). See [7655f65ae7].
+*
* Results:
* None.
*
@@ -1399,6 +1402,37 @@ TkpDrawCharsInContext(
rangeLength, x+widthUntilStart, y);
}
+void
+TkpDrawAngledCharsInContext(
+ 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. */
+ double x, double y, /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+ double angle) /* What angle to put text at, in degrees. */
+{
+ int widthUntilStart;
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
+ (void) numBytes; /*unused*/
+
+ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
+ TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart,
+ rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle);
+}
+
/*
*-------------------------------------------------------------------------
*
@@ -1461,9 +1495,9 @@ MultiFontTextOut(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
- familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
+ familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y,
(WCHAR *)Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
familyPtr->getTextExtentPoint32Proc(hdc,
(WCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
@@ -1483,7 +1517,7 @@ MultiFontTextOut(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
- familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
+ familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y,
(WCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
Tcl_DStringFree(&runString);
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 7e3119e..92bcc0d 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -142,6 +142,9 @@ MODULE_SCOPE const int tkpWinBltModes[];
#include "tkIntPlatDecls.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Special proc needed as tsd accessor function between
* tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard
@@ -246,4 +249,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
#define GWLP_ID GWL_ID
#endif /* !GWLP_WNDPROC */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _TKWININT */
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 2c20b64..57c1d32 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -111,7 +111,7 @@ TkpGetString(
} else if (keyEv->send_event == -3) {
/*
- * Special case for WM_UNICHAR and win2000 multi-lingal IME input
+ * Special case for WM_UNICHAR and win2000 multilingual IME input
*/
len = TkUniCharToUtf(keyEv->keycode, buf);
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 0b6efcf..40a7b97 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -685,7 +685,7 @@ ReconfigureWindowsMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin), -1);
Tcl_DStringAppend(&ds, ".system", 7);
menuRefPtr = TkFindMenuReferences(menuPtr->interp,
@@ -696,7 +696,7 @@ ReconfigureWindowsMenu(
if ((menuRefPtr != NULL)
&& (menuRefPtr->menuPtr != NULL)
&& (menuPtr->parentTopLevelPtr != NULL)
- && (systemMenuPtr->masterMenuPtr
+ && (systemMenuPtr->mainMenuPtr
== menuRefPtr->menuPtr)) {
HMENU systemMenuHdl = (HMENU) systemMenuPtr->platformData;
HWND wrapper = TkWinGetWrapperWindow(menuPtr
@@ -1252,7 +1252,8 @@ TkWinHandleMenuEvent(
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
*plParam);
if (hashEntryPtr != NULL) {
- TkSizeT i, len, underline;
+ TkSizeT i, len;
+ int underline;
Tcl_Obj *labelPtr;
WCHAR *wlabel;
int menuChar;
@@ -1270,7 +1271,7 @@ TkWinHandleMenuEvent(
for (i = 0; i < menuPtr->numEntries; i++) {
underline = menuPtr->entries[i]->underline;
labelPtr = menuPtr->entries[i]->labelPtr;
- if ((underline != TCL_INDEX_NONE) && (labelPtr != NULL)) {
+ if ((underline >= 0) && (labelPtr != NULL)) {
/*
* Ensure we don't exceed the label length, then check
*/
@@ -1279,7 +1280,7 @@ TkWinHandleMenuEvent(
Tcl_DStringFree(&ds);
Tcl_DStringInit(&ds);
wlabel = Tcl_UtfToWCharDString(src, len, &ds);
- if ((underline + 1 < len + 1) && (menuChar ==
+ if (((TkSizeT)underline + 1 < len + 1) && (menuChar ==
Tcl_UniCharToUpper(wlabel[underline]))) {
*plResult = (2 << 16) | i;
returnResult = 1;
@@ -1689,7 +1690,7 @@ GetTearoffEntryGeometry(
(void)mePtr;
(void)tkfont;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
*heightPtr = 0;
} else {
*heightPtr = fmPtr->linespace;
@@ -2328,13 +2329,13 @@ TkpInitializeMenuBindings(
"<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<Alt-KeyPress>", "tk::WinMenuKey %W %N", 0);
+ "<Alt-Key>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<KeyPress-F10>", "tk::WinMenuKey %W %N", 0);
+ "<Key-F10>", "tk::WinMenuKey %W %N", 0);
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
"<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0);
@@ -2597,7 +2598,7 @@ DrawTearoffEntry(
(void)tkfont;
(void)fmPtr;
- if (menuPtr->menuType != MASTER_MENU) {
+ if (menuPtr->menuType != MAIN_MENU) {
return;
}
@@ -3229,7 +3230,7 @@ TkpMenuNotifyToplevelCreate(
if ((menuName != NULL) && (menuName[0] != '\0')) {
menuRefPtr = TkFindMenuReferences(interp, menuName);
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
- for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
+ for (menuPtr = menuRefPtr->menuPtr->mainMenuPtr; menuPtr != NULL;
menuPtr = menuPtr->nextInstancePtr) {
if (menuPtr->menuType == MENUBAR) {
ScheduleMenuReconfigure(menuPtr);
diff --git a/win/tkWinPort.h b/win/tkWinPort.h
index 11ecf21..0118608 100644
--- a/win/tkWinPort.h
+++ b/win/tkWinPort.h
@@ -95,11 +95,15 @@
* See ticket [916c1095438eae56]: GetVersionExW triggers warnings
*/
#if defined(_MSC_VER)
+# pragma warning(disable:4146)
# pragma warning(disable:4267)
# pragma warning(disable:4244)
# pragma warning(disable:4311)
# pragma warning(disable:4312)
# pragma warning(disable:4996)
+#if !defined(_WIN64)
+# pragma warning(disable:4305)
+#endif
#endif
/*
@@ -121,6 +125,12 @@
| ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
/*
+ * Used by tkWindow.c
+ */
+
+#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event)
+
+/*
* These calls implement native bitmaps which are not currently
* supported under Windows. The macros eliminate the calls.
*/
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
index 536c6c1..2d66862 100644
--- a/win/tkWinSendCom.c
+++ b/win/tkWinSendCom.c
@@ -432,7 +432,7 @@ Async(
static HRESULT
Send(
- TkWinSendCom *obj,
+ TkWinSendCom *comobj,
VARIANT vCmd,
VARIANT *pvResult,
EXCEPINFO *pExcepInfo,
@@ -441,7 +441,7 @@ Send(
HRESULT hr = S_OK;
int result = TCL_OK;
VARIANT v;
- Tcl_Interp *interp = obj->interp;
+ Tcl_Interp *interp = comobj->interp;
Tcl_Obj *scriptPtr;
Tcl_DString ds;
(void)puArgErr;
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 2f00672..324511a 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -57,8 +57,8 @@ typedef struct ProtocolHandler {
/* 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[1]; /* Tcl command to invoke when a client message
+ Tcl_Interp *interp; /* Interpreter in which to invoke command. */
+ char command[TKFLEXARRAY]; /* 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
@@ -177,7 +177,7 @@ typedef struct TkWmInfo {
* (corresponds to hints.window_group).
* Malloc-ed. Note: this field doesn't get
* updated if leader is destroyed. */
- TkWindow *masterPtr; /* Master window for TRANSIENT_FOR property,
+ TkWindow *containerPtr; /* Container window for TRANSIENT_FOR property,
* or NULL. */
Tk_Window icon; /* Window to use as icon for this window, or
* NULL. */
@@ -315,7 +315,7 @@ typedef struct TkWmInfo {
* window (controlled by "wm resizable" command).
* WM_WITHDRAWN - Non-zero means that this window has explicitly
* been withdrawn. If it's a transient, it should
- * not mirror state changes in the master.
+ * not mirror state changes in the container.
* WM_FULLSCREEN - Non-zero means that this window has been placed
* in the full screen mode. It should be mapped at
* 0,0 and be the width and height of the screen.
@@ -364,7 +364,7 @@ static void RemapWindows(TkWindow *winPtr, HWND parentHWND);
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
typedef struct {
@@ -2037,7 +2037,7 @@ UpdateWrapper(
* Pick the decorative frame style. Override redirect windows get
* created as undecorated popups if they have no transient parent,
* otherwise they are children. This allows splash screens to operate
- * as an independent window, while having dropdows (like for a
+ * as an independent window, while having dropdowns (like for a
* combobox) not grab focus away from their parent. Transient windows
* get a modal dialog frame. Neither override, nor transient windows
* appear in the Windows taskbar. Note that a transient window does
@@ -2054,7 +2054,7 @@ UpdateWrapper(
*/
parentHWND = GetDesktopWindow();
- if (wmPtr->masterPtr) {
+ if (wmPtr->containerPtr) {
wmPtr->style |= WS_CHILD;
} else {
wmPtr->style |= WS_POPUP;
@@ -2062,10 +2062,10 @@ UpdateWrapper(
} else if (wmPtr->flags & WM_FULLSCREEN) {
wmPtr->style = WM_FULLSCREEN_STYLE;
wmPtr->exStyle = EX_FULLSCREEN_STYLE;
- } else if (wmPtr->masterPtr) {
+ } else if (wmPtr->containerPtr) {
wmPtr->style = WM_TRANSIENT_STYLE;
wmPtr->exStyle = EX_TRANSIENT_STYLE;
- parentHWND = Tk_GetHWND(Tk_WindowId(wmPtr->masterPtr));
+ parentHWND = Tk_GetHWND(Tk_WindowId(wmPtr->containerPtr));
if (! ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE)
&& (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE))) {
wmPtr->style |= WS_THICKFRAME;
@@ -2204,7 +2204,7 @@ UpdateWrapper(
if (wmPtr->numTransients > 0) {
/*
* Unset the current wrapper as the parent for all transient
- * children for whom this is the master
+ * children for whom this is the container
*/
WmInfo *wmPtr2;
@@ -2213,7 +2213,7 @@ UpdateWrapper(
state = 0;
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr
+ if (wmPtr2->containerPtr == winPtr
&& !(wmPtr2->flags & WM_NEVER_MAPPED)) {
childStateInfo[state++] = wmPtr2->hints.initial_state;
SetParent(TkWinGetHWND(wmPtr2->winPtr->window), NULL);
@@ -2292,7 +2292,7 @@ UpdateWrapper(
if (childStateInfo) {
if (wmPtr->numTransients > 0) {
/*
- * Reset all transient children for whom this is the master.
+ * Reset all transient children for whom this is the container.
*/
WmInfo *wmPtr2;
@@ -2300,7 +2300,7 @@ UpdateWrapper(
state = 0;
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr
+ if (wmPtr2->containerPtr == winPtr
&& !(wmPtr2->flags & WM_NEVER_MAPPED)) {
UpdateWrapper(wmPtr2->winPtr);
TkpWmSetState(wmPtr2->winPtr, childStateInfo[state++]);
@@ -2365,10 +2365,10 @@ TkWmMapWindow(
if (wmPtr->flags & WM_NEVER_MAPPED) {
/*
- * Don't map a transient if the master is not mapped.
+ * Don't map a transient if the container is not mapped.
*/
- if (wmPtr->masterPtr != NULL && !Tk_IsMapped(wmPtr->masterPtr)) {
+ if (wmPtr->containerPtr != NULL && !Tk_IsMapped(wmPtr->containerPtr)) {
wmPtr->hints.initial_state = WithdrawnState;
return;
}
@@ -2610,17 +2610,17 @@ TkWmDeadWindow(
}
/*
- * Reset all transient windows whose master is the dead window.
+ * Reset all transient windows whose container is the dead window.
*/
for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL;
wmPtr2 = wmPtr2->nextPtr) {
- if (wmPtr2->masterPtr == winPtr) {
+ if (wmPtr2->containerPtr == winPtr) {
wmPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr,
+ Tk_DeleteEventHandler((Tk_Window) wmPtr2->containerPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, wmPtr2->winPtr);
- wmPtr2->masterPtr = NULL;
+ wmPtr2->containerPtr = NULL;
if ((wmPtr2->wrapper != NULL)
&& !(wmPtr2->flags & (WM_NEVER_MAPPED))) {
UpdateWrapper(wmPtr2->winPtr);
@@ -2670,20 +2670,20 @@ TkWmDeadWindow(
if (wmPtr->flags & WM_UPDATE_PENDING) {
Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- if (wmPtr->masterPtr != NULL) {
- wmPtr2 = wmPtr->masterPtr->wmInfoPtr;
+ if (wmPtr->containerPtr != NULL) {
+ wmPtr2 = wmPtr->containerPtr->wmInfoPtr;
/*
- * If we had a master, tell them that we aren't tied to them anymore.
+ * If we had a container, tell them that we aren't tied to them anymore.
*/
if (wmPtr2 != NULL) {
wmPtr2->numTransients--;
}
- Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
+ Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, winPtr);
- wmPtr->masterPtr = NULL;
+ wmPtr->containerPtr = NULL;
}
if (wmPtr->crefObj != NULL) {
Tcl_DecrRefCount(wmPtr->crefObj);
@@ -3408,7 +3408,7 @@ WmColormapwindowsCmd(
break;
}
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) wmPtr->cmapList[i]));
+ Tk_NewWindowObj((Tk_Window) wmPtr->cmapList[i]));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -4140,7 +4140,7 @@ WmIconifyCmd(
if (winPtr->flags & TK_EMBEDDED) {
if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: the container does not support the request",
+ "can't iconify \"%s\": the container does not support the request",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -4154,7 +4154,7 @@ WmIconifyCmd(
NULL);
return TCL_ERROR;
}
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient",
winPtr->pathName));
@@ -4163,7 +4163,7 @@ WmIconifyCmd(
}
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
@@ -4569,7 +4569,7 @@ WmIconwindowCmd(
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -5222,7 +5222,7 @@ WmStackorderCmd(
resultObj = Tcl_NewObj();
for (windowPtr = windows; *windowPtr ; windowPtr++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) *windowPtr));
+ Tk_NewWindowObj((Tk_Window) *windowPtr));
}
Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
@@ -5403,7 +5403,7 @@ WmStateCmd(
"OVERRIDE_REDIRECT", NULL);
return TCL_ERROR;
}
- if (wmPtr->masterPtr != NULL) {
+ if (wmPtr->containerPtr != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't iconify \"%s\": it is a transient",
winPtr->pathName));
@@ -5549,46 +5549,46 @@ WmTransientCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr, *w;
+ TkWindow *containerPtr = wmPtr->containerPtr, **containerPtrPtr = &containerPtr, *w;
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
- if (masterPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) masterPtr));
+ if (containerPtr != NULL) {
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) containerPtr));
}
return TCL_OK;
}
if (Tcl_GetString(objv[3])[0] == '\0') {
- if (masterPtr != NULL) {
+ if (containerPtr != NULL) {
/*
- * If we had a master, tell them that we aren't tied to them
+ * If we had a container, tell them that we aren't tied to them
* anymore.
*/
- masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) masterPtr,
+ containerPtr->wmInfoPtr->numTransients--;
+ Tk_DeleteEventHandler((Tk_Window) containerPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, winPtr);
}
- wmPtr->masterPtr = NULL;
+ wmPtr->containerPtr = NULL;
} else {
if (TkGetWindowFromObj(interp, tkwin, objv[3],
- (Tk_Window *) masterPtrPtr) != TCL_OK) {
+ (Tk_Window *) containerPtrPtr) != TCL_OK) {
return TCL_ERROR;
}
- while (!Tk_TopWinHierarchy(masterPtr)) {
+ while (!Tk_TopWinHierarchy(containerPtr)) {
/*
- * Ensure that the master window is actually a Tk toplevel.
+ * Ensure that the container window is actually a Tk toplevel.
*/
- masterPtr = masterPtr->parentPtr;
+ containerPtr = containerPtr->parentPtr;
}
- Tk_MakeWindowExist((Tk_Window) masterPtr);
+ Tk_MakeWindowExist((Tk_Window) containerPtr);
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -5598,51 +5598,51 @@ WmTransientCmd(
return TCL_ERROR;
}
- wmPtr2 = masterPtr->wmInfoPtr;
+ wmPtr2 = containerPtr->wmInfoPtr;
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
}
- for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL;
- w = (TkWindow *)w->wmInfoPtr->masterPtr) {
+ for (w = containerPtr; w != NULL && w->wmInfoPtr != NULL;
+ w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
- Tk_PathName(masterPtr)));
+ "can't set \"%s\" as container: would cause management loop",
+ Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
}
}
- if (masterPtr != wmPtr->masterPtr) {
+ if (containerPtr != wmPtr->containerPtr) {
/*
- * Remove old master map/unmap binding before setting the new
- * master. The event handler will ensure that transient states
- * reflect the state of the master.
+ * Remove old container map/unmap binding before setting the new
+ * container. The event handler will ensure that transient states
+ * reflect the state of the container.
*/
- if (wmPtr->masterPtr != NULL) {
- wmPtr->masterPtr->wmInfoPtr->numTransients--;
- Tk_DeleteEventHandler((Tk_Window) wmPtr->masterPtr,
+ if (wmPtr->containerPtr != NULL) {
+ wmPtr->containerPtr->wmInfoPtr->numTransients--;
+ Tk_DeleteEventHandler((Tk_Window) wmPtr->containerPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, winPtr);
}
- masterPtr->wmInfoPtr->numTransients++;
- Tk_CreateEventHandler((Tk_Window) masterPtr,
+ containerPtr->wmInfoPtr->numTransients++;
+ Tk_CreateEventHandler((Tk_Window) containerPtr,
VisibilityChangeMask|StructureNotifyMask,
WmWaitVisibilityOrMapProc, winPtr);
- wmPtr->masterPtr = masterPtr;
+ wmPtr->containerPtr = containerPtr;
}
}
if (!((wmPtr->flags & WM_NEVER_MAPPED)
&& !(winPtr->flags & TK_EMBEDDED))) {
- if (wmPtr->masterPtr != NULL
- && !Tk_IsMapped(wmPtr->masterPtr)) {
+ if (wmPtr->containerPtr != NULL
+ && !Tk_IsMapped(wmPtr->containerPtr)) {
TkpWmSetState(winPtr, WithdrawnState);
} else {
UpdateWrapper(winPtr);
@@ -5728,9 +5728,9 @@ WmWaitVisibilityOrMapProc(
XEvent *eventPtr) /* Information about event. */
{
TkWindow *winPtr = (TkWindow *)clientData;
- TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr;
+ TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr;
- if (masterPtr == NULL)
+ if (containerPtr == NULL)
return;
if (eventPtr->type == MapNotify) {
@@ -5742,7 +5742,7 @@ WmWaitVisibilityOrMapProc(
}
if (eventPtr->type == VisibilityNotify) {
- int state = masterPtr->wmInfoPtr->hints.initial_state;
+ int state = containerPtr->wmInfoPtr->hints.initial_state;
if ((state == NormalState) || (state == ZoomState)) {
state = winPtr->wmInfoPtr->hints.initial_state;
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 661ad29..de1e0ee 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -349,12 +349,12 @@ TkWinGetPlatformTheme(void)
* TK_THEME_WIN_CLASSIC could be set even when running under XP if the
* windows classic theme was selected.
*/
- if ((os.dwMajorVersion == 5) && (os.dwMinorVersion == 1)) {
+ if (os.dwMajorVersion == 5 && os.dwMinorVersion >= 1) {
HKEY hKey;
LPCWSTR szSubKey = L"Control Panel\\Appearance";
LPCWSTR szCurrent = L"Current";
DWORD dwSize = 200;
- char pBuffer[200];
+ WCHAR pBuffer[200];
memset(pBuffer, 0, dwSize);
if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L,
@@ -363,7 +363,7 @@ TkWinGetPlatformTheme(void)
} else {
RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
RegCloseKey(hKey);
- if (strcmp(pBuffer, "Windows Standard") == 0) {
+ if (wcscmp(pBuffer, L"Windows Standard") == 0) {
tkWinTheme = TK_THEME_WIN_CLASSIC;
} else {
tkWinTheme = TK_THEME_WIN_XP;
@@ -1746,11 +1746,11 @@ TkWinResendEvent(
msg = WM_RBUTTONDOWN;
wparam = MK_RBUTTON;
break;
- case Button4:
+ case Button8:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON1, XBUTTON1);
break;
- case Button5:
+ case Button9:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON2, XBUTTON2);
break;
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 7c3e45c..aa4dc24 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -7,7 +7,7 @@
#include <tkWinInt.h>
-#ifndef DFCS_HOT /* Windows 98/Me, Windows 200/XP only */
+#ifndef DFCS_HOT /* Windows 98/Me, Windows 2000/XP only */
#define DFCS_HOT 0
#endif
@@ -746,8 +746,8 @@ TTK_LAYOUT("TButton",
TTK_LAYOUT("TCombobox",
TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
- TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
+ TTK_GROUP("Combobox.focus", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))))
TTK_END_LAYOUT_TABLE
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index fec0450..df04d86 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -506,7 +506,7 @@ static void GenericElementSize(
if (!(elementData->info->flags & IGNORE_THEMESIZE)) {
result = elementData->procs->GetThemePartSize(
elementData->hTheme,
- elementData->hDC,
+ NULL,
elementData->info->partId,
Ttk_StateTableLookup(elementData->info->statemap, 0),
NULL /*RECT *prc*/,
@@ -795,7 +795,7 @@ static const Ttk_ElementSpec TreeIndicatorElementSpec =
TreeIndicatorElementDraw
};
-#if BROKEN_TEXT_ELEMENT
+#ifdef BROKEN_TEXT_ELEMENT
/*
*----------------------------------------------------------------------
@@ -847,7 +847,7 @@ static void TextElementSize(
Ttk_StateTableLookup(elementData->info->statemap, 0),
Tcl_UtfToWCharDString(src, len, &ds),
-1,
- DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
+ DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */,
NULL,
&rc);
@@ -886,7 +886,7 @@ static void TextElementDraw(
Ttk_StateTableLookup(elementData->info->statemap, state),
Tcl_UtfToWCharDString(src, len, &ds),
-1,
- DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
+ DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */,
(state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0,
&rc);
@@ -919,8 +919,8 @@ TTK_LAYOUT("TButton",
TTK_LAYOUT("TMenubutton",
TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y)
- TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH,
- TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", 0))))
TTK_LAYOUT("Horizontal.TScrollbar",
@@ -938,14 +938,14 @@ TTK_LAYOUT("Vertical.TScrollbar",
TTK_NODE("Vertical.Scrollbar.grip", 0))))
TTK_LAYOUT("Horizontal.TScale",
- TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
- TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Scale.focus", TTK_FILL_BOTH,
+ TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH,
TTK_NODE("Horizontal.Scale.track", TTK_FILL_X)
TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) )))
TTK_LAYOUT("Vertical.TScale",
- TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
- TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_GROUP("Scale.focus", TTK_FILL_BOTH,
+ TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH,
TTK_NODE("Vertical.Scale.track", TTK_FILL_Y)
TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) )))
@@ -1046,12 +1046,10 @@ static const ElementInfo ElementInfoTable[] = {
{ "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
SPNP_DOWN, spinbutton_statemap, NOPAD,
PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
-
-#if BROKEN_TEXT_ELEMENT
+#ifdef BROKEN_TEXT_ELEMENT
{ "Labelframe.text", &TextElementSpec, L"BUTTON",
BP_GROUPBOX, groupbox_statemap, NOPAD,0 },
#endif
-
{ 0,0,0,0,0,NOPAD,0 }
};
#undef PAD
diff --git a/win/winMain.c b/win/winMain.c
index c3ec364..e7b1e65 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -278,6 +278,7 @@ main(
char **dummy)
{
TCHAR **argv;
+ (void)dummy;
#else
int
_tmain(
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index 0ad68d6..e0879d5 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -382,9 +382,6 @@ typedef struct _XImage {
unsigned long green_mask;
unsigned long blue_mask;
XPointer obdata; /* hook for the object routines to hang on */
-#if defined(MAC_OSX_TK)
- int pixelpower; /* n such that pixels are 2^n x 2^n blocks*/
-#endif
struct funcs { /* image manipulation routines */
struct _XImage *(*create_image)(
struct _XDisplay* /* display */,
diff --git a/xlib/xgc.c b/xlib/xgc.c
index ed12f4b..b211286 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -16,7 +16,6 @@
#if !defined(MAC_OSX_TK)
# include <X11/Xlib.h>
-# define gcCacheSize 0
# define TkpInitGCCache(gc)
# define TkpFreeGCCache(gc)
# define TkpGetGCCache(gc)
@@ -24,10 +23,18 @@
# include <tkMacOSXInt.h>
# include <X11/Xlib.h>
# include <X11/X.h>
-# define gcCacheSize sizeof(TkpGCCache)
#endif
+#define MAX_DASH_LIST_SIZE 10
+typedef struct {
+ XGCValues gc;
+ char dash[MAX_DASH_LIST_SIZE];
+#ifdef MAC_OSX_TK
+ TkpGCCache cache;
+#endif
+} XGCValuesWithCache;
+
/*
*----------------------------------------------------------------------
*
@@ -50,10 +57,6 @@ static TkpClipMask *AllocClipMask(GC gc) {
if (clip_mask == NULL) {
clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask));
gc->clip_mask = (Pixmap) clip_mask;
-#ifdef MAC_OSX_TK
- } else if (clip_mask->type == TKP_CLIP_REGION) {
- TkpReleaseRegion(clip_mask->value.region);
-#endif
}
return clip_mask;
}
@@ -76,12 +79,7 @@ static TkpClipMask *AllocClipMask(GC gc) {
static void FreeClipMask(GC gc) {
if (gc->clip_mask != None) {
-#ifdef MAC_OSX_TK
- if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) {
- TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region);
- }
-#endif
- ckfree((char *) gc->clip_mask);
+ ckfree((char *)gc->clip_mask);
gc->clip_mask = None;
}
}
@@ -119,9 +117,7 @@ XCreateGC(
* initialization.
*/
-#define MAX_DASH_LIST_SIZE 10
-
- gp = (GC)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize);
+ gp = (GC)ckalloc(sizeof(XGCValuesWithCache));
if (!gp) {
return NULL;
}
@@ -184,8 +180,7 @@ XCreateGC(
TkpGCCache*
TkpGetGCCache(GC gc) {
- return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) +
- MAX_DASH_LIST_SIZE) : NULL);
+ return (gc ? &((XGCValuesWithCache *)gc)->cache : NULL);
}
#endif
@@ -496,9 +491,6 @@ TkSetRegion(
clip_mask->type = TKP_CLIP_REGION;
clip_mask->value.region = r;
-#ifdef MAC_OSX_TK
- TkpRetainRegion(r);
-#endif
}
return Success;
}
@@ -847,7 +839,7 @@ XCreateGlyphCursor(
(void)foreground_color;
(void)background_color;
- return 1;
+ return (Cursor) NULL;
}
XFontSet
@@ -970,8 +962,7 @@ XSetIMValues(
return NULL;
}
-
-
+
/*
* Local Variables:
* mode: c