diff options
author | wolfsuit <wolfsuit> | 2003-02-19 19:27:43 (GMT) |
---|---|---|
committer | wolfsuit <wolfsuit> | 2003-02-19 19:27:43 (GMT) |
commit | e891595e16225fe441b40805b6bc3f1e9ff7cc75 (patch) | |
tree | e88ef97ca29843dc17db985018abfbbb170e7a5d | |
parent | 6e2cd243ccc9bd454ae118549066ad2669c00160 (diff) | |
download | tk-e891595e16225fe441b40805b6bc3f1e9ff7cc75.zip tk-e891595e16225fe441b40805b6bc3f1e9ff7cc75.tar.gz tk-e891595e16225fe441b40805b6bc3f1e9ff7cc75.tar.bz2 |
This submission contains a slightly reworked & cleaned up version of
two parts of the patches in Patch Tracker #622582 -
new-evthdlng.2003-02-12.diff and basic-keyboard.2003-02-10.diff. The
second part puts translation of MacOS X keycodes to characters on a
better footing. The first part relaxs Tk's policy of consuming all
events unless it can see they go to windows it didn't create. This
change gets the little traffic lights working, and should make things
like QuickTimeTcl easier to implement.
-rw-r--r-- | ChangeLog | 84 | ||||
-rw-r--r-- | macosx/Wish.pbproj/jingham.pbxuser | 1233 | ||||
-rw-r--r-- | macosx/tkMacOSXEvent.c | 104 | ||||
-rw-r--r-- | macosx/tkMacOSXEvent.h | 9 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 853 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyboard.c | 29 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 26 | ||||
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 118 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 7 |
9 files changed, 1188 insertions, 1275 deletions
@@ -1,3 +1,87 @@ +2003-02-19 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> + & Jim Ingham <jingham@apple.com> + + This patch changes the default Tk behavior so that events + are by default routed to the standard event handlers after + Tk has looked at them. + + * macosx/tkMacOSXEvent.h: Rename "handledByTk" into + "stopProcessing". + + * macosx/tkMacOSXEvent.c: Update erroneous comments and + remove unused includes. + (TkMacOSXProcessAppleEvent): Don't declare events + handled that we didn't even look at. + (TkMacOSXProcessEvent): Add a comment on policy for + "stopProcessing". + (TkMacOSXProcessEvent): Remove "handling" of events that + are not our business. + (TkMacOSXProcessEvent): Rename "handledByTk" into + "stopProcessing". + (ReceiveAndProcessEvent): Ditto. + (ReceiveAndProcessEvent): Tune error production of + message. + + * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): + Rename "handledByTk" into "stopProcessing". + + * macosx/tkMacOSXWindowEvent.c: Ditto. + + * macosx/tkMacOSXMouseEvent.c: Remove setting of + "handledByTk". + (TkMacOSXProcessMouseEvent): Handle clicks in the "traffic + lights" in the window title when the window (or app) is + in the background. + + + This patch changes the key event handling to use the MacOS + translation mechanisms. It also improves dead key handling. + + * macosx/tkMacOSXKeyEvent.c (InitKeyData): Add. + (InitKeyEvent): Add. + (DecodeViaUnicodeResource): Rename + KeycodeToUnicodeViaUnicodeResource. + (DecodeViaKCHRResource): Rename KeycodeToUnicodeViaKCHRResource. + (GetKeyboardLayout): Use a boolean flag instead of a special + layout id. + + (KeycodeToUnicodeViaUnicodeResource): Change interface and + implementation to return a Unicode string instead of directly + filling an XEvent. + (KeycodeToUnicodeViaKCHRResource): Ditto. + (KeycodeToUnicodeViaUnicodeResource): Add handling for callers + that don't want deadkey processing (i.e. XKeycodeToKeysym). + (KeycodeToUnicodeViaKCHRResource): Ditto. + (KeycodeToUnicodeViaUnicodeResource): Clear deadKeyState if a + character was produced. + (KeycodeToUnicodeViaKCHRResource): Use CFString and current + keyboard encoding instead of Tcl Tcl_ExternalToUtf() and fixed + TkMacOSXCarbonEncoding. + (TkMacOSXKeycodeToUnicode): Add. + + (TkMacOSXProcessKeyboardEvent): Add some heuristics to improve + keyup events. + (deadKeyState): Split into deadKeyStateUp and deadKeyStateDown. + (GenerateKeyEvent): Change interface and implementation to accept + a Unicode string instead of individual characters. + (GenerateKeyEvent): Don't generate string representations for + special characters. + + * macosx/tkMacOSXEvent.h (TkMacOSXKeycodeToUnicode): Add + prototype. + + * macosx/tkMacOSXKeyboard.c (KCHRPtr): Remove. + (XKeycodeToKeysym): Use TkMacOSXKeycodeToUnicode instead of + KeyTranslate. + (XKeycodeToKeysym): Support latin-1 keysyms. + + This patch reverts the hack to put icons in menus that Vince put + in yesterday (but preserves the bug fix in that submission.) + + * macosx/tkMacOSXMenu.c (SetMenuTitle): revert treating + "<bullet> number" as a request to put icon number <number> in + the menu. + 2003-02-18 Mo DeJong <mdejong@users.sourceforge.net> * doc/entry.n: diff --git a/macosx/Wish.pbproj/jingham.pbxuser b/macosx/Wish.pbproj/jingham.pbxuser index e296d38..1e8adca 100644 --- a/macosx/Wish.pbproj/jingham.pbxuser +++ b/macosx/Wish.pbproj/jingham.pbxuser @@ -1,316 +1,218 @@ // !$*UTF8*$! { - F50F8E5B038B42BB01DC9062 = { - fRef = F50F8E65038B42BB01DC9062; + 4C0152F403FC191100C916F0 = { + fRef = F5375541016C376E01DC9062; isa = PBXTextBookmark; - name = "Controls.h: 3044"; - rLen = 105; - rLoc = 111248; + name = "tkMacOSXEvent.h: 76"; + rLen = 5; + rLoc = 3095; rType = 0; - vrLen = 227; - vrLoc = 669; + vrLen = 1556; + vrLoc = 2119; }; - F50F8E5C038B42BB01DC9062 = { - isa = PBXTargetBookmark; - trg = F53755DF016C38D201DC9062; - }; - F50F8E5D038B42BB01DC9062 = { - bstl = F537552D016C352C01DC9062; - isa = PBXBuildStyleBookmark; - }; - F50F8E5E038B42BB01DC9062 = { - bstl = F537552C016C352C01DC9062; - isa = PBXBuildStyleBookmark; - }; - F50F8E5F038B42BB01DC9062 = { - fRef = F50F8E64038B42BB01DC9062; - isa = PBXTextBookmark; - name = "Controls.h: 3044"; - rLen = 105; - rLoc = 111248; - rType = 0; - vrLen = 227; - vrLoc = 669; - }; - F50F8E60038B42BB01DC9062 = { - isa = PBXTargetBookmark; - trg = F53755DF016C38D201DC9062; - }; - F50F8E61038B42BB01DC9062 = { - bstl = F537552C016C352C01DC9062; - isa = PBXBuildStyleBookmark; - }; - F50F8E62038B42BB01DC9062 = { - bstl = F537552D016C352C01DC9062; - isa = PBXBuildStyleBookmark; - }; - F50F8E63038B42BB01DC9062 = { - bstl = F537552C016C352C01DC9062; - isa = PBXBuildStyleBookmark; - }; - F50F8E64038B42BB01DC9062 = { - isa = PBXFileReference; - name = Controls.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Controls.h; - refType = 0; - }; - F50F8E65038B42BB01DC9062 = { - isa = PBXFileReference; - name = Controls.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Controls.h; - refType = 0; - }; - F51925ED034C1D2501DC9062 = { - exec = F53756AB016C4DD401DC9062; - isa = PBXExecutableBookmark; - }; - F51925F2034C1D2501DC9062 = { - exec = F53756AB016C4DD401DC9062; - isa = PBXExecutableBookmark; - }; - F51925F3034C1D2501DC9062 = { - fRef = F51925F8034C1D2501DC9062; - isa = PBXTextBookmark; - name = "ControlDefinitions.h: 2569"; - rLen = 105; - rLoc = 97433; - rType = 0; - vrLen = 2139; - vrLoc = 96836; - }; - F51925F4034C1D2501DC9062 = { - fRef = F51925FB034C1D2501DC9062; - isa = PBXTextBookmark; - name = "Controls.h: 2589"; - rLen = 166; - rLoc = 98010; - rType = 0; - vrLen = 1190; - vrLoc = 97831; - }; - F51925F5034C1D2501DC9062 = { - fRef = F5375560016C376E01DC9062; + 4C0152F503FC191100C916F0 = { + fRef = F5375558016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: TkpDisplayScrollbar"; - rLen = 0; - rLoc = 8727; + name = "tkMacOSXKeyEvent.c: KeycodeToUnicodeViaUnicodeResource"; + rLen = 13; + rLoc = 4184; rType = 0; - vrLen = 1442; - vrLoc = 7571; - }; - F51925F8034C1D2501DC9062 = { - isa = PBXFileReference; - name = ControlDefinitions.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/ControlDefinitions.h; - refType = 0; - }; - F51925FB034C1D2501DC9062 = { - isa = PBXFileReference; - name = Controls.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Controls.h; - refType = 0; + vrLen = 2261; + vrLoc = 0; }; - F525B3AB033EFBDF01DC9062 = { + 4C0152F603FC191100C916F0 = { fRef = F5375562016C376E01DC9062; isa = PBXTextBookmark; name = "tkMacOSXSubwindows.c: __VERSION__"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 958; - vrLoc = 0; + vrLen = 927; + vrLoc = 324; }; - F525B3AC033EFBDF01DC9062 = { - fRef = F537555D016C376E01DC9062; + 4C0152F703FC191100C916F0 = { + fRef = F5375553016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXNotify.c: NotifierThreadProc"; + name = "tkMacOSXEvent.c: ReceiveAndProcessEvent"; rLen = 0; - rLoc = 32349; + rLoc = 6759; rType = 0; - vrLen = 1083; - vrLoc = 32042; + vrLen = 1325; + vrLoc = 5928; }; - F525B3AD033EFBDF01DC9062 = { - fRef = F5375567016C376E01DC9062; + 4C0152F803FC191100C916F0 = { + fRef = 4C01530803FC191100C916F0; isa = PBXTextBookmark; - name = "tkMacOSXWm.c: TkpIsWindowFloating"; - rLen = 0; - rLoc = 160011; + name = "MacWindows.h: 429"; + rLen = 31; + rLoc = 17203; rType = 0; - vrLen = 939; - vrLoc = 159588; + vrLen = 1491; + vrLoc = 16372; }; - F525B3AF033EFBDF01DC9062 = { - fRef = F537556B016C37A601DC9062; + 4C0152F903FC191100C916F0 = { + fRef = F5375567016C376E01DC9062; isa = PBXTextBookmark; - name = "tk.h: Tk_Window"; - rLen = 38; - rLoc = 3271; + name = "tkMacOSXWm.c: TkMacOSXMakeRealWindowExist"; + rLen = 0; + rLoc = 152257; rType = 0; - vrLen = 1169; - vrLoc = 2662; + vrLen = 1336; + vrLoc = 151466; }; - F525B3B0033EFBDF01DC9062 = { - fRef = F5375574016C37A601DC9062; + 4C0152FB03FC191100C916F0 = { + fRef = F5375541016C376E01DC9062; isa = PBXTextBookmark; - name = "tkInt.h: 663"; - rLen = 8; - rLoc = 22835; + name = "tkMacOSXEvent.h: 76"; + rLen = 5; + rLoc = 3095; rType = 0; - vrLen = 1611; - vrLoc = 24698; + vrLen = 1556; + vrLoc = 2119; }; - F525B3B1033EFBDF01DC9062 = { - fRef = F5375542016C376E01DC9062; + 4C0152FC03FC191100C916F0 = { + fRef = F5375558016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXInt.h: 37"; - rLen = 68; - rLoc = 629; + name = "tkMacOSXKeyEvent.c: 106"; + rLen = 13; + rLoc = 4184; rType = 0; - vrLen = 1428; - vrLoc = 548; + vrLen = 1172; + vrLoc = 3643; }; - F525B3B3033EFBDF01DC9062 = { - fRef = F5375560016C376E01DC9062; + 4C0152FD03FC191100C916F0 = { + fRef = F537555C016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: TkpDisplayScrollbar"; - rLen = 11; - rLoc = 10051; + name = "tkMacOSXMouseEvent.c: TkMacOSXProcessMouseEvent"; + rLen = 0; + rLoc = 4651; rType = 0; - vrLen = 1214; - vrLoc = 9237; + vrLen = 1116; + vrLoc = 2672; }; - F525B3B4033EFBDF01DC9062 = { - fRef = F5375551016C376E01DC9062; + 4C0152FE03FC191100C916F0 = { + fRef = F5375558016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXDraw.c: 1361"; - rLen = 25; - rLoc = 39929; + name = "tkMacOSXKeyEvent.c: KeycodeToUnicodeViaUnicodeResource"; + rLen = 13; + rLoc = 4184; rType = 0; - vrLen = 964; - vrLoc = 39556; + vrLen = 2261; + vrLoc = 0; }; - F525B3B5033EFBDF01DC9062 = { + 4C0152FF03FC191100C916F0 = { fRef = F5375562016C376E01DC9062; isa = PBXTextBookmark; name = "tkMacOSXSubwindows.c: __VERSION__"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 958; - vrLoc = 0; + vrLen = 927; + vrLoc = 324; }; - F525B3B6033EFBDF01DC9062 = { - fRef = F5375567016C376E01DC9062; + 4C01530003FC191100C916F0 = { + fRef = F5375553016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXWm.c: 5198"; + name = "tkMacOSXEvent.c: __VERSION__"; rLen = 0; - rLoc = 159603; + rLoc = 0; rType = 0; - vrLen = 1235; + vrLen = 912; vrLoc = 0; }; - F525B3B7033EFBDF01DC9062 = { - fRef = F537555D016C376E01DC9062; + 4C01530103FC191100C916F0 = { + fRef = F537555C016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXNotify.c: NotifierThreadProc"; + name = "tkMacOSXMouseEvent.c: TkMacOSXProcessMouseEvent"; rLen = 0; - rLoc = 32349; + rLoc = 4651; rType = 0; - vrLen = 1083; - vrLoc = 32042; + vrLen = 1116; + vrLoc = 2672; }; - F525B3B8033EFBDF01DC9062 = { - fRef = F5375567016C376E01DC9062; + 4C01530203FC191100C916F0 = { + fRef = F5375553016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXWm.c: TkpIsWindowFloating"; + name = "tkMacOSXEvent.c: ReceiveAndProcessEvent"; rLen = 0; - rLoc = 160011; + rLoc = 6759; rType = 0; - vrLen = 939; - vrLoc = 159588; + vrLen = 1325; + vrLoc = 5928; }; - F525B3B9033EFBDF01DC9062 = { - fRef = F5375560016C376E01DC9062; + 4C01530303FC191100C916F0 = { + fRef = F5375567016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: 53"; - rLen = 11; - rLoc = 1330; + name = "tkMacOSXWm.c: TkMacOSXMakeRealWindowExist"; + rLen = 0; + rLoc = 152257; rType = 0; - vrLen = 1864; - vrLoc = 1086; + vrLen = 1336; + vrLoc = 151466; }; - F525B3BA033EFBDF01DC9062 = { - fRef = F537557D016C37A601DC9062; - isa = PBXTextBookmark; - name = "tkScrollbar.h: 33"; - rLen = 9; - rLoc = 614; - rType = 0; - vrLen = 1978; - vrLoc = 496; + 4C01530803FC191100C916F0 = { + isa = PBXFileReference; + name = MacWindows.h; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/MacWindows.h; + refType = 0; }; - F525B3BB033EFBDF01DC9062 = { - fRef = F537556B016C37A601DC9062; + 4C3917C403FC5E4E00C916F0 = { + fRef = F537555C016C376E01DC9062; isa = PBXTextBookmark; - name = "tk.h: Tk_Window"; - rLen = 38; - rLoc = 3271; + name = "tkMacOSXMouseEvent.c: 765"; + rLen = 0; + rLoc = 22776; rType = 0; - vrLen = 1169; - vrLoc = 2662; + vrLen = 1613; + vrLoc = 8967; }; - F525B3BC033EFBDF01DC9062 = { - fRef = F5375574016C37A601DC9062; + 4C3917C503FC5E4E00C916F0 = { + isa = PBXTargetBookmark; + trg = F53755DF016C38D201DC9062; + }; + 4C3917C603FC5E4E00C916F0 = { + fRef = F537555C016C376E01DC9062; isa = PBXTextBookmark; - name = "tkInt.h: 663"; - rLen = 8; - rLoc = 22835; + name = "tkMacOSXMouseEvent.c: 765"; + rLen = 0; + rLoc = 22776; rType = 0; - vrLen = 1611; - vrLoc = 24698; + vrLen = 1613; + vrLoc = 8967; }; - F525B3BD033EFBDF01DC9062 = { - fRef = F5375542016C376E01DC9062; + 4C3917C703FC5E4E00C916F0 = { + isa = PBXTargetBookmark; + trg = F53755DF016C38D201DC9062; + }; + 4CCAE6F203FAD35700C916F0 = { + fRef = F537554E016C376E01DC9062; isa = PBXTextBookmark; - name = "tkMacOSXInt.h: 37"; - rLen = 68; - rLoc = 629; + name = "tkMacOSXCursor.c: 92"; + rLen = 0; + rLoc = 3545; rType = 0; - vrLen = 1428; - vrLoc = 548; + vrLen = 1747; + vrLoc = 2554; }; - F531E5C803527DF501DC9062 = { - fRef = F531E5CD03527DF501DC9062; + 4CCAE6F503FAD35700C916F0 = { + fRef = F537554E016C376E01DC9062; isa = PBXTextBookmark; - name = "ChangeLog: 1"; - rLen = 266; - rLoc = 0; + name = "tkMacOSXCursor.c: 92"; + rLen = 0; + rLoc = 3545; rType = 0; - vrLen = 1850; - vrLoc = 0; + vrLen = 1747; + vrLoc = 2554; }; - F531E5CA03527DF501DC9062 = { - fRef = F531E5CE03527DF501DC9062; + 4CCAE6F603FAD35700C916F0 = { + fRef = F5375558016C376E01DC9062; isa = PBXTextBookmark; - name = "ChangeLog: 1"; - rLen = 266; - rLoc = 0; + name = "tkMacOSXKeyEvent.c: 117"; + rLen = 13; + rLoc = 4184; rType = 0; - vrLen = 1850; - vrLoc = 0; - }; - F531E5CD03527DF501DC9062 = { - isa = PBXFileReference; - name = ChangeLog; - path = /Volumes/CodeBits/jingham/Tcl/Source/tk/ChangeLog; - refType = 0; - }; - F531E5CE03527DF501DC9062 = { - isa = PBXFileReference; - name = ChangeLog; - path = /Volumes/CodeBits/jingham/Tcl/Source/tk/ChangeLog; - refType = 0; + vrLen = 1181; + vrLoc = 3648; }; F537552A016C352C01DC9062 = { activeBuildStyle = F537552C016C352C01DC9062; @@ -326,99 +228,177 @@ F53756AB016C4DD401DC9062, ); perUserDictionary = { - PBXPerProjectTemplateStateSaveDate = 59461698; + PBXPerProjectTemplateStateSaveDate = 67373224; + "PBXTemplateGeometry-F5314676015831810DCA290F" = { + ContentSize = "{685, 434}"; + LeftSlideOut = { + Collapsed = NO; + Frame = "{{0, 23}, {685, 411}}"; + Split0 = { + ActiveTab = 2; + ActiveTabName = PBXBuildResultsModule; + Collapsed = NO; + Frame = "{{0, 0}, {685, 411}}"; + Split0 = { + Frame = "{{0, 301}, {685, 110}}"; + }; + SplitCount = 1; + Tab0 = { + Frame = "{{0, 0}, {952, 321}}"; + }; + Tab1 = { + Debugger = { + Collapsed = NO; + Frame = "{{0, 0}, {781, 452}}"; + Split0 = { + Frame = "{{0, 24}, {781, 428}}"; + Split0 = { + Frame = "{{0, 0}, {383, 428}}"; + }; + Split1 = { + DebugVariablesTableConfiguration = ( + Name, + 123, + Value, + 85, + Summary, + 155.123, + ); + Frame = "{{392, 0}, {389, 428}}"; + }; + SplitCount = 2; + }; + SplitCount = 1; + Tab0 = { + Frame = "{{0, 0}, {100, 50}}"; + }; + Tab1 = { + Frame = "{{0, 0}, {100, 50}}"; + }; + TabCount = 2; + TabsVisible = YES; + }; + Frame = "{{0, 0}, {781, 452}}"; + LauncherConfigVersion = 7; + }; + Tab2 = { + Frame = "{{0, 0}, {685, 198}}"; + LauncherConfigVersion = 3; + Runner = { + Frame = "{{0, 0}, {685, 198}}"; + }; + }; + Tab3 = { + BuildMessageFrame = "{{0, 0}, {687, 262}}"; + BuildTranscriptFrame = "{{0, 271}, {687, 2}}"; + BuildTranscriptFrameExpanded = YES; + Frame = "{{0, 0}, {685, 295}}"; + }; + Tab4 = { + Frame = "{{0, 0}, {612, 295}}"; + }; + TabCount = 5; + TabsVisible = NO; + }; + SplitCount = 1; + Tab0 = { + Frame = "{{0, 0}, {300, 533}}"; + GroupTreeTableConfiguration = ( + TargetStatusColumn, + 18, + MainColumn, + 267, + ); + }; + Tab1 = { + ClassesFrame = "{{0, 0}, {280, 398}}"; + ClassesTreeTableConfiguration = ( + PBXBookColumnIdentifier, + 20, + PBXClassColumnIdentifier, + 237, + ); + Frame = "{{0, 0}, {278, 659}}"; + MembersFrame = "{{0, 407}, {280, 252}}"; + MembersTreeTableConfiguration = ( + PBXBookColumnIdentifier, + 20, + PBXMethodColumnIdentifier, + 236, + ); + }; + Tab2 = { + Frame = "{{0, 0}, {200, 100}}"; + }; + Tab3 = { + Frame = "{{0, 0}, {200, 100}}"; + TargetTableConfiguration = ( + ActiveObject, + 16, + ObjectNames, + 202.296, + ); + }; + Tab4 = { + BreakpointsTreeTableConfiguration = ( + breakpointColumn, + 197, + enabledColumn, + 31, + ); + Frame = "{{0, 0}, {250, 100}}"; + }; + TabCount = 5; + TabsVisible = NO; + }; + NavBarShownByDefault = YES; + StatusViewVisible = YES; + Template = F5314676015831810DCA290F; + ToolbarVisible = YES; + WindowLocation = "{7, 502}"; + }; PBXWorkspaceContents = ( { LeftSlideOut = { Split0 = { Split0 = { NavContent0 = { - bookmark = F50F8E63038B42BB01DC9062; + bookmark = 4C3917C703FC5E4E00C916F0; history = ( - F56F9699032D92AE01DC9062, - F56F969A032D92AE01DC9062, - F56F969C032D92AE01DC9062, - F56F969D032D92AE01DC9062, - F56F969E032D92AE01DC9062, - F5979A0E033DAD6701DC9062, - F525B3AB033EFBDF01DC9062, - F525B3AC033EFBDF01DC9062, - F525B3AD033EFBDF01DC9062, - F525B3AF033EFBDF01DC9062, - F525B3B0033EFBDF01DC9062, - F525B3B1033EFBDF01DC9062, - F51925ED034C1D2501DC9062, - F531E5C803527DF501DC9062, - F5ECAB86035A798D01DC9062, - F5ECAB89035A798D01DC9062, - F59B1688036E127001DC9062, - F59B1689036E127001DC9062, - F59B168A036E127001DC9062, - F59B168B036E127001DC9062, - F59B168C036E127001DC9062, - F597EADD036E210C01DC9062, - F597EADE036E210C01DC9062, - F597EADF036E210C01DC9062, - F597EAE0036E210C01DC9062, - F50F8E5B038B42BB01DC9062, - F50F8E5C038B42BB01DC9062, - F50F8E5D038B42BB01DC9062, - F50F8E5E038B42BB01DC9062, + 4CCAE6F203FAD35700C916F0, + 4C0152F403FC191100C916F0, + 4C0152F503FC191100C916F0, + 4C0152F603FC191100C916F0, + 4C0152F703FC191100C916F0, + 4C0152F803FC191100C916F0, + 4C0152F903FC191100C916F0, + 4C3917C403FC5E4E00C916F0, + 4C3917C503FC5E4E00C916F0, ); prevStack = ( - F56F96A0032D92AE01DC9062, - F56F96A1032D92AE01DC9062, - F56F96A2032D92AE01DC9062, - F56F96A3032D92AE01DC9062, - F56F96A4032D92AE01DC9062, - F56F96A5032D92AE01DC9062, - F56F96A6032D92AE01DC9062, - F5979A10033DAD6701DC9062, - F5979A11033DAD6701DC9062, - F5979A12033DAD6701DC9062, - F525B3B3033EFBDF01DC9062, - F525B3B4033EFBDF01DC9062, - F525B3B5033EFBDF01DC9062, - F525B3B6033EFBDF01DC9062, - F525B3B7033EFBDF01DC9062, - F525B3B8033EFBDF01DC9062, - F525B3B9033EFBDF01DC9062, - F525B3BA033EFBDF01DC9062, - F525B3BB033EFBDF01DC9062, - F525B3BC033EFBDF01DC9062, - F525B3BD033EFBDF01DC9062, - F576829E03493B6F01DC9062, - F51925F2034C1D2501DC9062, - F51925F3034C1D2501DC9062, - F51925F4034C1D2501DC9062, - F51925F5034C1D2501DC9062, - F531E5CA03527DF501DC9062, - F5ECAB8A035A798D01DC9062, - F5ECAB8B035A798D01DC9062, - F5ECAB8C035A798D01DC9062, - F5ECAB8D035A798D01DC9062, - F59B168D036E127001DC9062, - F59B168E036E127001DC9062, - F59B168F036E127001DC9062, - F59B1690036E127001DC9062, - F59B1691036E127001DC9062, - F597EAE2036E210C01DC9062, - F597EAE3036E210C01DC9062, - F597EAE4036E210C01DC9062, - F50F8E5F038B42BB01DC9062, - F50F8E60038B42BB01DC9062, - F50F8E61038B42BB01DC9062, - F50F8E62038B42BB01DC9062, + 4CCAE6F503FAD35700C916F0, + 4CCAE6F603FAD35700C916F0, + 4C0152FB03FC191100C916F0, + 4C0152FC03FC191100C916F0, + 4C0152FD03FC191100C916F0, + 4C0152FE03FC191100C916F0, + 4C0152FF03FC191100C916F0, + 4C01530003FC191100C916F0, + 4C01530103FC191100C916F0, + 4C01530203FC191100C916F0, + 4C01530303FC191100C916F0, + 4C3917C603FC5E4E00C916F0, ); }; NavCount = 1; NavGeometry0 = { - Frame = "{{0, 0}, {667, 651}}"; + Frame = "{{0, 0}, {869, 865}}"; NavBarVisible = YES; }; + NavSplitVertical = NO; }; SplitCount = 1; - Tab0 = { + Tab1 = { Debugger = { Split0 = { SplitCount = 2; @@ -428,12 +408,12 @@ }; LauncherConfigVersion = 7; }; - Tab1 = { + Tab2 = { LauncherConfigVersion = 3; Runner = { }; }; - TabCount = 4; + TabCount = 5; }; SplitCount = 1; Tab1 = { @@ -445,37 +425,41 @@ ); PBXWorkspaceGeometries = ( { - ContentSize = "{930, 674}"; + ContentSize = "{1132, 888}"; LeftSlideOut = { ActiveTab = 3; + ActiveTabName = PBXTargetTreeModule; Collapsed = NO; - Frame = "{{0, 23}, {930, 651}}"; + Frame = "{{0, 23}, {1132, 865}}"; Split0 = { Collapsed = NO; - Frame = "{{263, 0}, {667, 651}}"; + Frame = "{{263, 0}, {869, 865}}"; Split0 = { - Frame = "{{0, 0}, {667, 651}}"; + Frame = "{{0, 0}, {869, 865}}"; }; SplitCount = 1; Tab0 = { + Frame = "{{0, 0}, {681, 289}}"; + }; + Tab1 = { Debugger = { Collapsed = NO; - Frame = "{{0, 0}, {681, 289}}"; + Frame = "{{0, 0}, {681, 150}}"; Split0 = { - Frame = "{{0, 24}, {681, 265}}"; + Frame = "{{0, 24}, {681, 126}}"; Split0 = { - Frame = "{{0, 0}, {333, 265}}"; + Frame = "{{0, 0}, {333, 126}}"; }; Split1 = { DebugVariablesTableConfiguration = ( Name, - 82.80298, + 123, Value, - 104.074, + 85, Summary, - 126.123, + 105.123, ); - Frame = "{{342, 0}, {339, 265}}"; + Frame = "{{342, 0}, {339, 126}}"; }; SplitCount = 2; }; @@ -489,30 +473,31 @@ TabCount = 2; TabsVisible = YES; }; - Frame = "{{0, 0}, {681, 289}}"; + Frame = "{{0, 0}, {681, 120}}"; LauncherConfigVersion = 7; }; - Tab1 = { - Frame = "{{0, 0}, {681, 120}}"; + Tab2 = { + Frame = "{{0, 0}, {681, 234}}"; LauncherConfigVersion = 3; Runner = { - Frame = "{{0, 0}, {681, 120}}"; + Frame = "{{0, 0}, {681, 234}}"; }; }; - Tab2 = { - BuildMessageFrame = "{{0, 0}, {683, 127}}"; - BuildTranscriptFrame = "{{0, 136}, {683, 100}}"; - Frame = "{{0, 0}, {681, 234}}"; - }; Tab3 = { + BuildMessageFrame = "{{0, 0}, {683, 205}}"; + BuildTranscriptFrame = "{{0, 214}, {683, 2}}"; + BuildTranscriptFrameExpanded = YES; Frame = "{{0, 0}, {681, 238}}"; }; - TabCount = 4; + Tab4 = { + Frame = "{{0, 0}, {612, 295}}"; + }; + TabCount = 5; TabsVisible = NO; }; SplitCount = 1; Tab0 = { - Frame = "{{0, 0}, {260, 651}}"; + Frame = "{{0, 0}, {260, 865}}"; GroupTreeTableConfiguration = ( SCMStatusColumn, 22, @@ -543,7 +528,7 @@ Frame = "{{0, 0}, {217, 554}}"; }; Tab3 = { - Frame = "{{0, 0}, {239, 651}}"; + Frame = "{{0, 0}, {239, 865}}"; TargetTableConfiguration = ( ActiveObject, 16, @@ -558,97 +543,47 @@ enabledColumn, 31, ); - Frame = "{{0, 0}, {250, 651}}"; + Frame = "{{0, 0}, {250, 810}}"; }; TabCount = 5; TabsVisible = YES; }; + NavBarShownByDefault = YES; StatusViewVisible = YES; Template = 64ABBB4501FA494900185B06; ToolbarVisible = YES; - WindowLocation = "{38, 10}"; + WindowLocation = "{-7, 60}"; }, ); - PBXWorkspaceStateSaveDate = 59461698; + PBXWorkspaceStateSaveDate = 67373224; }; perUserProjectItems = { - F50F8E5B038B42BB01DC9062 = F50F8E5B038B42BB01DC9062; - F50F8E5C038B42BB01DC9062 = F50F8E5C038B42BB01DC9062; - F50F8E5D038B42BB01DC9062 = F50F8E5D038B42BB01DC9062; - F50F8E5E038B42BB01DC9062 = F50F8E5E038B42BB01DC9062; - F50F8E5F038B42BB01DC9062 = F50F8E5F038B42BB01DC9062; - F50F8E60038B42BB01DC9062 = F50F8E60038B42BB01DC9062; - F50F8E61038B42BB01DC9062 = F50F8E61038B42BB01DC9062; - F50F8E62038B42BB01DC9062 = F50F8E62038B42BB01DC9062; - F50F8E63038B42BB01DC9062 = F50F8E63038B42BB01DC9062; - F51925ED034C1D2501DC9062 = F51925ED034C1D2501DC9062; - F51925F2034C1D2501DC9062 = F51925F2034C1D2501DC9062; - F51925F3034C1D2501DC9062 = F51925F3034C1D2501DC9062; - F51925F4034C1D2501DC9062 = F51925F4034C1D2501DC9062; - F51925F5034C1D2501DC9062 = F51925F5034C1D2501DC9062; - F525B3AB033EFBDF01DC9062 = F525B3AB033EFBDF01DC9062; - F525B3AC033EFBDF01DC9062 = F525B3AC033EFBDF01DC9062; - F525B3AD033EFBDF01DC9062 = F525B3AD033EFBDF01DC9062; - F525B3AF033EFBDF01DC9062 = F525B3AF033EFBDF01DC9062; - F525B3B0033EFBDF01DC9062 = F525B3B0033EFBDF01DC9062; - F525B3B1033EFBDF01DC9062 = F525B3B1033EFBDF01DC9062; - F525B3B3033EFBDF01DC9062 = F525B3B3033EFBDF01DC9062; - F525B3B4033EFBDF01DC9062 = F525B3B4033EFBDF01DC9062; - F525B3B5033EFBDF01DC9062 = F525B3B5033EFBDF01DC9062; - F525B3B6033EFBDF01DC9062 = F525B3B6033EFBDF01DC9062; - F525B3B7033EFBDF01DC9062 = F525B3B7033EFBDF01DC9062; - F525B3B8033EFBDF01DC9062 = F525B3B8033EFBDF01DC9062; - F525B3B9033EFBDF01DC9062 = F525B3B9033EFBDF01DC9062; - F525B3BA033EFBDF01DC9062 = F525B3BA033EFBDF01DC9062; - F525B3BB033EFBDF01DC9062 = F525B3BB033EFBDF01DC9062; - F525B3BC033EFBDF01DC9062 = F525B3BC033EFBDF01DC9062; - F525B3BD033EFBDF01DC9062 = F525B3BD033EFBDF01DC9062; - F531E5C803527DF501DC9062 = F531E5C803527DF501DC9062; - F531E5CA03527DF501DC9062 = F531E5CA03527DF501DC9062; - F56F9699032D92AE01DC9062 = F56F9699032D92AE01DC9062; - F56F969A032D92AE01DC9062 = F56F969A032D92AE01DC9062; - F56F969C032D92AE01DC9062 = F56F969C032D92AE01DC9062; - F56F969D032D92AE01DC9062 = F56F969D032D92AE01DC9062; - F56F969E032D92AE01DC9062 = F56F969E032D92AE01DC9062; - F56F96A0032D92AE01DC9062 = F56F96A0032D92AE01DC9062; - F56F96A1032D92AE01DC9062 = F56F96A1032D92AE01DC9062; - F56F96A2032D92AE01DC9062 = F56F96A2032D92AE01DC9062; - F56F96A3032D92AE01DC9062 = F56F96A3032D92AE01DC9062; - F56F96A4032D92AE01DC9062 = F56F96A4032D92AE01DC9062; - F56F96A5032D92AE01DC9062 = F56F96A5032D92AE01DC9062; - F56F96A6032D92AE01DC9062 = F56F96A6032D92AE01DC9062; - F576829E03493B6F01DC9062 = F576829E03493B6F01DC9062; - F5979A0E033DAD6701DC9062 = F5979A0E033DAD6701DC9062; - F5979A10033DAD6701DC9062 = F5979A10033DAD6701DC9062; - F5979A11033DAD6701DC9062 = F5979A11033DAD6701DC9062; - F5979A12033DAD6701DC9062 = F5979A12033DAD6701DC9062; - F597EADD036E210C01DC9062 = F597EADD036E210C01DC9062; - F597EADE036E210C01DC9062 = F597EADE036E210C01DC9062; - F597EADF036E210C01DC9062 = F597EADF036E210C01DC9062; - F597EAE0036E210C01DC9062 = F597EAE0036E210C01DC9062; - F597EAE2036E210C01DC9062 = F597EAE2036E210C01DC9062; - F597EAE3036E210C01DC9062 = F597EAE3036E210C01DC9062; - F597EAE4036E210C01DC9062 = F597EAE4036E210C01DC9062; - F59B1688036E127001DC9062 = F59B1688036E127001DC9062; - F59B1689036E127001DC9062 = F59B1689036E127001DC9062; - F59B168A036E127001DC9062 = F59B168A036E127001DC9062; - F59B168B036E127001DC9062 = F59B168B036E127001DC9062; - F59B168C036E127001DC9062 = F59B168C036E127001DC9062; - F59B168D036E127001DC9062 = F59B168D036E127001DC9062; - F59B168E036E127001DC9062 = F59B168E036E127001DC9062; - F59B168F036E127001DC9062 = F59B168F036E127001DC9062; - F59B1690036E127001DC9062 = F59B1690036E127001DC9062; - F59B1691036E127001DC9062 = F59B1691036E127001DC9062; - F5ECAB86035A798D01DC9062 = F5ECAB86035A798D01DC9062; - F5ECAB89035A798D01DC9062 = F5ECAB89035A798D01DC9062; - F5ECAB8A035A798D01DC9062 = F5ECAB8A035A798D01DC9062; - F5ECAB8B035A798D01DC9062 = F5ECAB8B035A798D01DC9062; - F5ECAB8C035A798D01DC9062 = F5ECAB8C035A798D01DC9062; - F5ECAB8D035A798D01DC9062 = F5ECAB8D035A798D01DC9062; + 4C0152F403FC191100C916F0 = 4C0152F403FC191100C916F0; + 4C0152F503FC191100C916F0 = 4C0152F503FC191100C916F0; + 4C0152F603FC191100C916F0 = 4C0152F603FC191100C916F0; + 4C0152F703FC191100C916F0 = 4C0152F703FC191100C916F0; + 4C0152F803FC191100C916F0 = 4C0152F803FC191100C916F0; + 4C0152F903FC191100C916F0 = 4C0152F903FC191100C916F0; + 4C0152FB03FC191100C916F0 = 4C0152FB03FC191100C916F0; + 4C0152FC03FC191100C916F0 = 4C0152FC03FC191100C916F0; + 4C0152FD03FC191100C916F0 = 4C0152FD03FC191100C916F0; + 4C0152FE03FC191100C916F0 = 4C0152FE03FC191100C916F0; + 4C0152FF03FC191100C916F0 = 4C0152FF03FC191100C916F0; + 4C01530003FC191100C916F0 = 4C01530003FC191100C916F0; + 4C01530103FC191100C916F0 = 4C01530103FC191100C916F0; + 4C01530203FC191100C916F0 = 4C01530203FC191100C916F0; + 4C01530303FC191100C916F0 = 4C01530303FC191100C916F0; + 4C3917C403FC5E4E00C916F0 = 4C3917C403FC5E4E00C916F0; + 4C3917C503FC5E4E00C916F0 = 4C3917C503FC5E4E00C916F0; + 4C3917C603FC5E4E00C916F0 = 4C3917C603FC5E4E00C916F0; + 4C3917C703FC5E4E00C916F0 = 4C3917C703FC5E4E00C916F0; + 4CCAE6F203FAD35700C916F0 = 4CCAE6F203FAD35700C916F0; + 4CCAE6F503FAD35700C916F0 = 4CCAE6F503FAD35700C916F0; + 4CCAE6F603FAD35700C916F0 = 4CCAE6F603FAD35700C916F0; }; projectwideBuildSettings = { - OBJROOT = /Volumes/CodeBits/jingham/Tcl/Objects; - SYMROOT = /Volumes/CodeBits/jingham/Tcl/Products; + OBJROOT = "/Volumes/TheCloset/jingham/tcl-tk/Objects"; + SYMROOT = "/Volumes/TheCloset/jingham/tcl-tk/Products"; }; wantsIndex = 1; wantsSCM = -1; @@ -664,8 +599,12 @@ }; F53756AB016C4DD401DC9062 = { activeArgIndex = 2147483647; + activeArgIndices = ( + ); argumentStrings = ( ); + configStateDict = { + }; debuggerPlugin = GDBDebugging; dylibVariantSuffix = ""; enableDebugStr = 1; @@ -681,470 +620,10 @@ F548F8CE0313CEF0016F146B = { activeExec = 0; }; - F56F9699032D92AE01DC9062 = { - fRef = F537555C016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXMouseEvent.c: GeneratePollingEvents"; - rLen = 0; - rLoc = 13260; - rType = 0; - vrLen = 1112; - vrLoc = 13089; - }; - F56F969A032D92AE01DC9062 = { - fRef = F5375568016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXXStubs.c: TkpCloseDisplay"; - rLen = 0; - rLoc = 5311; - rType = 0; - vrLen = 1023; - vrLoc = 4561; - }; - F56F969C032D92AE01DC9062 = { - fRef = F56F96AD032D92AE01DC9062; - isa = PBXTextBookmark; - name = "tclInt.h: 848"; - rLen = 17; - rLoc = 32840; - rType = 0; - vrLen = 1623; - vrLoc = 31910; - }; - F56F969D032D92AE01DC9062 = { - fRef = F56F96AE032D92AE01DC9062; - isa = PBXTextBookmark; - name = "tclDecls.h: 1000"; - rLen = 17; - rLoc = 34621; - rType = 0; - vrLen = 1549; - vrLoc = 33879; - }; - F56F969E032D92AE01DC9062 = { - fRef = F56F96AF032D92AE01DC9062; - isa = PBXTextBookmark; - name = "CarbonEventsCore.h: 746"; - rLen = 105; - rLoc = 24230; - rType = 0; - vrLen = 1165; - vrLoc = 23633; - }; - F56F96A0032D92AE01DC9062 = { - fRef = F5375568016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXXStubs.c: TkpCloseDisplay"; - rLen = 0; - rLoc = 5311; - rType = 0; - vrLen = 1023; - vrLoc = 4561; - }; - F56F96A1032D92AE01DC9062 = { - fRef = F537555D016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXNotify.c: 1153"; - rLen = 0; - rLoc = 33125; - rType = 0; - vrLen = 1129; - vrLoc = 0; - }; - F56F96A2032D92AE01DC9062 = { - fRef = F5375567016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXWm.c: TkpIsWindowFloating"; - rLen = 0; - rLoc = 159603; - rType = 0; - vrLen = 951; - vrLoc = 159038; - }; - F56F96A3032D92AE01DC9062 = { - fRef = F56F96AA032D92AE01DC9062; - isa = PBXTextBookmark; - name = "tclInt.h: 848"; - rLen = 17; - rLoc = 32840; - rType = 0; - vrLen = 1623; - vrLoc = 31910; - }; - F56F96A4032D92AE01DC9062 = { - fRef = F56F96AB032D92AE01DC9062; - isa = PBXTextBookmark; - name = "tclDecls.h: 1000"; - rLen = 17; - rLoc = 34621; - rType = 0; - vrLen = 1549; - vrLoc = 33879; - }; - F56F96A5032D92AE01DC9062 = { - fRef = F537555D016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXNotify.c: NotifierThreadProc"; - rLen = 0; - rLoc = 31476; - rType = 0; - vrLen = 1952; - vrLoc = 29655; - }; - F56F96A6032D92AE01DC9062 = { - fRef = F56F96AC032D92AE01DC9062; - isa = PBXTextBookmark; - name = "CarbonEventsCore.h: 746"; - rLen = 105; - rLoc = 24230; - rType = 0; - vrLen = 1165; - vrLoc = 23633; - }; - F56F96AA032D92AE01DC9062 = { - isa = PBXFileReference; - name = tclInt.h; - path = /Volumes/CodeBits/jingham/Tcl/Source/tcl/generic/tclInt.h; - refType = 0; - }; - F56F96AB032D92AE01DC9062 = { - isa = PBXFileReference; - name = tclDecls.h; - path = /Volumes/CodeBits/jingham/Tcl/Source/tcl/generic/tclDecls.h; - refType = 0; - }; - F56F96AC032D92AE01DC9062 = { - isa = PBXFileReference; - name = CarbonEventsCore.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEventsCore.h; - refType = 0; - }; - F56F96AD032D92AE01DC9062 = { - isa = PBXFileReference; - name = tclInt.h; - path = /Volumes/CodeBits/jingham/Tcl/Source/tcl/generic/tclInt.h; - refType = 0; - }; - F56F96AE032D92AE01DC9062 = { - isa = PBXFileReference; - name = tclDecls.h; - path = /Volumes/CodeBits/jingham/Tcl/Source/tcl/generic/tclDecls.h; - refType = 0; - }; - F56F96AF032D92AE01DC9062 = { - isa = PBXFileReference; - name = CarbonEventsCore.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/CarbonEventsCore.h; - refType = 0; - }; - F576829E03493B6F01DC9062 = { - fRef = F5375560016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: TkpComputeScrollbarGeometry"; - rLen = 0; - rLoc = 12482; - rType = 0; - vrLen = 1571; - vrLoc = 12512; - }; F5979A0A033DA68401DC9062 = { fileReference = F5375560016C376E01DC9062; isa = PBXFileBreakpoint; lineNumber = 1082; state = 2; }; - F5979A0E033DAD6701DC9062 = { - fRef = F5375580016C389901DC9062; - isa = PBXTextBookmark; - name = "tk3d.c: Tk_Get3DBorder"; - rLen = 32; - rLoc = 6336; - rType = 0; - vrLen = 1226; - vrLoc = 5724; - }; - F5979A10033DAD6701DC9062 = { - fRef = F537555D016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXNotify.c: TkMacOSXCreateFakeEvent"; - rLen = 6; - rLoc = 33036; - rType = 0; - vrLen = 1083; - vrLoc = 32042; - }; - F5979A11033DAD6701DC9062 = { - fRef = F5375560016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: UpdateControlValues"; - rLen = 0; - rLoc = 37888; - rType = 0; - vrLen = 1558; - vrLoc = 36106; - }; - F5979A12033DAD6701DC9062 = { - fRef = F5375580016C389901DC9062; - isa = PBXTextBookmark; - name = "tk3d.c: Tk_Get3DBorder"; - rLen = 32; - rLoc = 6336; - rType = 0; - vrLen = 1226; - vrLoc = 5724; - }; - F597EADD036E210C01DC9062 = { - fRef = F537554A016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXButton.c: TkMacOSXComputeControlParams"; - rLen = 22; - rLoc = 46421; - rType = 0; - vrLen = 2037; - vrLoc = 46050; - }; - F597EADE036E210C01DC9062 = { - fRef = F597EAED036E210D01DC9062; - isa = PBXTextBookmark; - name = "ControlDefinitions.h: 963"; - rLen = 17; - rLoc = 38792; - rType = 0; - vrLen = 1564; - vrLoc = 37892; - }; - F597EADF036E210C01DC9062 = { - fRef = F537557D016C37A601DC9062; - isa = PBXTextBookmark; - name = "tkScrollbar.h: 37"; - rLen = 0; - rLoc = 817; - rType = 0; - vrLen = 973; - vrLoc = 576; - }; - F597EAE0036E210C01DC9062 = { - fRef = F5375560016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: 53"; - rLen = 11; - rLoc = 1330; - rType = 0; - vrLen = 608; - vrLoc = 1121; - }; - F597EAE2036E210C01DC9062 = { - fRef = F537554A016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXButton.c: TkMacOSXComputeControlParams"; - rLen = 22; - rLoc = 46421; - rType = 0; - vrLen = 2037; - vrLoc = 46050; - }; - F597EAE3036E210C01DC9062 = { - fRef = F597EAEB036E210D01DC9062; - isa = PBXTextBookmark; - name = "ControlDefinitions.h: 963"; - rLen = 17; - rLoc = 38792; - rType = 0; - vrLen = 1564; - vrLoc = 37892; - }; - F597EAE4036E210C01DC9062 = { - fRef = F5375560016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXScrlbr.c: 53"; - rLen = 11; - rLoc = 1330; - rType = 0; - vrLen = 608; - vrLoc = 1121; - }; - F597EAEB036E210D01DC9062 = { - isa = PBXFileReference; - name = ControlDefinitions.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/ControlDefinitions.h; - refType = 0; - }; - F597EAED036E210D01DC9062 = { - isa = PBXFileReference; - name = ControlDefinitions.h; - path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/ControlDefinitions.h; - refType = 0; - }; - F59B1688036E127001DC9062 = { - fRef = F5375551016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXDraw.c: TkMacOSXSetUpGraphicsPort"; - rLen = 0; - rLoc = 40093; - rType = 0; - vrLen = 1389; - vrLoc = 39919; - }; - F59B1689036E127001DC9062 = { - fRef = F5375559016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXMenu.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1121; - vrLoc = 0; - }; - F59B168A036E127001DC9062 = { - fRef = F5375554016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXFont.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1051; - vrLoc = 0; - }; - F59B168B036E127001DC9062 = { - fRef = F5375548016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXAppInit.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1158; - vrLoc = 0; - }; - F59B168C036E127001DC9062 = { - fRef = F5375558016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXKeyEvent.c: GenerateKeyEvent"; - rLen = 28; - rLoc = 12290; - rType = 0; - vrLen = 1480; - vrLoc = 11578; - }; - F59B168D036E127001DC9062 = { - fRef = F5375551016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXDraw.c: TkMacOSXSetUpGraphicsPort"; - rLen = 0; - rLoc = 40093; - rType = 0; - vrLen = 1389; - vrLoc = 39919; - }; - F59B168E036E127001DC9062 = { - fRef = F5375559016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXMenu.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1121; - vrLoc = 0; - }; - F59B168F036E127001DC9062 = { - fRef = F5375554016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXFont.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1051; - vrLoc = 0; - }; - F59B1690036E127001DC9062 = { - fRef = F5375548016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXAppInit.c: __VERSION__"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1158; - vrLoc = 0; - }; - F59B1691036E127001DC9062 = { - fRef = F5375558016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXKeyEvent.c: GenerateKeyEvent"; - rLen = 28; - rLoc = 12290; - rType = 0; - vrLen = 1480; - vrLoc = 11578; - }; - F5ECAB86035A798D01DC9062 = { - fRef = F5ECAB8F035A798E01DC9062; - isa = PBXTextBookmark; - name = "DefaultsDoc.rtf: 54"; - rLen = 0; - rLoc = 4828; - rType = 0; - vrLen = 1484; - vrLoc = 5646; - }; - F5ECAB89035A798D01DC9062 = { - fRef = F537554C016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXColor.c: TkSetMacColor"; - rLen = 0; - rLoc = 2516; - rType = 0; - vrLen = 1144; - vrLoc = 4392; - }; - F5ECAB8A035A798D01DC9062 = { - fRef = F5ECAB90035A798E01DC9062; - isa = PBXTextBookmark; - name = "DefaultsDoc.rtf: 54"; - rLen = 0; - rLoc = 4828; - rType = 0; - vrLen = 1484; - vrLoc = 5646; - }; - F5ECAB8B035A798D01DC9062 = { - fRef = F5375558016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXKeyEvent.c: GenerateKeyEvent"; - rLen = 28; - rLoc = 12290; - rType = 0; - vrLen = 1516; - vrLoc = 11579; - }; - F5ECAB8C035A798D01DC9062 = { - fRef = F537554A016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXButton.c: TkpDisplayButton"; - rLen = 0; - rLoc = 9683; - rType = 0; - vrLen = 1616; - vrLoc = 8380; - }; - F5ECAB8D035A798D01DC9062 = { - fRef = F537554C016C376E01DC9062; - isa = PBXTextBookmark; - name = "tkMacOSXColor.c: TkSetMacColor"; - rLen = 0; - rLoc = 2516; - rType = 0; - vrLen = 1144; - vrLoc = 4392; - }; - F5ECAB8F035A798E01DC9062 = { - isa = PBXFileReference; - name = DefaultsDoc.rtf; - path = "/Developer/Applications/Project Builder.app/Contents/Resources/DefaultsDoc.rtf"; - refType = 0; - }; - F5ECAB90035A798E01DC9062 = { - isa = PBXFileReference; - name = DefaultsDoc.rtf; - path = "/Developer/Applications/Project Builder.app/Contents/Resources/DefaultsDoc.rtf"; - refType = 0; - }; } diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index a55d0fd..f0448e6 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -1,10 +1,7 @@ /* * tkMacOSXEvent.c -- * - * This file contains most of the X calls called by Tk. Many of - * these calls are just stubs and either don't make sense on the - * Macintosh or thier implamentation just doesn't do anything. Other - * calls will eventually be moved into other files. + * This file contains the basic Mac OS X Event handling routines. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. @@ -12,57 +9,47 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.2 2002/08/31 06:12:29 das Exp $ + * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3 2003/02/19 19:27:46 wolfsuit Exp $ */ #include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <pthread.h> -#include <sys/types.h> -#include <sys/ioctl.h> #include "tkMacOSXInt.h" #include "tkMacOSXEvent.h" #include "tkMacOSXDebug.h" -#define TK_MAC_DEBUG 1 - /* - * The following are undocumented event classes - * + * Enable this define to get debug printing for events not handled. */ -enum { - kEventClassUser = 'user', - kEventClassCgs = 'cgs ', -}; - -/* - * The following are undocumented event kinds - * - */ -enum { - kEventMouse8 = 8, - kEventMouse9 = 9, - kEventApp103 = 103 -}; -EventRef TkMacOSXCreateFakeEvent (); + /*#define TK_MAC_DEBUG 1 */ /* * Forward declarations of procedures used in this file. */ -static int ReceiveAndProcessEvent _ANSI_ARGS_(()); + +static int TkMacOSXProcessAppleEvent( + TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr); +static int TkMacOSXProcessEvent( + TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr); + +static int ReceiveAndProcessEvent (void); + +/* + * Global data used in this file. + */ static EventTargetRef targetRef; + /* *---------------------------------------------------------------------- * * tkMacOSXFlushWindows -- * - * This routine flushes all the Carbon windows of the application - * It is called by the setup procedure for the Tcl/Carbon event source + * This routine flushes all the Carbon windows of the application. It + * is called by the setup procedure for the Tcl/Carbon event source. + * * Results: * None. * @@ -84,22 +71,24 @@ tkMacOSXFlushWindows () } wRef=GetNextWindow(wRef); } -} +} + /* *---------------------------------------------------------------------- * * TkMacOSXCountAndProcessMacEvents -- * - * This routine receives any Carbon events that aare in the - * queue and converts them to tk events - * It is called by the event set-up and check routines + * This routine receives any Carbon events that are in the queue and + * converts them to Tk events. It is called by the event set-up and + * check routines + * * Results: * The number of events in the queue. * * Side effects: - * Tells the Window Manager to deliver events to the event - * queue of the current thread. - * Receives any Carbon events on the queue and converts them to tk events + * Tells the Window Manager to deliver events to the event queue of the + * current thread. Receives any Carbon events on the queue and converts + * them to Tk events. * *---------------------------------------------------------------------- */ @@ -118,7 +107,8 @@ TkMacOSXCountAndProcessMacEvents() } } return eventCount; -} +} + /* *---------------------------------------------------------------------- * @@ -127,11 +117,11 @@ TkMacOSXCountAndProcessMacEvents() * This processes Apple events * * Results: - * 0 on success - * -1 on failure + * 0 on success + * -1 on failure * * Side effects: - * Calls the Tk high-level event handler + * Calls the Tk high-level event handler * *---------------------------------------------------------------------- */ @@ -152,8 +142,6 @@ TkMacOSXProcessAppleEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) CarbonEventToAscii(eventPtr->eventRef, buf1), ClassicEventToAscii(&eventRecord,buf2), err); statusPtr->err = 1; - } else { - statusPtr->handledByTk = 1; } } else { statusPtr->err = 1; @@ -162,6 +150,7 @@ TkMacOSXProcessAppleEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) return 0; } + /* *---------------------------------------------------------------------- * @@ -169,6 +158,12 @@ TkMacOSXProcessAppleEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) * * This dispatches a filtered Carbon event to the appropriate handler * + * Note on MacEventStatus.stopProcessing: Please be conservative in the + * individual handlers and don't assume the event is fully handled + * unless you *really* need to ensure that other handlers don't see the + * event anymore. Some OS manager or library might be interested in + * events even after they are already handled on the Tk level. + * * Results: * 0 on success * -1 on failure @@ -198,10 +193,8 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) case kEventClassAppleEvent: TkMacOSXProcessAppleEvent(eventPtr, statusPtr); break; - case kEventClassCgs: - case kEventClassUser: case kEventClassWish: - statusPtr->handledByTk = 1; + statusPtr->stopProcessing = 1; break; default: #ifdef TK_MAC_DEBUG @@ -217,21 +210,22 @@ TkMacOSXProcessEvent(TkMacOSXEvent * eventPtr, MacEventStatus * statusPtr) } return 0; } + /* *---------------------------------------------------------------------- * * ReceiveAndProcessEvent -- * - * This receives a carbon event and converts it to a tk event + * This receives a carbon event and converts it to a Tk event * * Results: * 0 on success * Mac OS error number on failure * * Side effects: - * This receives the next Carbon event - * and converts it to the appropriate tk event + * This receives the next Carbon event and converts it to the + * appropriate Tk event * *---------------------------------------------------------------------- */ @@ -258,13 +252,17 @@ ReceiveAndProcessEvent() macEvent.eKind = GetEventKind(macEvent.eventRef); bzero(&eventStatus, sizeof(eventStatus)); TkMacOSXProcessEvent(&macEvent,&eventStatus); - if (!eventStatus.handledByTk) { + if (!eventStatus.stopProcessing) { if (!targetRef) { targetRef=GetEventDispatcherTarget(); } err= SendEventToEventTarget(macEvent.eventRef,targetRef); - if (err != noErr /* && err != eventNotHandledErr */) { + if (err != noErr +#if !TK_MAC_DEBUG + && err != eventNotHandledErr +#endif + ) { fprintf(stderr, "RCNE SendEventToEventTarget (%s) failed, %d\n", CarbonEventToAscii(macEvent.eventRef,buf ),err); diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h index 2ce339b..4c5ad59 100644 --- a/macosx/tkMacOSXEvent.h +++ b/macosx/tkMacOSXEvent.h @@ -62,7 +62,7 @@ enum { }; typedef struct { - int handledByTk; + int stopProcessing; int err; char errMsg[1024]; } MacEventStatus; @@ -83,4 +83,11 @@ int TkMacOSXProcessWindowEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); int TkMacOSXProcessKeyboardEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); int TkMacOSXProcessApplicationEvent(TkMacOSXEvent * e, MacEventStatus * statusPtr); +int TkMacOSXKeycodeToUnicode( + UniChar * uniChars, int maxChars, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr); + + #endif diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 78a37eb..eee1844 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -1,7 +1,7 @@ /* * tkMacOSXKeyEvent.c -- * - * This file implements functions that decode & handle keyboard events + * This file implements functions that decode & handle keyboard events * on MacOS X. * * Copyright 2001, Apple Computer, Inc. @@ -66,35 +66,51 @@ typedef struct { UInt32 message; } KeyEventData; -static Tk_Window gGrabWinPtr = NULL; /* Current grab window, NULL if no grab. */ +static Tk_Window gGrabWinPtr = NULL; /* Current grab window, + * NULL if no grab. */ static Tk_Window gKeyboardWinPtr = NULL; /* Current keyboard grab window. */ -static UInt32 deadKeyState = 0; +static UInt32 deadKeyStateUp = 0; /* The deadkey state for the current + * sequence of keyup events or 0 if + * not in a deadkey sequence */ +static UInt32 deadKeyStateDown = 0; /* Ditto for keydown */ /* * Declarations for functions used only in this file. */ -static int GenerateKeyEvent _ANSI_ARGS_(( EventKind eKind, +static int InitKeyData( + KeyEventData * keyEventDataPtr); + +static int InitKeyEvent( + XEvent * eventPtr, KeyEventData * e, - Window window, UInt32 savedKeyCode, - UInt32 savedModifiers)); + UInt32 savedModifiers); +static int GenerateKeyEvent ( + UInt32 eKind, + KeyEventData * e, + UInt32 savedKeyCode, + UInt32 savedModifiers, + const UniChar * chars, int numChars); static int GetKeyboardLayout ( - Ptr * resource ); - -static int DecodeViaUnicodeResource( - Ptr uchr, - EventKind eKind, - const KeyEventData * e, - XEvent * event ); -static int DecodeViaKCHRResource( - Ptr kchr, - const KeyEventData * e, - XEvent * event ); - + Ptr * resource); + +static int KeycodeToUnicodeViaUnicodeResource( + UniChar * uniChars, int maxChars, + Ptr uchr, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr); + +static int KeycodeToUnicodeViaKCHRResource( + UniChar * uniChars, int maxChars, + Ptr kchr, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr); /* *---------------------------------------------------------------------- @@ -119,22 +135,22 @@ int TkMacOSXProcessKeyboardEvent( { static UInt32 savedKeyCode = 0; static UInt32 savedModifiers = 0; + static UniChar savedChar = 0; OSStatus status; KeyEventData keyEventData; - Window window; +#if 0 MenuRef menuRef; MenuItemIndex menuItemIndex; +#endif int eventGenerated; - - statusPtr->handledByTk = 1; - keyEventData.whichWindow = FrontNonFloatingWindow(); - if (keyEventData.whichWindow == NULL) { - return 0; + UniChar uniChars[5]; /* make this larger, if needed */ + UInt32 uniCharsLen; + + if (!InitKeyData(&keyEventData)) { + statusPtr->err = 1; + return false; } - GetMouse(&keyEventData.local); - keyEventData.global = keyEventData.local; - LocalToGlobal(&keyEventData.global); - keyEventData.state = TkMacOSXButtonKeyState(); + #if 0 /* * This block of code seems like a good idea, to trap @@ -163,7 +179,7 @@ int TkMacOSXProcessKeyboardEvent( int selection; menuID = GetMenuID(menuRef); - selection = (menuID << 16 ) | menuItemIndex; + selection = (menuID << 16) | menuItemIndex; GetKeys(theKeys); oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); @@ -173,10 +189,10 @@ int TkMacOSXProcessKeyboardEvent( * Handle -postcommand */ - TkMacOSXPreprocessMenu(); - TkMacOSXHandleMenuSelect(selection, theKeys[1] & 4); - Tcl_SetServiceMode(oldMode); - return 0; /* TODO: may not be on event on queue. */ + TkMacOSXPreprocessMenu(); + TkMacOSXHandleMenuSelect(selection, theKeys[1] & 4); + Tcl_SetServiceMode(oldMode); + return 0; /* TODO: may not be on event on queue. */ } #endif @@ -186,9 +202,9 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.ch), NULL, &keyEventData.ch); if (status != noErr) { - fprintf(stderr, "Failed to retrieve KeyMacCharCodes\n" ); + fprintf (stderr, "Failed to retrieve KeyMacCharCodes\n"); statusPtr->err = 1; - return 1; + return false; } status = GetEventParameter(eventPtr->eventRef, kEventParamKeyCode, @@ -196,9 +212,9 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.keyCode), NULL, &keyEventData.keyCode); if (status != noErr) { - fprintf(stderr, "Failed to retrieve KeyCode\n" ); + fprintf (stderr, "Failed to retrieve KeyCode\n"); statusPtr->err = 1; - return 1; + return false; } status = GetEventParameter(eventPtr->eventRef, kEventParamKeyModifiers, @@ -206,43 +222,102 @@ int TkMacOSXProcessKeyboardEvent( sizeof(keyEventData.keyModifiers), NULL, &keyEventData.keyModifiers); if (status != noErr) { - fprintf(stderr, "Failed to retrieve KeyModifiers\n" ); + fprintf (stderr, "Failed to retrieve KeyModifiers\n"); statusPtr->err = 1; - return 1; + return false; + } + + switch (eventPtr->eKind) { + case kEventRawKeyUp: + case kEventRawKeyDown: + case kEventRawKeyRepeat: + { + UInt32 *deadKeyStatePtr; + + if (kEventRawKeyDown == eventPtr->eKind) { + deadKeyStatePtr = &deadKeyStateDown; + } else { + deadKeyStatePtr = &deadKeyStateUp; + } + + uniCharsLen = TkMacOSXKeycodeToUnicode( + uniChars, sizeof(uniChars)/sizeof(*uniChars), + eventPtr->eKind, + keyEventData.keyCode, keyEventData.keyModifiers, + deadKeyStatePtr); + } + } + + if (kEventRawKeyUp == eventPtr->eKind) { + /* + * For some reason the deadkey processing for KeyUp doesn't work + * sometimes, so we fudge and use the last detected KeyDown. + */ + + if((0 == uniCharsLen) && (0 != savedChar)) { + uniChars[0] = savedChar; + uniCharsLen = 1; + } + + /* + * Suppress keyup events while we have a deadkey sequence on keydown. + * We still *do* want to collect deadkey state in this situation if + * the system provides it, that's why we do this only after + * TkMacOSXKeycodeToUnicode(). + */ + + if (0 != deadKeyStateDown) { + uniCharsLen = 0; + } } + keyEventData.message = keyEventData.ch|(keyEventData.keyCode << 8); - window = TkMacOSXGetXWindow(keyEventData.whichWindow); - - eventGenerated = GenerateKeyEvent(eventPtr->eKind, &keyEventData, - window, savedKeyCode, savedModifiers); + eventGenerated = GenerateKeyEvent( + eventPtr->eKind, &keyEventData, + savedKeyCode, savedModifiers, + uniChars, uniCharsLen); + savedModifiers = keyEventData.keyModifiers; + + if ((kEventRawKeyDown == eventPtr->eKind) && (uniCharsLen > 0)) { + savedChar = uniChars[0]; + } else { + savedChar = 0; + } + statusPtr->stopProcessing = 1; + if (eventGenerated == 0) { - savedKeyCode = keyEventData.message; - return false; + savedKeyCode = keyEventData.message; + return false; } else if (eventGenerated == -1) { - savedKeyCode = 0; - return false; + savedKeyCode = 0; + statusPtr->stopProcessing = 0; + return false; } else { - savedKeyCode = 0; - return true; + savedKeyCode = 0; + return true; } } - + /* *---------------------------------------------------------------------- * * GenerateKeyEvent -- * - * Given Macintosh keyUp, keyDown & autoKey events this function - * generates the appropiate X key events. The window that is passed - * should represent the frontmost window - which will recieve the - * event. + * Given Macintosh keyUp, keyDown & autoKey events (in their "raw" + * form) and a list of unicode characters this function generates the + * appropriate X key events. + * + * Parameter eKind is a raw keyboard event. e contains the data sent + * with the event. savedKeyCode and savedModifiers contain the values + * from the last event that came before (see + * TkMacOSXProcessKeyboardEvent()). chars/numChars has the Unicode + * characters for which we want to create events. * * Results: - * 1 if an event was generated, 0 if we are waiting for another - * byte of a multi-byte sequence, and -1 for any other error. + * 1 if an event was generated, -1 for any error. * * Side effects: * Additional events may be place on the Tk event queue. @@ -251,14 +326,173 @@ int TkMacOSXProcessKeyboardEvent( */ static int -GenerateKeyEvent( EventKind eKind, +GenerateKeyEvent( + UInt32 eKind, KeyEventData * e, - Window window, UInt32 savedKeyCode, - UInt32 savedModifiers ) + UInt32 savedModifiers, + const UniChar * chars, int numChars) { - Tk_Window tkwin; XEvent event; + int i; + + if (-1 == InitKeyEvent(&event, e, savedKeyCode, savedModifiers)) { + return -1; + } + + if (kEventRawKeyModifiersChanged == eKind) { + + if (savedModifiers > e->keyModifiers) { + event.xany.type = KeyRelease; + } else { + event.xany.type = KeyPress; + } + + /* + * Use special '-1' to signify a special keycode to our + * platform specific code in tkMacOSXKeyboard.c. This is + * rather like what happens on Windows. + */ + + event.xany.send_event = -1; + + /* + * Set keycode (which was zero) to the changed modifier + */ + + event.xkey.keycode = (e->keyModifiers ^ savedModifiers); + Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); + + } else { + + for (i=0; i<numChars; ++i) { + + /* + * Encode one char in the trans_chars array that was already + * introduced for MS Windows. Don't encode the string, if it is + * a control character but was not generated with a real control + * modifier. Such control characters get generated by KeyTrans() + * for special keys, but we rather want to identify those by + * their KeySyms. + */ + + event.xkey.trans_chars[0] = 0; + if ((controlKey & e->keyModifiers) || (chars[i] >= ' ')) { + int done; + done = Tcl_UniCharToUtf(chars[i],event.xkey.trans_chars); + event.xkey.trans_chars[done] = 0; + } + + switch(eKind) { + case kEventRawKeyDown: + event.xany.type = KeyPress; + Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); + break; + case kEventRawKeyUp: + event.xany.type = KeyRelease; + Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); + break; + case kEventRawKeyRepeat: + event.xany.type = KeyRelease; + Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); + event.xany.type = KeyPress; + Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); + break; + default: + fprintf (stderr, + "GenerateKeyEvent(): Invalid parameter eKind %d\n", + (int) eKind); + return -1; + } + } + } + + return 1; +} + +/* + *---------------------------------------------------------------------- + * + * InitKeyData -- + * + * This routine initializes a KeyEventData structure by asking the OS + * and Tk for all the global information needed here. + * + * Results: + * True if the current front window can be found in Tk data structures + * - false otherwise. + * + * Side Effects: + * None + * + *---------------------------------------------------------------------- + */ +static int +InitKeyData(KeyEventData * keyEventDataPtr) +{ + memset (keyEventDataPtr, 0, sizeof(*keyEventDataPtr)); + + keyEventDataPtr->whichWindow = FrontNonFloatingWindow(); + if (keyEventDataPtr->whichWindow == NULL) { + return false; + } + GetMouse(&keyEventDataPtr->local); + keyEventDataPtr->global = keyEventDataPtr->local; + LocalToGlobal(&keyEventDataPtr->global); + keyEventDataPtr->state = TkMacOSXButtonKeyState(); + + return true; +} + +/* + *---------------------------------------------------------------------- + * + * InitKeyEvent -- + * + * Initialize an XEvent structure by asking Tk for global information. + * Also uses a KeyEventData structure and other current state. + * + * Results: + * 1 on success, -1 for any error. + * + * Side effects: + * Additional events may be place on the Tk event queue. + * + *---------------------------------------------------------------------- + */ + +/* + * We have a general problem here. How do we handle 'Option-char' + * keypresses? The problem is that we might want to bind to some of these + * (e.g. Cmd-Opt-d is 'uncomment' in Alpha). OTOH Option-d actually produces + * a real character on MacOS, namely a mathematical delta. + * + * The current behaviour is that a binding goes by the combinations of + * modifiers and base keysym, that is Option-d. The string value of the + * event is the mathematical delta character, so if no binding calls + * [break], the text widget will insert that character. + * + * Note that this is similar to control combinations on all platforms. They + * also generate events that have the base character as keysym and a real + * control character as character value. So Ctrl+C gets us the keysym XK_C, + * the modifier Control (so you can bind <Control-C>) and a string value as + * "\u0003". + * + * For a different solutions we may want for the event to contain keysyms for + * *both* the 'Opt-d' side of things and the mathematical delta. Then a + * binding on Opt-d will trigger, but a binding on mathematical delta would + * also trigger. This would require changes in the core, though. + */ + +static int +InitKeyEvent( + XEvent * eventPtr, + KeyEventData * e, + UInt32 savedKeyCode, + UInt32 savedModifiers) +{ + Window window; + Tk_Window tkwin; TkDisplay *dispPtr; /* @@ -267,6 +501,7 @@ GenerateKeyEvent( EventKind eKind, * that owns the focus. */ + window = TkMacOSXGetXWindow(e->whichWindow); dispPtr = TkGetDisplayList(); tkwin = Tk_IdToWindow(dispPtr->display, window); @@ -281,127 +516,58 @@ GenerateKeyEvent( EventKind eKind, return -1; } - event.xkey.trans_chars[0] = 0; - - if (0 != e->ch) { - Ptr resource = NULL; - if (GetKeyboardLayout(&resource)) { - if (0 == DecodeViaUnicodeResource(resource,eKind,e,&event)) - return 0; - } else { - if (0 == DecodeViaKCHRResource(resource,e,&event)) - return 0; - } - } - - event.xany.send_event = False; - event.xkey.same_screen = true; - event.xkey.subwindow = None; - event.xkey.time = TkpGetMS(); - - event.xkey.x_root = e->global.h; - event.xkey.y_root = e->global.v; - Tk_TopCoordsToWindow(tkwin, e->local.h, e->local.v, - &event.xkey.x, &event.xkey.y); - - /* - * Now, we may have a problem here. How do we handle 'Option-char' - * keypresses? The problem is that we might want to bind to some of - * these (e.g. Cmd-Opt-d is 'uncomment' in Alpha), but Option-d - * generates a 'delta' symbol with some keycode unrelated to 'd', and so - * the binding never triggers. In any case, the delta that is produced - * is never mapped to an 'XK_Greek_DELTA' keysym so bindings on that - * won't work either (a general KeyPress binding will of course trigger, - * but a specific binding on XK_Greek_DELTA will not). - * - * I think what we want is for the event to contain information on - * both the 'Opt-d' side of things and the 'delta'. Then a binding - * on Opt-d will trigger, but the ascii/string representation of the - * event will be a delta. - * - * A different way to look at this is that 'Opt-d' is delta, but that - * Command-Opt-d is nothing to do with delta, but I'm not sure that is - * helpful. - * - * Also some keypresses (Opt-e) are dead-keys to add accents to - * letters. We don't handle them yet. - * - * Help needed! - */ - event.xkey.keycode = e->ch | + eventPtr->xany.send_event = false; + eventPtr->xany.serial = Tk_Display(tkwin)->request; + + eventPtr->xkey.same_screen = true; + eventPtr->xkey.subwindow = None; + eventPtr->xkey.time = TkpGetMS(); + eventPtr->xkey.x_root = e->global.h; + eventPtr->xkey.y_root = e->global.v; + eventPtr->xkey.window = Tk_WindowId(tkwin); + eventPtr->xkey.display = Tk_Display(tkwin); + eventPtr->xkey.root = XRootWindow(Tk_Display(tkwin), 0); + eventPtr->xkey.state = e->state; + eventPtr->xkey.trans_chars[0] = 0; + + Tk_TopCoordsToWindow( + tkwin, e->local.h, e->local.v, + &eventPtr->xkey.x, &eventPtr->xkey.y); + + eventPtr->xkey.keycode = e->ch | ((savedKeyCode & charCodeMask) << 8) | ((e->message&keyCodeMask) << 8); - - event.xany.serial = Tk_Display(tkwin)->request; - event.xkey.window = Tk_WindowId(tkwin); - event.xkey.display = Tk_Display(tkwin); - event.xkey.root = XRootWindow(Tk_Display(tkwin), 0); - event.xkey.state = e->state; - - switch(eKind) { - case kEventRawKeyDown: - event.xany.type = KeyPress; - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - break; - case kEventRawKeyUp: - event.xany.type = KeyRelease; - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - break; - case kEventRawKeyRepeat: - event.xany.type = KeyRelease; - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - event.xany.type = KeyPress; - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - break; - case kEventRawKeyModifiersChanged: - if (savedModifiers > e->keyModifiers) { - event.xany.type = KeyRelease; - } else { - event.xany.type = KeyPress; - } - /* - * Use special '-1' to signify a special keycode to - * our platform specific code in tkMacOSXKeyboard.c. - * This is rather like what happens on Windows. - */ - event.xany.send_event = -1; - /* Set keycode (which was zero) to the changed modifier */ - event.xkey.keycode = (e->keyModifiers ^ savedModifiers); - Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); - break; - default: - break; - } + return 1; } + /* *---------------------------------------------------------------------- * * GetKeyboardLayout -- * - * Queries the OS for a pointer to a keyboard resource. + * Queries the OS for a pointer to a keyboard resource. * - * NB (benny): This function is supposed to work with the - * keyboard layout switch menu that we have in 10.2. Currently - * the menu is not enabled at all for wish, so I can not really - * test it. We will probably have to use real TSM-style event - * handling to get all those goodies, but I haven't figured out - * those bits yet. + * This function works with the keyboard layout switch menu that + * we have in 10.2. * * Results: - * 1 if there is returned a Unicode 'uchr' resource in - * "*resource", 0 if it is a classic 'KCHR' resource. + * 1 if there is returned a Unicode 'uchr' resource in + * "*resource", 0 if it is a classic 'KCHR' resource. A pointer + * to the actual resource data goes into *resource. * * Side effects: - * Sets some internal static variables. + * Sets some internal static variables. * *---------------------------------------------------------------------- */ + static int -GetKeyboardLayout ( Ptr * resource ) +GetKeyboardLayout (Ptr * resource) { - static SInt16 lastKeyLayoutID = -1; /* should be safe */ + static Boolean initialized = false; + static SInt16 lastKeyLayoutID = -1; static Handle uchrHnd = NULL; static Handle KCHRHnd = NULL; @@ -411,182 +577,307 @@ GetKeyboardLayout ( Ptr * resource ) keyScript = GetScriptManagerVariable(smKeyScript); keyLayoutID = GetScriptVariable(keyScript,smScriptKeys); - if (lastKeyLayoutID != keyLayoutID) { - deadKeyState = 0; - lastKeyLayoutID = keyLayoutID; - uchrHnd = GetResource('uchr',keyLayoutID); - if (NULL == uchrHnd) { - KCHRHnd = GetResource('KCHR',keyLayoutID); - } + if (!initialized || (lastKeyLayoutID != keyLayoutID)) { + initialized = true; + deadKeyStateUp = deadKeyStateDown = 0; + lastKeyLayoutID = keyLayoutID; + uchrHnd = GetResource('uchr',keyLayoutID); + if (NULL == uchrHnd) { + KCHRHnd = GetResource('KCHR',keyLayoutID); + } + if ((NULL == uchrHnd) && (NULL == KCHRHnd)) { + initialized = false; + fprintf (stderr, + "GetKeyboardLayout(): " + "Can't get a keyboard layout for layout %d " + "(error code %d)?\n", + (int) keyLayoutID, (int) ResError()); + *resource = (Ptr) GetScriptManagerVariable(smKCHRCache); + fprintf (stderr, + "GetKeyboardLayout(): Trying the cache: %p\n", + *resource); + return 0; + } } if (NULL != uchrHnd) { - *resource = *uchrHnd; - return 1; + *resource = *uchrHnd; + return 1; } else { - *resource = *KCHRHnd; - return 0; + *resource = *KCHRHnd; + return 0; } } + /* *---------------------------------------------------------------------- * - * DecodeViaUnicodeResource -- + * KeycodeToUnicodeViaUnicodeResource -- * - * Given MacOS key event data this function generates the UTF-8 - * characters. It does this using a 'uchr' and the - * UCKeyTranslate API. + * Given MacOS key event data this function generates the Unicode + * characters. It does this using a 'uchr' and the UCKeyTranslate + * API. * - * NB (benny): This function is not tested at all, because my - * system does not actually return a 'uchr' resource in - * GetKeyboardLayout currently. We probably need to do - * TSM-style event handling to get keyboard layout switching - * first. + * The parameter deadKeyStatePtr can be NULL, if no deadkey handling + * is needed. + * + * Tested and known to work with US, Hebrew, Greek and Russian layouts + * as well as "Unicode Hex Input". * * Results: - * 1 if the data was generated, 0 if we are waiting for another - * byte of a dead-key sequence. + * The number of characters generated if any, 0 if we are waiting for + * another byte of a dead-key sequence. Fills in the uniChars array + * with a Unicode string. * - * Side effects: - * Sets the trans_chars array in the XEvent->xkey structure. + * Side Effects: + * None * *---------------------------------------------------------------------- */ static int -DecodeViaUnicodeResource( - Ptr uchr, - EventKind eKind, - const KeyEventData * e, - XEvent * event ) +KeycodeToUnicodeViaUnicodeResource( + UniChar * uniChars, int maxChars, + Ptr uchr, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr) { - /* input of UCKeyTranslate */ - unsigned vkey; int action; - unsigned modifiers; unsigned long keyboardType; - - /* output of UCKeyTranslate */ - enum { BUFFER_SIZE = 16 }; - UniChar unistring[BUFFER_SIZE]; + OptionBits options = 0; + UInt32 dummy_state; UniCharCount actuallength; OSStatus status; - /* for converting the result */ - char utf8buffer[sizeof(event->xkey.trans_chars)+4]; - int s, d; - - vkey = ((e->message) >> 8) & 0xFF; - modifiers = ((e->keyModifiers) >> 8) & 0xFF; + keycode &= 0xFF; + modifiers = (modifiers >> 8) & 0xFF; keyboardType = LMGetKbdType(); - switch(eKind) { - default: /* keep compilers happy */ - case kEventRawKeyDown: action = kUCKeyActionDown; break; - case kEventRawKeyUp: action = kUCKeyActionUp; break; - case kEventRawKeyRepeat: action = kUCKeyActionAutoKey; break; + if (NULL==deadKeyStatePtr) { + options = kUCKeyTranslateNoDeadKeysMask; + dummy_state = 0; + deadKeyStatePtr = &dummy_state; + } + + switch(eKind) { + case kEventRawKeyDown: + action = kUCKeyActionDown; + break; + case kEventRawKeyUp: + action = kUCKeyActionUp; + break; + case kEventRawKeyRepeat: + action = kUCKeyActionAutoKey; + break; + default: + fprintf (stderr, + "KeycodeToUnicodeViaUnicodeResource(): " + "Invalid parameter eKind %d\n", + (int) eKind); + return 0; } status = UCKeyTranslate( - (const UCKeyboardLayout *)uchr, - vkey, action, modifiers, keyboardType, - 0, &deadKeyState, BUFFER_SIZE, &actuallength, unistring); + (const UCKeyboardLayout *) uchr, + keycode, action, modifiers, keyboardType, + options, deadKeyStatePtr, + maxChars, &actuallength, uniChars); - if (0 != deadKeyState) - return 0; /* more data later */ + if ((0 == actuallength) && (0 != *deadKeyStatePtr)) { + /* + * More data later + */ + + return 0; + } + + /* + * some IMEs leave residue :-( + */ + + *deadKeyStatePtr = 0; if (noErr != status) { - fprintf(stderr,"UCKeyTranslate failed: %d", (int) status); - actuallength = 0; - } - s = 0; - d = 0; - while (s<actuallength) { - int newd = d + Tcl_UniCharToUtf(unistring[s],utf8buffer+d); - if (newd > (sizeof(event->xkey.trans_chars)-1)) { - break; - } - d = newd; - ++s; + fprintf(stderr,"UCKeyTranslate failed: %d", (int) status); + actuallength = 0; } - utf8buffer[d] = 0; - strcpy(event->xkey.trans_chars, utf8buffer); - return 1; + return actuallength; } - + /* *---------------------------------------------------------------------- * - * DecodeViaKCHRResource -- + * KeycodeToUnicodeViaKCHRResource -- * - * Given MacOS key event data this function generates the UTF-8 - * characters. It does this using a 'KCHR' and the - * KeyTranslate API. + * Given MacOS key event data this function generates the Unicode + * characters. It does this using a 'KCHR' and the KeyTranslate API. * - * NB (benny): The function is not actually tested with double - * byte encodings yet. + * The parameter deadKeyStatePtr can be NULL, if no deadkey handling + * is needed. * * Results: - * 1 if the data was generated, 0 if we are waiting for another - * byte of a dead-key sequence. + * The number of characters generated if any, 0 if we are waiting for + * another byte of a dead-key sequence. Fills in the uniChars array + * with a Unicode string. * - * Side effects: - * Sets the trans_chars array in the XEvent->xkey structure. + * Side Effects: + * None * *---------------------------------------------------------------------- */ + static int -DecodeViaKCHRResource( - Ptr kchr, - const KeyEventData * e, - XEvent * event ) +KeycodeToUnicodeViaKCHRResource( + UniChar * uniChars, int maxChars, + Ptr kchr, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr) { - /* input and output of KeyTranslate */ - UInt16 keycode; UInt32 result; + char macBuff[3]; + char * macStr; + int macStrLen; + UInt32 dummy_state = 0; - /* for converting the result */ - char macbuff[2]; - char * macstr; - int maclen; - keycode = e->keyCode | e->keyModifiers; - result = KeyTranslate(kchr, keycode, &deadKeyState); + if (NULL == deadKeyStatePtr) { + deadKeyStatePtr = &dummy_state; + } + + keycode |= modifiers; + result = KeyTranslate(kchr, keycode, deadKeyStatePtr); + + if ((0 == result) && (0 != dummy_state)) { + /* + * 'dummy_state' gets only filled if the caller did not want deadkey + * processing (deadKeyStatePtr was NULL originally), but we still + * have a deadkey. We just push the keycode for the space bar to get + * the real key value. + */ + + result = KeyTranslate(kchr, 0x31, deadKeyStatePtr); + *deadKeyStatePtr = 0; + } - if (0 != deadKeyState) - return 0; /* more data later */ + if ((0 == result) && (0 != *deadKeyStatePtr)) { + /* + * More data later + */ + + return 0; + } - macbuff[0] = (char) (result >> 16); - macbuff[1] = (char) result; + macBuff[0] = (char) (result >> 16); + macBuff[1] = (char) result; + macBuff[2] = 0; - if (0 != macbuff[0]) { - /* if the first byte is valid, the second is too */ - macstr = macbuff; - maclen = 2; - } else if (0 != macbuff[1]) { - /* only the second is valid */ - macstr = macbuff+1; - maclen = 1; + if (0 != macBuff[0]) { + /* + * If the first byte is valid, the second is too + */ + + macStr = macBuff; + macStrLen = 2; + } else if (0 != macBuff[1]) { + /* + * Only the second is valid + */ + + macStr = macBuff+1; + macStrLen = 1; } else { - /* no valid bytes at all */ - macstr = NULL; - maclen = 0; + /* + * No valid bytes at all -- shouldn't happen + */ + + macStr = NULL; + macStrLen = 0; } - if (maclen > 0) { - int result = Tcl_ExternalToUtf( - NULL, TkMacOSXCarbonEncoding, - macstr, maclen, 0, NULL, - event->xkey.trans_chars, sizeof(event->xkey.trans_chars), - NULL, NULL, NULL); + if (macStrLen <= 0) { + return 0; + } else { + /* + * Use the CFString conversion routines. This is the easiest and + * most compatible way to get from an 8-bit string and a MacOS script + * code to a Unicode string. + */ + + CFStringRef cfString; + int uniStrLen; + + cfString = CFStringCreateWithCStringNoCopy( + NULL, macStr, + GetScriptManagerVariable(smKeyScript), + kCFAllocatorNull); + uniStrLen = CFStringGetLength(cfString); + if (uniStrLen > maxChars) { + uniStrLen = maxChars; + } + CFStringGetCharacters(cfString, CFRangeMake(0,uniStrLen), uniChars); + CFRelease(cfString); + + return uniStrLen; } +} - return 1; + +/* + *---------------------------------------------------------------------- + * + * TkMacOSXKeycodeToUnicode -- + * + * Given MacOS key event data this function generates the Unicode + * characters. It does this using OS resources and APIs. + * + * The parameter deadKeyStatePtr can be NULL, if no deadkey handling + * is needed. + * + * This function is called from XKeycodeToKeysym() in + * tkMacOSKeyboard.c. + * + * Results: + * The number of characters generated if any, 0 if we are waiting for + * another byte of a dead-key sequence. Fills in the uniChars array + * with a Unicode string. + * + * Side Effects: + * None + * + *---------------------------------------------------------------------- + */ + +int +TkMacOSXKeycodeToUnicode( + UniChar * uniChars, int maxChars, + EventKind eKind, + UInt32 keycode, UInt32 modifiers, + UInt32 * deadKeyStatePtr) +{ + Ptr resource = NULL; + int len; + + + if (GetKeyboardLayout(&resource)) { + len = KeycodeToUnicodeViaUnicodeResource( + uniChars, maxChars, resource, eKind, + keycode, modifiers, deadKeyStatePtr); + } else { + len = KeycodeToUnicodeViaKCHRResource( + uniChars, maxChars, resource, eKind, + keycode, modifiers, deadKeyStatePtr); + } + + return len; } + + /* *---------------------------------------------------------------------- * @@ -691,15 +982,15 @@ TkpSetCapture( * * Tk_SetCaretPos -- * - * This enables correct placement of the XIM caret. This is called - * by widgets to indicate their cursor placement, and the caret - * location is used by TkpGetString to place the XIM caret. + * This enables correct placement of the XIM caret. This is called + * by widgets to indicate their cursor placement, and the caret + * location is used by TkpGetString to place the XIM caret. * * Results: - * None + * None * * Side effects: - * None + * None * *---------------------------------------------------------------------- */ @@ -707,8 +998,8 @@ TkpSetCapture( void Tk_SetCaretPos(tkwin, x, y, height) Tk_Window tkwin; - int x; - int y; - int height; + int x; + int y; + int height; { } diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 447da04..d20fae7 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.4 2002/10/16 11:29:50 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.5 2003/02/19 19:27:47 wolfsuit Exp $ */ #include "tkInt.h" @@ -17,6 +17,8 @@ #include "X11/keysym.h" #include <Carbon/Carbon.h> #include "tkMacOSXInt.h" +#include "tkMacOSXEvent.h" /* TkMacOSXKeycodeToUnicode() FIXME: That + * function should probably move here */ typedef struct { int keycode; /* Macintosh keycode */ @@ -66,7 +68,6 @@ static int initialized = 0; static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */ static Tcl_HashTable vkeyTable; /* vituralkeyArray hashed by virtual keycode value. */ -static Ptr KCHRPtr; /* Pointer to 'KCHR' resource. */ /* * Prototypes for static functions used in this file. @@ -109,10 +110,6 @@ InitKeyMaps() &dummy); Tcl_SetHashValue(hPtr, kPtr->keysym); } - KCHRPtr = (Ptr) GetScriptManagerVariable(smKCHRCache); - if (!KCHRPtr){ - fprintf(stderr,"GetScriptManagerVariable failed\n"); - } initialized = 1; } @@ -143,7 +140,7 @@ XKeycodeToKeysym( int c; int virtualKey; int newKeycode; - unsigned long dummy, newChar; + UniChar newChar; if (!initialized) { InitKeyMaps(); @@ -184,15 +181,21 @@ XKeycodeToKeysym( * TODO: The index may also specify the NUM_LOCK. */ newKeycode = virtualKey; - if (index & 0x01) { + if (index & 0x01) { newKeycode += 0x0200; } - dummy = 0; - newChar = KeyTranslate(KCHRPtr, (short) newKeycode, &dummy); - c = newChar & charCodeMask; - if (c >= XK_space && c < XK_asciitilde) { - return c; + newChar = 0; + TkMacOSXKeycodeToUnicode( + &newChar, 1, kEventRawKeyDown, + newKeycode & 0x00FF, newKeycode & 0xFF00, NULL); + + /* + * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up + * for other characters for now. + */ + if (newChar >= XK_space && newChar <= 0x255) { + return newChar; } return NoSymbol; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index bc01a32..d92a8fb 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.5 2003/02/18 14:43:45 vincentdarley Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6 2003/02/19 19:27:48 wolfsuit Exp $ */ #include "tkMacOSXInt.h" #include "tkMenuButton.h" @@ -865,35 +865,15 @@ mySetMenuTitle( MenuRef menuHdl, /* The menu we are setting the title of. */ Tcl_Obj *titlePtr) /* The C string to set the title to. */ { - char localBuffer[7]; - Boolean success; char *title = (titlePtr == NULL) ? "" : Tcl_GetStringFromObj(titlePtr, NULL); CFStringRef cf = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8); - success = CFStringGetCString(cf, localBuffer, 7, kCFStringEncodingMacRoman); - if (success && (localBuffer[0] == '\245')) { - OSErr err; - IconSuiteRef ref; - int iconId = atoi(localBuffer + 1); - /* - * Until images/icons are properly supported on MacOS X, - * we allow the user to specify a bullet followed by - * a resource id to use an icon as a menu title - */ - err = GetIconSuite( &ref, iconId, kSelectorAllAvailableData ); - if (err == noErr) { - SetMenuTitleIcon(menuHdl,kMenuIconSuiteType,ref); - /* DisposeIconSuite(ref,true); */ - } else { - SetMenuTitleWithCFString(menuHdl, cf); - } - } else { - SetMenuTitleWithCFString(menuHdl, cf); - } + SetMenuTitleWithCFString(menuHdl, cf); CFRelease(cf); } + static int ParseAccelerators(char **accelStringPtr) { char *accelString = *accelStringPtr; int flags = 0; diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 07c36c5..e771edb 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -82,6 +82,8 @@ static int gEatButtonUp = 0; /* 1 if we need to eat the next * up event */ static void BringWindowForward _ANSI_ARGS_((WindowRef wRef)); static int GeneratePollingEvents(MouseEventData * medPtr); static int GenerateMouseWheelEvent(MouseEventData * medPtr); +static int HandleInGoAway(Tk_Window tkwin, WindowRef winPtr, Point where); +static OSErr HandleInCollapse(WindowRef win); extern int TkMacOSXGetEatButtonUp(); extern void TkMacOSXSetEatButtonUp(int f); @@ -124,11 +126,9 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) case kEventMouseWheelMoved: break; default: - statusPtr->handledByTk = 1; return 0; break; } - statusPtr->handledByTk = 1; status = GetEventParameter(eventPtr->eventRef, kEventParamMouseLocation, typeQDPoint, NULL, @@ -172,7 +172,6 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) medPtr->windowPart= FindWindow(where, &medPtr->whichWin); window = TkMacOSXGetXWindow(medPtr->whichWin); if (medPtr->whichWin != NULL && window == None) { - statusPtr->handledByTk = 0; return 0; } @@ -279,9 +278,35 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) SysBeep(1); return false; } - TkMacOSXSetEatButtonUp(true); - BringWindowForward(medPtr->whichWin); - return false; + + /* + * Clicks in the stoplights on a MacOS X title bar are processed + * directly even for background windows. Do that here. + */ + + switch (medPtr->windowPart) { + case inGoAway: + return HandleInGoAway(tkwin, medPtr->whichWin, where); + break; + case inCollapseBox: + err = HandleInCollapse(medPtr->whichWin); + if (err = noErr) { + statusPtr->err = 1; + } + statusPtr->stopProcessing = 1; + return false; + break; + case inZoomIn: + return false; + break; + case inZoomOut: + return false; + break; + default: + TkMacOSXSetEatButtonUp(true); + BringWindowForward(medPtr->whichWin); + return false; + } } } @@ -320,14 +345,7 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) } break; case inGoAway: - if (TrackGoAway(medPtr->whichWin,where)) { - if (tkwin == NULL) { - return false; - } - TkGenWMDestroyEvent(tkwin); - return true; - } - return false; + return HandleInGoAway(tkwin, medPtr->whichWin, where); break; case inMenuBar: { @@ -359,19 +377,77 @@ TkMacOSXProcessMouseEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr) } break; case inCollapseBox: - if ((err = CollapseWindow(medPtr->whichWin, - !IsWindowCollapsed(medPtr->whichWin)))!=noErr) { - fprintf(stderr,"CollapseWindow failed,%d\n", err); - statusPtr->err = 1; - } - break; + err = HandleInCollapse(medPtr->whichWin); + if (err == noErr) { + statusPtr->err = 1; + } + statusPtr->stopProcessing = 1; + break; default: return false; break; } return 0; } - + +/* + *---------------------------------------------------------------------- + * + * HandleInGoAway -- + * + * Tracks the cursor in the go away box and deletes the window + * if the button stays depressed on button up. + * + * Results: + * True if no errors - false otherwise. + * + * Side effects: + * The window tkwin may be destroyed. + * + *---------------------------------------------------------------------- + */ +int +HandleInGoAway(Tk_Window tkwin, WindowRef win, Point where) +{ + if (TrackGoAway(win, where)) { + if (tkwin == NULL) { + return false; + } + TkGenWMDestroyEvent(tkwin); + return true; + } + return false; +} + +/* + *---------------------------------------------------------------------- + * + * HandleInCollapse -- + * + * Tracks the cursor in the collapse box and colapses the window + * if the button stays depressed on button up. + * + * Results: + * Error return from CollapseWindow + * + * Side effects: + * The window win may be collapsed. + * + *---------------------------------------------------------------------- + */ +OSErr +HandleInCollapse(WindowRef win) +{ + OSErr err; + + err = CollapseWindow(win, + !IsWindowCollapsed(win)); + if (err != noErr) { + fprintf(stderr,"CollapseWindow failed,%d\n", err); + } + return err; +} + /* *---------------------------------------------------------------------- * diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index d21d1f1..af3619b 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -101,7 +101,6 @@ TkMacOSXProcessApplicationEvent( TkMacOSXEvent *eventPtr, MacEventStatus *statusPtr) { - statusPtr->handledByTk = 1; switch (eventPtr->eKind) { case kEventAppActivated: tkMacOSXAppInFront = true; @@ -155,11 +154,9 @@ TkMacOSXProcessWindowEvent( case kEventWindowUpdate: break; default: - statusPtr->handledByTk = 1; return 0; break; } - statusPtr->handledByTk = 1; status = GetEventParameter(eventPtr->eventRef, kEventParamDirectObject, typeWindowRef, NULL, @@ -184,8 +181,6 @@ TkMacOSXProcessWindowEvent( case kEventWindowUpdate: if (GenerateUpdateEvent(window)) { eventFound = true; - } else { - statusPtr->handledByTk = 0; } break; } @@ -690,4 +685,4 @@ int Tk_MacOSXIsAppInFront (void) { return tkMacOSXAppInFront; -}
\ No newline at end of file +} |