added: #initializeConstants
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 17 Apr 2012 21:06:40 +0200
changeset 5902 9afe7cf340a1
parent 5901 5324f9088c88
child 5903 1ae08cd914f6
added: #initializeConstants
XWorkstation.st
--- a/XWorkstation.st	Fri Apr 06 21:28:57 2012 +0200
+++ b/XWorkstation.st	Tue Apr 17 21:06:40 2012 +0200
@@ -544,6 +544,35 @@
     ]
 
     "Modified: / 27.4.1999 / 17:21:30 / cg"
+!
+
+initializeConstants
+    "initialize some (soft) constants"
+
+    ButtonTranslation isNil ifTrue:[
+        "JV@2012: On X11, mouse buttons are: left=1, middle=2, right=3
+        Even on 2-button mouse (button 2 is simply not reported). 
+        Here:
+          - right button is remapped to button 2 (which in St/X triggers 
+            the context menu) and
+          - middle button is mapped to button 128 (which in EditTextView 
+            pastes the PRIMARY selection)
+        This kludge is here to have all the widget's code backward/windows 
+        compatible while still have X11's middle button behavior
+
+        Also, add 8th and 9th button as there are mouses out there with
+        such buttons...
+        "
+
+        ButtonTranslation := #(1 128 2 2 2 2 2 2 2)
+
+        "/ ButtonTranslation := #(1 2 2 2 2 2 2)  "all other buttons to middleButton menu"
+        "/ ButtonTranslation := #(1 2 3 4 5 6 7)  "identity translation"
+    ].
+
+    super initializeConstants.
+
+    "Created: / 17-04-2012 / 20:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !XWorkstation class methodsFor:'error handling'!
@@ -12448,7 +12477,7 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.537 2012-04-06 19:28:57 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.538 2012-04-17 19:06:40 vrany Exp $'
 !
 
 version_SVN