Skip to content

Commit 594810d

Browse files
committed
Merge branch 'ml/tcl86'
* ml/tcl86: git-gui: remove non-ttk code git-gui: remove ${NS} indirection for ttk git-gui: always use themed widgets from ttk git-gui: remove redundant check for Tk >= 8.5 git-gui: remove unreachable Tk 8.4 code git-gui: Make TclTk 8.6 the minimum, allow 8.7 Signed-off-by: Johannes Sixt <[email protected]>
2 parents dab92fe + 9b1c537 commit 594810d

28 files changed

+361
-540
lines changed

git-gui.sh

Lines changed: 45 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ along with this program; if not, see <https://www.gnu.org/licenses/>.}]
3030
##
3131
## Tcl/Tk sanity check
3232

33-
if {[catch {package require Tcl 8.5} err]
34-
|| [catch {package require Tk 8.5} err]
35-
} {
33+
if {[catch {package require Tcl 8.6-8.8} err]} {
3634
catch {wm withdraw .}
3735
tk_messageBox \
3836
-icon error \
@@ -914,18 +912,9 @@ proc apply_config {} {
914912
font configure ${font}italic -slant italic
915913
}
916914

917-
global use_ttk NS
918-
set use_ttk 0
919-
set NS {}
920-
if {$repo_config(gui.usettk)} {
921-
set use_ttk [package vsatisfies [package provide Tk] 8.5]
922-
if {$use_ttk} {
923-
set NS ttk
924-
bind [winfo class .] <<ThemeChanged>> [list InitTheme]
925-
pave_toplevel .
926-
color::sync_with_theme
927-
}
928-
}
915+
bind [winfo class .] <<ThemeChanged>> [list InitTheme]
916+
pave_toplevel .
917+
color::sync_with_theme
929918

930919
global comment_string
931920
set comment_string [get_config core.commentstring]
@@ -1270,8 +1259,6 @@ citool {
12701259
##
12711260
## execution environment
12721261

1273-
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
1274-
12751262
# Suggest our implementation of askpass, if none is set
12761263
if {![info exists env(SSH_ASKPASS)]} {
12771264
set env(SSH_ASKPASS) [gitexec git-gui--askpass]
@@ -2333,7 +2320,7 @@ proc do_quit {{rc {1}}} {
23332320
global ui_comm is_quitting repo_config commit_type
23342321
global GITGUI_BCK_exists GITGUI_BCK_i
23352322
global ui_comm_spell
2336-
global ret_code use_ttk
2323+
global ret_code
23372324

23382325
if {$is_quitting} return
23392326
set is_quitting 1
@@ -2391,13 +2378,8 @@ proc do_quit {{rc {1}}} {
23912378
}
23922379
set cfg_geometry [list]
23932380
lappend cfg_geometry [wm geometry .]
2394-
if {$use_ttk} {
2395-
lappend cfg_geometry [.vpane sashpos 0]
2396-
lappend cfg_geometry [.vpane.files sashpos 0]
2397-
} else {
2398-
lappend cfg_geometry [lindex [.vpane sash coord 0] 0]
2399-
lappend cfg_geometry [lindex [.vpane.files sash coord 0] 1]
2400-
}
2381+
lappend cfg_geometry [.vpane sashpos 0]
2382+
lappend cfg_geometry [.vpane.files sashpos 0]
24012383
if {[catch {set rc_geometry $repo_config(gui.geometry)}]} {
24022384
set rc_geometry {}
24032385
}
@@ -3279,13 +3261,12 @@ default {
32793261

32803262
# -- Branch Control
32813263
#
3282-
${NS}::frame .branch
3283-
if {!$use_ttk} {.branch configure -borderwidth 1 -relief sunken}
3284-
${NS}::label .branch.l1 \
3264+
ttk::frame .branch
3265+
ttk::label .branch.l1 \
32853266
-text [mc "Current Branch:"] \
32863267
-anchor w \
32873268
-justify left
3288-
${NS}::label .branch.cb \
3269+
ttk::label .branch.cb \
32893270
-textvariable current_branch \
32903271
-anchor w \
32913272
-justify left
@@ -3295,13 +3276,9 @@ pack .branch -side top -fill x
32953276

32963277
# -- Main Window Layout
32973278
#
3298-
${NS}::panedwindow .vpane -orient horizontal
3299-
${NS}::panedwindow .vpane.files -orient vertical
3300-
if {$use_ttk} {
3301-
.vpane add .vpane.files
3302-
} else {
3303-
.vpane add .vpane.files -sticky nsew -height 100 -width 200
3304-
}
3279+
ttk::panedwindow .vpane -orient horizontal
3280+
ttk::panedwindow .vpane.files -orient vertical
3281+
.vpane add .vpane.files
33053282
pack .vpane -anchor n -side top -fill both -expand 1
33063283

33073284
# -- Working Directory File List
@@ -3318,8 +3295,8 @@ ttext $ui_workdir \
33183295
-xscrollcommand {.vpane.files.workdir.sx set} \
33193296
-yscrollcommand {.vpane.files.workdir.sy set} \
33203297
-state disabled
3321-
${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
3322-
${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
3298+
ttk::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
3299+
ttk::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
33233300
pack .vpane.files.workdir.title -side top -fill x
33243301
pack .vpane.files.workdir.sx -side bottom -fill x
33253302
pack .vpane.files.workdir.sy -side right -fill y
@@ -3340,8 +3317,8 @@ ttext $ui_index \
33403317
-xscrollcommand {.vpane.files.index.sx set} \
33413318
-yscrollcommand {.vpane.files.index.sy set} \
33423319
-state disabled
3343-
${NS}::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview]
3344-
${NS}::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview]
3320+
ttk::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview]
3321+
ttk::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview]
33453322
pack .vpane.files.index.title -side top -fill x
33463323
pack .vpane.files.index.sx -side bottom -fill x
33473324
pack .vpane.files.index.sy -side right -fill y
@@ -3351,10 +3328,6 @@ pack $ui_index -side left -fill both -expand 1
33513328
#
33523329
.vpane.files add .vpane.files.workdir
33533330
.vpane.files add .vpane.files.index
3354-
if {!$use_ttk} {
3355-
.vpane.files paneconfigure .vpane.files.workdir -sticky news
3356-
.vpane.files paneconfigure .vpane.files.index -sticky news
3357-
}
33583331

33593332
proc set_selection_colors {w has_focus} {
33603333
foreach tag [list in_diff in_sel] {
@@ -3375,86 +3348,71 @@ unset i
33753348

33763349
# -- Diff and Commit Area
33773350
#
3378-
if {$have_tk85} {
3379-
${NS}::panedwindow .vpane.lower -orient vertical
3380-
${NS}::frame .vpane.lower.commarea
3381-
${NS}::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500
3382-
.vpane.lower add .vpane.lower.diff
3383-
.vpane.lower add .vpane.lower.commarea
3384-
.vpane add .vpane.lower
3385-
if {$use_ttk} {
3386-
.vpane.lower pane .vpane.lower.diff -weight 1
3387-
.vpane.lower pane .vpane.lower.commarea -weight 0
3388-
} else {
3389-
.vpane.lower paneconfigure .vpane.lower.diff -stretch always
3390-
.vpane.lower paneconfigure .vpane.lower.commarea -stretch never
3391-
}
3392-
} else {
3393-
frame .vpane.lower -height 300 -width 400
3394-
frame .vpane.lower.commarea
3395-
frame .vpane.lower.diff -relief sunken -borderwidth 1
3396-
pack .vpane.lower.diff -fill both -expand 1
3397-
pack .vpane.lower.commarea -side bottom -fill x
3398-
.vpane add .vpane.lower
3399-
.vpane paneconfigure .vpane.lower -sticky nsew
3400-
}
3351+
ttk::panedwindow .vpane.lower -orient vertical
3352+
ttk::frame .vpane.lower.commarea
3353+
ttk::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500
3354+
.vpane.lower add .vpane.lower.diff
3355+
.vpane.lower add .vpane.lower.commarea
3356+
.vpane add .vpane.lower
3357+
.vpane.lower pane .vpane.lower.diff -weight 1
3358+
.vpane.lower pane .vpane.lower.commarea -weight 0
34013359

34023360
# -- Commit Area Buttons
34033361
#
3404-
${NS}::frame .vpane.lower.commarea.buttons
3405-
${NS}::label .vpane.lower.commarea.buttons.l -text {} \
3362+
ttk::frame .vpane.lower.commarea.buttons
3363+
ttk::label .vpane.lower.commarea.buttons.l -text {} \
34063364
-anchor w \
34073365
-justify left
34083366
pack .vpane.lower.commarea.buttons.l -side top -fill x
34093367
pack .vpane.lower.commarea.buttons -side left -fill y
34103368

3411-
${NS}::button .vpane.lower.commarea.buttons.rescan -text [mc Rescan] \
3369+
ttk::button .vpane.lower.commarea.buttons.rescan -text [mc Rescan] \
34123370
-command ui_do_rescan
34133371
pack .vpane.lower.commarea.buttons.rescan -side top -fill x
34143372
lappend disable_on_lock \
34153373
{.vpane.lower.commarea.buttons.rescan conf -state}
34163374

3417-
${NS}::button .vpane.lower.commarea.buttons.incall -text [mc "Stage Changed"] \
3375+
ttk::button .vpane.lower.commarea.buttons.incall -text [mc "Stage Changed"] \
34183376
-command do_add_all
34193377
pack .vpane.lower.commarea.buttons.incall -side top -fill x
34203378
lappend disable_on_lock \
34213379
{.vpane.lower.commarea.buttons.incall conf -state}
34223380

34233381
if {![is_enabled nocommitmsg]} {
3424-
${NS}::button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
3382+
ttk::button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
34253383
-command do_signoff
34263384
pack .vpane.lower.commarea.buttons.signoff -side top -fill x
34273385
}
34283386

3429-
${NS}::button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \
3387+
ttk::button .vpane.lower.commarea.buttons.commit -text [commit_btn_caption] \
34303388
-command do_commit
34313389
pack .vpane.lower.commarea.buttons.commit -side top -fill x
34323390
lappend disable_on_lock \
34333391
{.vpane.lower.commarea.buttons.commit conf -state}
34343392

34353393
if {![is_enabled nocommit]} {
3436-
${NS}::button .vpane.lower.commarea.buttons.push -text [mc Push] \
3394+
ttk::button .vpane.lower.commarea.buttons.push -text [mc Push] \
34373395
-command do_push_anywhere
34383396
pack .vpane.lower.commarea.buttons.push -side top -fill x
34393397
}
34403398

34413399
# -- Commit Message Buffer
34423400
#
3443-
${NS}::frame .vpane.lower.commarea.buffer
3444-
${NS}::frame .vpane.lower.commarea.buffer.header
3401+
ttk::frame .vpane.lower.commarea.buffer
3402+
ttk::frame .vpane.lower.commarea.buffer.header
34453403
set ui_comm .vpane.lower.commarea.buffer.frame.t
34463404
set ui_coml .vpane.lower.commarea.buffer.header.l
34473405

34483406
if {![is_enabled nocommit]} {
3449-
${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \
3407+
ttk::checkbutton .vpane.lower.commarea.buffer.header.amend \
34503408
-text [mc "Amend Last Commit"] \
34513409
-variable commit_type_is_amend \
34523410
-command do_select_commit_type
34533411
lappend disable_on_lock \
34543412
[list .vpane.lower.commarea.buffer.header.amend conf -state]
34553413
}
34563414

3457-
${NS}::label $ui_coml \
3415+
ttk::label $ui_coml \
34583416
-anchor w \
34593417
-justify left
34603418
proc trace_commit_type {varname args} {
@@ -3489,10 +3447,10 @@ ttext $ui_comm \
34893447
-font font_diff \
34903448
-xscrollcommand {.vpane.lower.commarea.buffer.frame.sbx set} \
34913449
-yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set}
3492-
${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sbx \
3450+
ttk::scrollbar .vpane.lower.commarea.buffer.frame.sbx \
34933451
-orient horizontal \
34943452
-command [list $ui_comm xview]
3495-
${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
3453+
ttk::scrollbar .vpane.lower.commarea.buffer.frame.sby \
34963454
-orient vertical \
34973455
-command [list $ui_comm yview]
34983456

@@ -3615,9 +3573,9 @@ ttext $ui_diff \
36153573
-yscrollcommand {.vpane.lower.diff.body.sby set} \
36163574
-state disabled
36173575
catch {$ui_diff configure -tabstyle wordprocessor}
3618-
${NS}::scrollbar .vpane.lower.diff.body.sbx -orient horizontal \
3576+
ttk::scrollbar .vpane.lower.diff.body.sbx -orient horizontal \
36193577
-command [list $ui_diff xview]
3620-
${NS}::scrollbar .vpane.lower.diff.body.sby -orient vertical \
3578+
ttk::scrollbar .vpane.lower.diff.body.sby -orient vertical \
36213579
-command [list $ui_diff yview]
36223580
pack .vpane.lower.diff.body.sbx -side bottom -fill x
36233581
pack .vpane.lower.diff.body.sby -side right -fill y
@@ -3918,29 +3876,14 @@ proc on_ttk_pane_mapped {w pane pos} {
39183876
bind $w <Map> {}
39193877
after 0 [list after idle [list $w sashpos $pane $pos]]
39203878
}
3921-
proc on_tk_pane_mapped {w pane x y} {
3922-
bind $w <Map> {}
3923-
after 0 [list after idle [list $w sash place $pane $x $y]]
3924-
}
39253879
proc on_application_mapped {} {
3926-
global repo_config use_ttk
3880+
global repo_config
39273881
bind . <Map> {}
39283882
set gm $repo_config(gui.geometry)
3929-
if {$use_ttk} {
3930-
bind .vpane <Map> \
3931-
[list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
3932-
bind .vpane.files <Map> \
3933-
[list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
3934-
} else {
3935-
bind .vpane <Map> \
3936-
[list on_tk_pane_mapped %W 0 \
3937-
[lindex $gm 1] \
3938-
[lindex [.vpane sash coord 0] 1]]
3939-
bind .vpane.files <Map> \
3940-
[list on_tk_pane_mapped %W 0 \
3941-
[lindex [.vpane.files sash coord 0] 0] \
3942-
[lindex $gm 2]]
3943-
}
3883+
bind .vpane <Map> \
3884+
[list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
3885+
bind .vpane.files <Map> \
3886+
[list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
39443887
wm geometry . [lindex $gm 0]
39453888
}
39463889
if {[info exists repo_config(gui.geometry)]} {

lib/about.tcl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
proc do_about {} {
55
global appvers copyright oguilib
66
global tcl_patchLevel tk_patchLevel
7-
global ui_comm_spell NS use_ttk
7+
global ui_comm_spell
88

99
set w .about_dialog
1010
Dialog $w
1111
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
1212

1313
pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
14-
${NS}::label $w.header -text [mc "About %s" [appname]] \
14+
ttk::label $w.header -text [mc "About %s" [appname]] \
1515
-font font_uibold -anchor center
1616
pack $w.header -side top -fill x
1717

18-
${NS}::frame $w.buttons
19-
${NS}::button $w.buttons.close -text {Close} \
18+
ttk::frame $w.buttons
19+
ttk::button $w.buttons.close -text {Close} \
2020
-default active \
2121
-command [list destroy $w]
2222
pack $w.buttons.close -side right

lib/blame.tcl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ field tooltip_timer {} ; # Current timer event for our tooltip
6363
field tooltip_commit {} ; # Commit(s) in tooltip
6464

6565
constructor new {i_commit i_path i_jump} {
66-
global cursor_ptr M1B M1T have_tk85 use_ttk NS
66+
global cursor_ptr M1B M1T
6767
variable active_color
6868
variable group_colors
6969

@@ -203,18 +203,17 @@ constructor new {i_commit i_path i_jump} {
203203
-width 80 \
204204
-xscrollcommand [list $w.file_pane.out.sbx set] \
205205
-font font_diff
206-
if {$have_tk85} {
207206
$w_file configure -inactiveselectbackground darkblue
208-
}
207+
209208
$w_file tag conf found \
210209
-background yellow
211210

212211
set w_columns [list $w_amov $w_asim $w_line $w_file]
213212

214-
${NS}::scrollbar $w.file_pane.out.sbx \
213+
ttk::scrollbar $w.file_pane.out.sbx \
215214
-orient h \
216215
-command [list $w_file xview]
217-
${NS}::scrollbar $w.file_pane.out.sby \
216+
ttk::scrollbar $w.file_pane.out.sby \
218217
-orient v \
219218
-command [list scrollbar2many $w_columns yview]
220219
eval grid $w_columns $w.file_pane.out.sby -sticky nsew
@@ -264,10 +263,10 @@ constructor new {i_commit i_path i_jump} {
264263
-background $active_color \
265264
-font font_ui
266265
$w_cviewer tag raise sel
267-
${NS}::scrollbar $w.file_pane.cm.sbx \
266+
ttk::scrollbar $w.file_pane.cm.sbx \
268267
-orient h \
269268
-command [list $w_cviewer xview]
270-
${NS}::scrollbar $w.file_pane.cm.sby \
269+
ttk::scrollbar $w.file_pane.cm.sby \
271270
-orient v \
272271
-command [list $w_cviewer yview]
273272
pack $w.file_pane.cm.sby -side right -fill y
@@ -1302,7 +1301,7 @@ method _open_tooltip {cur_w} {
13021301
# On MacOS raising a window causes it to acquire focus.
13031302
# Tk 8.5 on MacOS seems to properly support wm transient,
13041303
# so we can safely counter the effect there.
1305-
if {$::have_tk85 && [is_MacOSX]} {
1304+
if {[is_MacOSX]} {
13061305
update
13071306
if {$w eq {}} {
13081307
raise .

0 commit comments

Comments
 (0)