summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorculler <culler>2020-04-15 17:24:51 (GMT)
committerculler <culler>2020-04-15 17:24:51 (GMT)
commitef67d7e478dcdd96b095c80fbf1d95330ee35117 (patch)
treefc8f026a7f5ad5bdbe8b27f50f3d07c3195c0c4b /library
parentf098336486ba362a5b694d93a949fe6e8b23891a (diff)
downloadtk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.zip
tk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.tar.gz
tk-ef67d7e478dcdd96b095c80fbf1d95330ee35117.tar.bz2
Apply a patch from Christopher Chavez which correctly deals with the fact that Apple uses the middle mouse button for Button 3.
Diffstat (limited to 'library')
-rw-r--r--library/demos/entry1.tcl2
-rw-r--r--library/demos/entry2.tcl2
-rw-r--r--library/demos/text.tcl8
-rw-r--r--library/entry.tcl27
-rw-r--r--library/spinbox.tcl27
-rw-r--r--library/text.tcl27
-rw-r--r--library/ttk/entry.tcl19
7 files changed, 80 insertions, 32 deletions
diff --git a/library/demos/entry1.tcl b/library/demos/entry1.tcl
index eef8964..7365fc7 100644
--- a/library/demos/entry1.tcl
+++ b/library/demos/entry1.tcl
@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (no scrollbars)"
wm iconname $w "entry1"
positionWindow $w
-label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button2 pressed."
+label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons
diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl
index 9e3f4ef..6405d85 100644
--- a/library/demos/entry2.tcl
+++ b/library/demos/entry2.tcl
@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (with scrollbars)"
wm iconname $w "entry2"
positionWindow $w
-label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with mouse button2 pressed."
+label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons
diff --git a/library/demos/text.tcl b/library/demos/text.tcl
index d1801d1..2736b88 100644
--- a/library/demos/text.tcl
+++ b/library/demos/text.tcl
@@ -57,8 +57,9 @@ can do to a text widget:
1. Scrolling. Use the scrollbar to adjust the view in the text window.
-2. Scanning. Press mouse button 2 in the text window and drag up or down.
-This will drag the text at high speed to allow you to scan its contents.
+2. Scanning. Press the middle mouse button in the text window and drag up
+or down. This will drag the text at high speed to allow you to scan its
+contents.
3. Insert text. Press mouse button 1 to set the insertion cursor, then
type text. What you type will be added to the widget.
@@ -77,7 +78,8 @@ text, in which case it will replace the selected text.
6. Copy the selection. To copy the selection into this window, select
what you want to copy (either here or in another application), then
-click button 2 to copy the selection to the point of the mouse cursor.
+click the middle mouse button to copy the selection to the point of the
+mouse cursor.
7. Edit. Text widgets support the standard Motif editing characters
plus many Emacs editing characters. Backspace and Control-h erase the
diff --git a/library/entry.tcl b/library/entry.tcl
index 2aab934..9cc9f6f 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -293,14 +293,27 @@ bind Entry <<TkAccentBackspace>> {
# A few additional bindings of my own.
-bind Entry <2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
+if {[tk windowingsystem] ne "aqua"} {
+ bind Entry <2> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
+ }
}
-}
-bind Entry <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
+ bind Entry <B2-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
+ }
+ }
+} else {
+ bind Entry <3> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
+ }
+ }
+ bind Entry <B3-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
+ }
}
}
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index 1965ed8..f5a2ad3 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -280,14 +280,27 @@ bind Spinbox <Meta-Delete> {
# A few additional bindings of my own.
-bind Spinbox <2> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanMark %W %x
+if {[tk windowingsystem] ne "aqua"} {
+ bind Spinbox <2> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
+ }
}
-}
-bind Spinbox <B2-Motion> {
- if {!$tk_strictMotif} {
- ::tk::EntryScanDrag %W %x
+ bind Spinbox <B2-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
+ }
+ }
+} else {
+ bind Spinbox <3> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanMark %W %x
+ }
+ }
+ bind Spinbox <B3-Motion> {
+ if {!$tk_strictMotif} {
+ ::tk::EntryScanDrag %W %x
+ }
}
}
diff --git a/library/text.tcl b/library/text.tcl
index bdfb78e..0fa37e7 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -429,14 +429,27 @@ bind Text <Control-h> {
%W see insert
}
}
-bind Text <2> {
- if {!$tk_strictMotif} {
- tk::TextScanMark %W %x %y
+if {[tk windowingsystem] ne "aqua"} {
+ bind Text <2> {
+ if {!$tk_strictMotif} {
+ tk::TextScanMark %W %x %y
+ }
}
-}
-bind Text <B2-Motion> {
- if {!$tk_strictMotif} {
- tk::TextScanDrag %W %x %y
+ bind Text <B2-Motion> {
+ if {!$tk_strictMotif} {
+ tk::TextScanDrag %W %x %y
+ }
+ }
+} else {
+ bind Text <3> {
+ if {!$tk_strictMotif} {
+ tk::TextScanMark %W %x %y
+ }
+ }
+ bind Text <B3-Motion> {
+ if {!$tk_strictMotif} {
+ tk::TextScanDrag %W %x %y
+ }
}
}
set ::tk::Priv(prevPos) {}
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 45e3506..1ee6005 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -82,13 +82,20 @@ bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
}
-## Button2 bindings:
+## Button2 (Button3 on Aqua) bindings:
# Used for scanning and primary transfer.
-# Note: ButtonRelease-2 is mapped to <<PasteSelection>> in tk.tcl.
-#
-bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
-bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
-bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
+# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
+# is mapped to <<PasteSelection>> in tk.tcl.
+#
+if {[tk windowingsystem] ne "aqua"} {
+ bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
+ bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
+ bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
+} else {
+ bind TEntry <ButtonPress-3> { ttk::entry::ScanMark %W %x }
+ bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x }
+ bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x }
+}
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
## Keyboard navigation bindings: