3850 |
3852 |
3851 <resource: #keyboard (#Escape)> |
3853 <resource: #keyboard (#Escape)> |
3852 |
3854 |
3853 |xlatedKey| |
3855 |xlatedKey| |
3854 |
3856 |
|
3857 'X: ' print. untranslatedKey printCR. |
|
3858 |
3855 "/ |
3859 "/ |
3856 "/ ctrl-Esc gives up focus |
3860 "/ ctrl-Esc gives up focus |
3857 "/ |
3861 "/ |
3858 untranslatedKey == #Escape ifTrue:[ |
3862 untranslatedKey == #Escape ifTrue:[ |
3859 (ctrlDown or:[metaDown]) ifTrue:[ |
3863 (ctrlDown or:[metaDown]) ifTrue:[ |
3860 self ungrabPointer. |
3864 self ungrabPointer. |
3861 self ungrabKeyboard. |
3865 self ungrabKeyboard. |
3862 self setInputFocusTo:nil |
3866 self setInputFocusTo:nil |
3863 ] |
3867 ] |
3864 ]. |
3868 ]. |
3865 |
3869 |
3866 self modifierKeyProcessing:untranslatedKey down:true. |
3870 self modifierKeyProcessing:untranslatedKey down:true. |
3867 |
3871 |
3868 aView isNil ifTrue:[ |
3872 aView isNil ifTrue:[ |
3869 "/ event arrived, after I destroyed it myself |
3873 "/ event arrived, after I destroyed it myself |
3870 ^ self |
3874 ^ self |
3871 ]. |
3875 ]. |
3872 |
3876 |
3873 xlatedKey := self translateKey:untranslatedKey forView:aView. |
3877 "/ xlatedKey := self translateKey:untranslatedKey forView:aView. |
3874 xlatedKey == #Hardcopy ifTrue:[ |
3878 "/ xlatedKey == #Hardcopy ifTrue:[ |
3875 [ |
3879 "/ [ |
3876 Transcript topView application |
3880 "/ Transcript topView application |
3877 saveScreenImage:(Image fromView:(aView topView) "inset:0" grab:true) defaultName:'hardcopy'. |
3881 "/ saveScreenImage:(Image fromView:(aView topView) "inset:0" grab:true) defaultName:'hardcopy'. |
3878 ] forkAt:Processor userSchedulingPriority + 1. |
3882 "/ ] forkAt:Processor userSchedulingPriority + 1. |
3879 ^ self. |
3883 "/ ^ self. |
3880 ]. |
3884 "/ ]. |
3881 |
3885 "/ |
3882 aView sensor keyPress:untranslatedKey x:x y:y view:aView |
3886 aView sensor keyPress:untranslatedKey x:x y:y view:aView |
3883 ! |
3887 ! |
3884 |
3888 |
3885 keyRelease:untranslatedKey x:x y:y view:aView |
3889 keyRelease:untranslatedKey x:x y:y view:aView |
3886 "forward a key-release event for some view" |
3890 "forward a key-release event for some view" |
4136 |
4140 |
4137 disposeEvents |
4141 disposeEvents |
4138 "dispose (i.e. forget) all events pending on this display" |
4142 "dispose (i.e. forget) all events pending on this display" |
4139 |
4143 |
4140 [self eventPending] whileTrue:[ |
4144 [self eventPending] whileTrue:[ |
4141 self getEventFor:nil withMask:nil |
4145 self getEventFor:nil withMask:nil into:nil |
4142 ]. |
4146 ]. |
4143 ! |
4147 ! |
4144 |
4148 |
4145 disposeEventsWithMask:aMask for:aWindowId |
4149 disposeEventsWithMask:aMask for:aWindowId |
4146 "dispose (throw away) specific events" |
4150 "dispose (throw away) specific events" |
5858 |
5862 |
5859 "/ the next statement will vanish .... |
5863 "/ the next statement will vanish .... |
5860 (untranslatedKey == #Control |
5864 (untranslatedKey == #Control |
5861 or:[untranslatedKey == #'Control_L' |
5865 or:[untranslatedKey == #'Control_L' |
5862 or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
5866 or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
5863 ^ #Ctrl |
5867 ^ #Ctrl |
5864 ]. |
5868 ]. |
5865 |
5869 |
5866 (untranslatedKey == #Ctrl |
5870 (untranslatedKey == #Ctrl |
5867 or:[untranslatedKey == #'Ctrl_L' |
5871 or:[untranslatedKey == #'Ctrl_L' |
5868 or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
5872 or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
5869 ^ #Ctrl |
5873 ^ #Ctrl |
5870 ]. |
5874 ]. |
5871 (untranslatedKey == #'Shift' |
5875 (untranslatedKey == #'Shift' |
5872 or:[untranslatedKey == #'Shift_L' |
5876 or:[untranslatedKey == #'Shift_L' |
5873 or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
5877 or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
5874 ^ #Shift |
5878 ^ #Shift |
5875 ]. |
5879 ]. |
5876 (untranslatedKey == #'Alt' |
5880 (untranslatedKey == #'Alt' |
5877 or:[untranslatedKey == #'Alt_L' |
5881 or:[untranslatedKey == #'Alt_L' |
5878 or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
5882 or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
5879 ^ #Alt |
5883 ^ #Alt |
5880 ]. |
5884 ]. |
5881 (untranslatedKey == #'Meta' |
5885 (untranslatedKey == #'Meta' |
5882 or:[untranslatedKey == #'Meta_L' |
5886 or:[untranslatedKey == #'Meta_L' |
5883 or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
5887 or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
5884 ^ #Meta |
5888 ^ #Meta |
5885 ]. |
5889 ]. |
5886 (untranslatedKey == #'Cmd' |
5890 (untranslatedKey == #'Cmd' |
5887 or:[untranslatedKey == #'Cmd_L' |
5891 or:[untranslatedKey == #'Cmd_L' |
5888 or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
5892 or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
5889 ^ #Cmd |
5893 ^ #Cmd |
|
5894 ]. |
|
5895 (untranslatedKey == #'Super' |
|
5896 or:[untranslatedKey == #'Super_L' |
|
5897 or:[untranslatedKey == #'Super_R']]) ifTrue:[ |
|
5898 ^ #Super |
|
5899 ]. |
|
5900 (untranslatedKey == #'Menu' |
|
5901 or:[untranslatedKey == #'Menu_L' |
|
5902 or:[untranslatedKey == #'Menu_R']]) ifTrue:[ |
|
5903 ^ #Menu |
5890 ]. |
5904 ]. |
5891 ^ nil |
5905 ^ nil |
5892 |
5906 |
5893 "Created: 28.2.1996 / 16:40:46 / cg" |
5907 "Created: 28.2.1996 / 16:40:46 / cg" |
5894 "Modified: 28.2.1996 / 17:11:34 / cg" |
5908 "Modified: 28.2.1996 / 17:11:34 / cg" |
5897 prependModifierToKey:untranslatedKey |
5911 prependModifierToKey:untranslatedKey |
5898 |xlatedKey s modifier| |
5912 |xlatedKey s modifier| |
5899 |
5913 |
5900 xlatedKey := untranslatedKey. |
5914 xlatedKey := untranslatedKey. |
5901 xlatedKey isCharacter ifFalse:[ |
5915 xlatedKey isCharacter ifFalse:[ |
5902 xlatedKey := xlatedKey asSymbol |
5916 xlatedKey := xlatedKey asSymbol |
5903 ]. |
5917 ]. |
5904 |
5918 |
5905 modifier := self modifierKeyTranslationFor:untranslatedKey. |
5919 modifier := self modifierKeyTranslationFor:untranslatedKey. |
|
5920 'untranslatedKey: ' print. untranslatedKey storeString printCR. |
|
5921 'modifier: ' print. modifier storeString printCR. |
|
5922 |
5906 "/ |
5923 "/ |
5907 "/ only prepend, if this is not a modifier |
5924 "/ only prepend, if this is not a modifier |
5908 "/ |
5925 "/ |
5909 modifier isNil ifTrue:[ |
5926 modifier isNil ifTrue:[ |
5910 s := xlatedKey asString. |
5927 s := xlatedKey asString. |
5911 ctrlDown ifTrue:[ |
5928 ctrlDown ifTrue:[ |
5912 xlatedKey := 'Ctrl' , s |
5929 xlatedKey := 'Ctrl' , s |
5913 ]. |
5930 ]. |
5914 metaDown ifTrue:[ "/ sigh - new hp's have both CMD and META keys. |
5931 metaDown ifTrue:[ "/ sigh - new hp's have both CMD and META keys. |
5915 xlatedKey := 'Cmd' , s |
5932 xlatedKey := 'Cmd' , s |
5916 ]. |
5933 ]. |
5917 altDown ifTrue:[ |
5934 altDown ifTrue:[ |
5918 xlatedKey := 'Alt' , s |
5935 xlatedKey := 'Alt' , s |
5919 ]. |
5936 ]. |
5920 xlatedKey isCharacter ifFalse:[ |
5937 xlatedKey isCharacter ifFalse:[ |
5921 xlatedKey := xlatedKey asSymbol |
5938 xlatedKey := xlatedKey asSymbol |
5922 ]. |
5939 ]. |
5923 ]. |
5940 ]. |
5924 |
5941 |
5925 ^ xlatedKey |
5942 ^ xlatedKey |
5926 ! |
5943 ! |
5927 |
5944 |
6084 |setOfViews| |
6101 |setOfViews| |
6085 |
6102 |
6086 setOfViews := self knownViews. |
6103 setOfViews := self knownViews. |
6087 |
6104 |
6088 setOfViews do:[:aView | |
6105 setOfViews do:[:aView | |
6089 aView shown ifTrue:[ |
6106 aView shown ifTrue:[ |
6090 aView isRootView ifFalse:[ |
6107 aView isRootView ifFalse:[ |
6091 aView clear; invalidate |
6108 aView clearView; invalidate |
6092 ] |
6109 ] |
6093 ] |
6110 ] |
6094 ] |
6111 ] |
6095 |
6112 |
6096 " |
6113 " |
6097 Display redrawAllWindows |
6114 Display redrawAllWindows |
6098 " |
6115 " |