From 85ec3e7778c09f5d4f52a29f57c5ecc64070ffd1 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 21 Feb 2008 12:22:08 -0500 Subject: [PATCH 1/4] git-gui: Paper bag fix error dialogs opening over the main window If the main window is the only toplevel we have open then we don't have a valid grab right now, so we need to assume the best toplevel to use for the parent is ".". Signed-off-by: Shawn O. Pearce --- lib/error.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/error.tcl b/lib/error.tcl index 45800d5493..08a24622c7 100644 --- a/lib/error.tcl +++ b/lib/error.tcl @@ -2,7 +2,11 @@ # Copyright (C) 2006, 2007 Shawn Pearce proc _error_parent {} { - return [grab current .] + set p [grab current .] + if {$p eq {}} { + return . + } + return $p } proc error_popup {msg} { From 651fbba2d36072b2491bc53628159ff4fb3085dc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 21 Feb 2008 19:17:27 -0500 Subject: [PATCH 2/4] git-gui: Default TCL_PATH to same location as TCLTK_PATH Most users set TCLTK_PATH to tell git-gui where to find wish, but they fail to set TCL_PATH to the same Tcl installation. We use the non-GUI tclsh during builds so headless systems are still able to create an index file and create message files without GNU msgfmt. So it matters to us that we find a working TCL_PATH at build time. If TCL_PATH hasn't been set yet we can take a better guess about what tclsh executable to use by replacing 'wish' in the executable path with 'tclsh'. We only do this replacement on the filename part of the path, just in case the string "wish" appears in the directory paths. Most of the time the tclsh will be installed alongside wish so this replacement is a sensible and safe default. Signed-off-by: Shawn O. Pearce --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 081d7550a7..1ba0e788f9 100644 --- a/Makefile +++ b/Makefile @@ -92,8 +92,12 @@ ifndef V REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst" endif -TCL_PATH ?= tclsh TCLTK_PATH ?= wish +ifeq (./,$(dir $(TCLTK_PATH))) + TCL_PATH ?= $(subst wish,tclsh,$(TCLTK_PATH)) +else + TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH))) +endif ifeq ($(uname_S),Darwin) TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app From df4ec4cf6f68d92d2fbf20e808722d242ab2b894 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 21 Feb 2008 19:27:46 -0500 Subject: [PATCH 3/4] git-gui: Avoid hardcoded Windows paths in Cygwin package files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we are being built by the Cygwin package maintainers we need to embed the POSIX path to our library files and not the Windows path. Embedding the Windows path means all end-users who install our Cygwin package would be required to install Cygwin at the same Windows path as the package maintainer had Cygwin installed to. This requirement is simply not user-friendly and may be infeasible for a large number of our users. We now try to auto-detect if the Tcl/Tk binary we will use at runtime is capable of translating POSIX paths into Windows paths the same way that cygpath does the translations. If the Tcl/Tk binary gives us the same results then it understands the Cygwin path translation process and should be able to read our library files from a POSIX path name. If it does not give us the same answer as cygpath then the Tcl/Tk binary might actually be a native Win32 build (one that is not linked against Cygwin) and thus requires the native Windows path to our library files. We can assume this is not a Cygwin package as the Cygwin maintainers do not currently ship a pure Win32 build of Tcl/Tk. Reported on the git mailing list by Jurko Gospodnetić. Signed-off-by: Shawn O. Pearce --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1ba0e788f9..01e0a46ba5 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,17 @@ GITGUI_MACOSXAPP := ifeq ($(uname_O),Cygwin) GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"` - gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + + # Is this a Cygwin Tcl/Tk binary? If so it knows how to do + # POSIX path translation just like cygpath does and we must + # keep libdir in POSIX format so Cygwin packages of git-gui + # work no matter where the user installs them. + # + ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /)) + gg_libdir_sed_in := $(gg_libdir) + else + gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + endif else ifeq ($(exedir),$(gg_libdir)) GITGUI_RELATIVE := 1 From 3baee1f3bf8e30f0fc67bbb1a49877bf0660fd29 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 11 Feb 2008 00:53:52 -0500 Subject: [PATCH 4/4] git-gui: Focus insertion point at end of strings in repository chooser When selecting a local working directory for a new repository or a location to clone an existing repository into we now set the insert point at the end of the selected path, allowing the user to type in any additional parts of the path if they so desire. Signed-off-by: Shawn O. Pearce --- lib/choose_repository.tcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 86faf24cc8..0adcf9d958 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -11,6 +11,7 @@ field w_quit ; # Quit button field o_cons ; # Console object (if active) field w_types ; # List of type buttons in clone field w_recentlist ; # Listbox containing recent repositories +field w_localpath ; # Entry widget bound to local_path field done 0 ; # Finished picking the repository? field local_path {} ; # Where this repository is locally @@ -385,6 +386,7 @@ method _do_new {} { button $w_body.where.b \ -text [mc "Browse"] \ -command [cb _new_local_path] + set w_localpath $w_body.where.t pack $w_body.where.b -side right pack $w_body.where.l -side left @@ -416,6 +418,7 @@ method _new_local_path {} { return } set local_path $p + $w_localpath icursor end } method _do_new2 {} { @@ -481,6 +484,7 @@ method _do_clone {} { -text [mc "Browse"] \ -command [cb _new_local_path] grid $args.where_l $args.where_t $args.where_b -sticky ew + set w_localpath $args.where_t label $args.type_l -text [mc "Clone Type:"] frame $args.type_f