summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/entry.tcl20
-rw-r--r--library/text.tcl6
-rw-r--r--library/ttk/entry.tcl20
-rw-r--r--macosx/Wish-Info.plist.in21
4 files changed, 67 insertions, 0 deletions
diff --git a/library/entry.tcl b/library/entry.tcl
index 6243d26..780fcb2 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -113,6 +113,9 @@ bind Entry <B1-Enter> {
}
bind Entry <ButtonRelease-1> {
tk::CancelRepeat
+ if {[tk windowingsystem] eq "aqua"} {
+ ::tk::CheckEntrySelection %W
+ }
}
bind Entry <Control-1> {
%W icursor @%x
@@ -652,3 +655,20 @@ proc ::tk::EntryGetSelection {w} {
}
return $entryString
}
+
+
+if {[tk windowingsystem] eq "aqua"]{
+# ::tk::CheckEntrySelection --
+#
+# Writes selected text to the clipboard on macOS.
+#
+# Arguments:
+# w - The entry window from which the text to get
+
+proc ::tk::CheckEntrySelection {w} {
+ if {[$w selection present]} {
+ clipboard clear
+ clipboard append [::tk::EntryGetSelection $w]
+ }
+}
+}
diff --git a/library/text.tcl b/library/text.tcl
index 468696b..c76153c 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -395,6 +395,12 @@ bind Text <Control-v> {
tk::TextScrollPages %W 1
}
+bind Text <<Selection>> {
+ clipboard clear
+ set selected [%W get sel.first sel.last]
+ clipboard append $selected
+}
+
# End of Mac only bindings
}
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index b3ebcbd..7ac29e4 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -427,6 +427,9 @@ proc ttk::entry::Release {w} {
variable State
set State(selectMode) none
ttk::CancelRepeat ;# suspend autoscroll
+ if {[tk windowingsystem] eq "aqua"} {
+ ::ttk::CheckEntrySelection $w
+ }
}
## AutoScroll
@@ -604,4 +607,21 @@ proc ttk::entry::Delete {w} {
}
}
+if {[tk windowingsystem] eq "aqua"] {
+ # ::ttk::CheckEntrySelection --
+ #
+ # Writes selected text to the clipboard on macOS.
+ #
+ # Arguments:
+ # w - The entry window from which the text to get
+
+ proc ::ttk::CheckEntrySelection {w} {
+ if {[$w selection present]} {
+ clipboard clear
+ clipboard append [::ttk::EntrySelection $w]
+ }
+ }
+}
+
+
#*EOF*
diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in
index d2fc388..0a22527 100644
--- a/macosx/Wish-Info.plist.in
+++ b/macosx/Wish-Info.plist.in
@@ -78,5 +78,26 @@
<string>Wish.sdef</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
+ <key>NSServices</key>
+ <array>
+ <key>NSMenuItem</key>
+ <dict>
+ <key>default</key>
+ <string>Wish: Run Tcl Script</string>
+ </dict>
+ <key>NSMessage</key>
+ <string>provideService</string>
+ <key>NSPortName</key>
+ <string>Wish</string>
+ <key>NSSendTypes</key>
+ <array>
+ <string>NSStringPboardType</string>
+ </array>
+ <key>NSReturnTypes</key>
+ <array>
+ <string>NSStringPboardType</string>
+ </array>
+ </dict>
+ </array>
</dict>
</plist>