summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2021-09-24 15:01:44 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2021-09-24 15:01:44 (GMT)
commit4af4b242bba3b66fc9db8237966ca8e90d26c094 (patch)
tree3dc0c5839dad28e524b6bdf19782f34ed6c0b7fc /library/ttk
parenta977ccf930aad868900cecb481c5fe028a08f578 (diff)
downloadtk-4af4b242bba3b66fc9db8237966ca8e90d26c094.zip
tk-4af4b242bba3b66fc9db8237966ca8e90d26c094.tar.gz
tk-4af4b242bba3b66fc9db8237966ca8e90d26c094.tar.bz2
Make IME bindings not leak into global variables
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/entry.tcl13
-rw-r--r--library/ttk/fonts.tcl107
2 files changed, 64 insertions, 56 deletions
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index fb49055..f10c194 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -161,6 +161,19 @@ bind TEntry <<TkAccentBackspace>> {
ttk::entry::Backspace %W
}
+## EndIMEMarkedText -- Handle the end of input method selection.
+#
+proc ::ttk::entry::EndIMEMarkedText {w} {
+ variable ::tk::Priv
+ if {[catch {
+ set mark [dict get $Priv(IMETextMark) $w]
+ }]} {
+ bell
+ return
+ }
+ $w selection range $mark insert
+}
+
### Clipboard procedures.
#
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index 65f2c5e..2526fac 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -66,87 +66,82 @@ catch {font create TkIconFont}
catch {font create TkMenuFont}
catch {font create TkSmallCaptionFont}
-if {!$tip145} {
-variable F ;# miscellaneous platform-specific font parameters
+if {!$tip145} {apply {{} {
+global tcl_platform
switch -- [tk windowingsystem] {
win32 {
# In safe interps there is no osVersion element.
if {[info exists tcl_platform(osVersion)]} {
if {$tcl_platform(osVersion) >= 5.0} {
- set F(family) "Tahoma"
+ set family "Tahoma"
} else {
- set F(family) "MS Sans Serif"
+ set family "MS Sans Serif"
}
} else {
if {[lsearch -exact [font families] Tahoma] >= 0} {
- set F(family) "Tahoma"
+ set family "Tahoma"
} else {
- set F(family) "MS Sans Serif"
+ set family "MS Sans Serif"
}
}
- set F(size) 8
+ set size 8
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(size)
- font configure TkCaptionFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(size)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $size
+ font configure TkCaptionFont -family $family -size $size -weight bold
+ font configure TkTooltipFont -family $family -size $size
font configure TkFixedFont -family Courier -size 10
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(size)
- font configure TkSmallCaptionFont -family $F(family) -size $F(size)
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $size
+ font configure TkSmallCaptionFont -family $family -size $size
}
aqua {
- set F(family) "Lucida Grande"
- set F(fixed) "Monaco"
- set F(menusize) 14
- set F(size) 13
- set F(viewsize) 12
- set F(smallsize) 11
- set F(labelsize) 10
- set F(fixedsize) 11
+ set family "Lucida Grande"
+ set fixed "Monaco"
+ set menusize 14
+ set size 13
+ set viewsize 12
+ set smallsize 11
+ set labelsize 10
+ set fixedsize 11
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(smallsize)
- font configure TkCaptionFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(smallsize)
- font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(menusize)
- font configure TkSmallCaptionFont -family $F(family) -size $F(labelsize)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $smallsize
+ font configure TkCaptionFont -family $family -size $size -weight bold
+ font configure TkTooltipFont -family $family -size $smallsize
+ font configure TkFixedFont -family $fixed -size $fixedsize
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $menusize
+ font configure TkSmallCaptionFont -family $family -size $labelsize
}
default -
x11 {
- if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} {
- set F(family) "sans-serif"
- set F(fixed) "monospace"
+ if {![catch {tk::pkgconfig get fontsystem} fs] && $fs eq "xft"} {
+ set family "sans-serif"
+ set fixed "monospace"
} else {
- set F(family) "Helvetica"
- set F(fixed) "courier"
+ set family "Helvetica"
+ set fixed "courier"
}
- set F(size) 10
- set F(ttsize) 9
- set F(capsize) 12
- set F(fixedsize) 10
+ set size 10
+ set ttsize 9
+ set capsize 12
+ set fixedsize 10
- font configure TkDefaultFont -family $F(family) -size $F(size)
- font configure TkTextFont -family $F(family) -size $F(size)
- font configure TkHeadingFont -family $F(family) -size $F(size) \
- -weight bold
- font configure TkCaptionFont -family $F(family) -size $F(capsize) \
- -weight bold
- font configure TkTooltipFont -family $F(family) -size $F(ttsize)
- font configure TkFixedFont -family $F(fixed) -size $F(fixedsize)
- font configure TkIconFont -family $F(family) -size $F(size)
- font configure TkMenuFont -family $F(family) -size $F(size)
- font configure TkSmallCaptionFont -family $F(family) -size $F(ttsize)
+ font configure TkDefaultFont -family $family -size $size
+ font configure TkTextFont -family $family -size $size
+ font configure TkHeadingFont -family $family -size $size -weight bold
+ font configure TkCaptionFont -family $family -size $capsize -weight bold
+ font configure TkTooltipFont -family $family -size $ttsize
+ font configure TkFixedFont -family $fixed -size $fixedsize
+ font configure TkIconFont -family $family -size $size
+ font configure TkMenuFont -family $family -size $size
+ font configure TkSmallCaptionFont -family $family -size $ttsize
}
}
-unset -nocomplain F
-}
+} ::ttk}}
}