summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui/git-gui.sh103
-rw-r--r--git-gui/lib/blame.tcl1
-rw-r--r--git-gui/lib/themed.tcl38
3 files changed, 93 insertions, 49 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 49bd86e635..867b8cea46 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -720,7 +720,9 @@ proc rmsel_tag {text} {
-background [$text cget -background] \
-foreground [$text cget -foreground] \
-borderwidth 0
- $text tag conf in_sel -background lightgray
+ $text tag conf in_sel\
+ -background $color::select_bg \
+ -foreground $color::select_fg
bind $text <Motion> break
return $text
}
@@ -863,6 +865,7 @@ proc apply_config {} {
set NS ttk
bind [winfo class .] <<ThemeChanged>> [list InitTheme]
pave_toplevel .
+ color::sync_with_theme
}
}
}
@@ -947,15 +950,15 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
}
proc get_trimmed_version {s} {
- set r {}
- foreach x [split $s -._] {
- if {[string is integer -strict $x]} {
- lappend r $x
- } else {
- break
- }
- }
- return [join $r .]
+ set r {}
+ foreach x [split $s -._] {
+ if {[string is integer -strict $x]} {
+ lappend r $x
+ } else {
+ break
+ }
+ }
+ return [join $r .]
}
set _real_git_version $_git_version
set _git_version [get_trimmed_version $_git_version]
@@ -967,7 +970,7 @@ if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} {
-type yesno \
-default no \
-title "[appname]: warning" \
- -message [mc "Git version cannot be determined.
+ -message [mc "Git version cannot be determined.
%s claims it is version '%s'.
@@ -1653,7 +1656,7 @@ proc prepare_commit_msg_hook_wait {fd_ph} {
set pch_error {}
catch {file delete [gitdir PREPARE_COMMIT_MSG]}
return
- }
+ }
fconfigure $fd_ph -blocking 0
catch {file delete [gitdir PREPARE_COMMIT_MSG]}
}
@@ -2001,72 +2004,72 @@ set filemask {
#define mask_width 14
#define mask_height 15
static unsigned char mask_bits[] = {
- 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f,
- 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f,
- 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f};
+ 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f,
+ 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f,
+ 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f};
}
image create bitmap file_plain -background white -foreground black -data {
#define plain_width 14
#define plain_height 15
static unsigned char plain_bits[] = {
- 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10,
- 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
- 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10,
+ 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
+ 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_mod -background white -foreground blue -data {
#define mod_width 14
#define mod_height 15
static unsigned char mod_bits[] = {
- 0xfe, 0x01, 0x02, 0x03, 0x7a, 0x05, 0x02, 0x09, 0x7a, 0x1f, 0x02, 0x10,
- 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10,
- 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x03, 0x7a, 0x05, 0x02, 0x09, 0x7a, 0x1f, 0x02, 0x10,
+ 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10,
+ 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_fulltick -background white -foreground "#007000" -data {
#define file_fulltick_width 14
#define file_fulltick_height 15
static unsigned char file_fulltick_bits[] = {
- 0xfe, 0x01, 0x02, 0x1a, 0x02, 0x0c, 0x02, 0x0c, 0x02, 0x16, 0x02, 0x16,
- 0x02, 0x13, 0x00, 0x13, 0x86, 0x11, 0x8c, 0x11, 0xd8, 0x10, 0xf2, 0x10,
- 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x1a, 0x02, 0x0c, 0x02, 0x0c, 0x02, 0x16, 0x02, 0x16,
+ 0x02, 0x13, 0x00, 0x13, 0x86, 0x11, 0x8c, 0x11, 0xd8, 0x10, 0xf2, 0x10,
+ 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_question -background white -foreground black -data {
#define file_question_width 14
#define file_question_height 15
static unsigned char file_question_bits[] = {
- 0xfe, 0x01, 0x02, 0x02, 0xe2, 0x04, 0xf2, 0x09, 0x1a, 0x1b, 0x0a, 0x13,
- 0x82, 0x11, 0xc2, 0x10, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10, 0x62, 0x10,
- 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x02, 0xe2, 0x04, 0xf2, 0x09, 0x1a, 0x1b, 0x0a, 0x13,
+ 0x82, 0x11, 0xc2, 0x10, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10, 0x62, 0x10,
+ 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_removed -background white -foreground red -data {
#define file_removed_width 14
#define file_removed_height 15
static unsigned char file_removed_bits[] = {
- 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10,
- 0x1a, 0x16, 0x32, 0x13, 0xe2, 0x11, 0xc2, 0x10, 0xe2, 0x11, 0x32, 0x13,
- 0x1a, 0x16, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10,
+ 0x1a, 0x16, 0x32, 0x13, 0xe2, 0x11, 0xc2, 0x10, 0xe2, 0x11, 0x32, 0x13,
+ 0x1a, 0x16, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_merge -background white -foreground blue -data {
#define file_merge_width 14
#define file_merge_height 15
static unsigned char file_merge_bits[] = {
- 0xfe, 0x01, 0x02, 0x03, 0x62, 0x05, 0x62, 0x09, 0x62, 0x1f, 0x62, 0x10,
- 0xfa, 0x11, 0xf2, 0x10, 0x62, 0x10, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10,
- 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x03, 0x62, 0x05, 0x62, 0x09, 0x62, 0x1f, 0x62, 0x10,
+ 0xfa, 0x11, 0xf2, 0x10, 0x62, 0x10, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10,
+ 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
image create bitmap file_statechange -background white -foreground green -data {
#define file_statechange_width 14
#define file_statechange_height 15
static unsigned char file_statechange_bits[] = {
- 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x62, 0x10,
- 0x62, 0x10, 0xba, 0x11, 0xba, 0x11, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10,
- 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};
+ 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x62, 0x10,
+ 0x62, 0x10, 0xba, 0x11, 0xba, 0x11, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10,
+ 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
set ui_index .vpane.files.index.list
@@ -3272,7 +3275,7 @@ pack .vpane -anchor n -side top -fill both -expand 1
textframe .vpane.files.workdir -height 100 -width 200
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -foreground black
-ttext $ui_workdir -background white -foreground black \
+ttext $ui_workdir \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -3294,7 +3297,7 @@ textframe .vpane.files.index -height 100 -width 200
tlabel .vpane.files.index.title \
-text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -foreground black
-ttext $ui_index -background white -foreground black \
+ttext $ui_index \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -3321,7 +3324,9 @@ if {!$use_ttk} {
foreach i [list $ui_index $ui_workdir] {
rmsel_tag $i
- $i tag conf in_diff -background [$i tag cget in_sel -background]
+ $i tag conf in_diff \
+ -background $color::select_bg \
+ -foreground $color::select_fg
}
unset i
@@ -3429,7 +3434,7 @@ if {![is_enabled nocommit]} {
}
textframe .vpane.lower.commarea.buffer.frame
-ttext $ui_comm -background white -foreground black \
+ttext $ui_comm \
-borderwidth 1 \
-undo true \
-maxundo 20 \
@@ -3558,7 +3563,7 @@ bind .vpane.lower.diff.header.path <Button-1> {do_file_open $current_diff_path}
#
textframe .vpane.lower.diff.body
set ui_diff .vpane.lower.diff.body.t
-ttext $ui_diff -background white -foreground black \
+ttext $ui_diff \
-borderwidth 0 \
-width 80 -height 5 -wrap none \
-font font_diff \
@@ -3878,18 +3883,18 @@ proc on_application_mapped {} {
set gm $repo_config(gui.geometry)
if {$use_ttk} {
bind .vpane <Map> \
- [list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
+ [list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
bind .vpane.files <Map> \
- [list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
+ [list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
} else {
bind .vpane <Map> \
- [list on_tk_pane_mapped %W 0 \
- [lindex $gm 1] \
- [lindex [.vpane sash coord 0] 1]]
+ [list on_tk_pane_mapped %W 0 \
+ [lindex $gm 1] \
+ [lindex [.vpane sash coord 0] 1]]
bind .vpane.files <Map> \
- [list on_tk_pane_mapped %W 0 \
- [lindex [.vpane.files sash coord 0] 0] \
- [lindex $gm 2]]
+ [list on_tk_pane_mapped %W 0 \
+ [lindex [.vpane.files sash coord 0] 0] \
+ [lindex $gm 2]]
}
wm geometry . [lindex $gm 0]
}
diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl
index 62ec083667..8441e109be 100644
--- a/git-gui/lib/blame.tcl
+++ b/git-gui/lib/blame.tcl
@@ -328,6 +328,7 @@ constructor new {i_commit i_path i_jump} {
bind $i <Any-Motion> [cb _show_tooltip $i @%x,%y]
bind $i <Any-Enter> [cb _hide_tooltip]
bind $i <Any-Leave> [cb _hide_tooltip]
+ bind $i <Deactivate> [cb _hide_tooltip]
bind_button3 $i "
[cb _hide_tooltip]
set cursorX %x
diff --git a/git-gui/lib/themed.tcl b/git-gui/lib/themed.tcl
index 88b3119a75..83e3ac795f 100644
--- a/git-gui/lib/themed.tcl
+++ b/git-gui/lib/themed.tcl
@@ -1,6 +1,44 @@
# Functions for supporting the use of themed Tk widgets in git-gui.
# Copyright (C) 2009 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+namespace eval color {
+ # Variable colors
+ # Preffered way to set widget colors is using add_option.
+ # In some cases, like with tags in_diff/in_sel, we use these colors.
+ variable select_bg lightgray
+ variable select_fg black
+
+ proc sync_with_theme {} {
+ set base_bg [ttk::style lookup . -background]
+ set base_fg [ttk::style lookup . -foreground]
+ set text_bg [ttk::style lookup Treeview -background]
+ set text_fg [ttk::style lookup Treeview -foreground]
+ set select_bg [ttk::style lookup Default -selectbackground]
+ set select_fg [ttk::style lookup Default -selectforeground]
+
+ set color::select_bg $select_bg
+ set color::select_fg $select_fg
+
+ proc add_option {key val} {
+ option add $key $val widgetDefault
+ }
+ # Add options for plain Tk widgets
+ # Using `option add` instead of tk_setPalette to avoid unintended
+ # consequences.
+ if {![is_MacOSX]} {
+ add_option *Menu.Background $base_bg
+ add_option *Menu.Foreground $base_fg
+ add_option *Menu.activeBackground $select_bg
+ add_option *Menu.activeForeground $select_fg
+ }
+ add_option *Text.Background $text_bg
+ add_option *Text.Foreground $text_fg
+ add_option *Text.HighlightBackground $base_bg
+ add_option *Text.HighlightColor $select_bg
+ }
+}
+
proc ttk_get_current_theme {} {
# Handle either current Tk or older versions of 8.5
if {[catch {set theme [ttk::style theme use]}]} {