Patchwork hgk: enable selected patch text on Windows

login
register
mail settings
Submitter Andrew Shadura
Date March 15, 2014, 6:19 p.m.
Message ID <d1ef724df3b4d403338d.1394907598@localhost.localdomain>
Download mbox | patch
Permalink /patch/3947/
State Accepted
Commit d9378bfa0af08472526700204bdf1595fc64974f
Headers show

Comments

Andrew Shadura - March 15, 2014, 6:19 p.m.
# HG changeset patch
# User Andrew Shadura <andrew@shadura.me>
# Date 1394894691 -3600
#      Sat Mar 15 15:44:51 2014 +0100
# Node ID d1ef724df3b4d403338d986cf25a7e8bd5a67264
# Parent  242d091f03284062f1ca4c270e7020f117d79eb5
hgk: enable selected patch text on Windows

Port a patch from gitk. Original description:

On windows, mouse input follows the keyboard focus, so to allow selecting
text from the patch canvas we must not shift focus back to the top level.
This change has no negative impact on X, so we don't explicitly test
for Win32 on this change. This provides similar selection capability
as already available using X-Windows.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Patch

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -795,8 +795,8 @@  proc bindkey {ev script} {
 # set the focus back to the toplevel for any click outside
 # the entry widgets
 proc click {w} {
-    global entries
-    foreach e $entries {
+    global ctext entries
+    foreach e [concat $entries $ctext] {
 	if {$w == $e} return
     }
     focus .
@@ -2546,6 +2546,7 @@  proc selectline {l isnew} {
 
 proc selnextline {dir} {
     global selectedline
+    focus .
     if {![info exists selectedline]} return
     set l [expr $selectedline + $dir]
     unmarkmatches
@@ -2583,6 +2584,7 @@  proc addtohistory {cmd} {
 
 proc goback {} {
     global history historyindex
+    focus .
 
     if {$historyindex > 1} {
 	incr historyindex -1
@@ -2597,6 +2599,7 @@  proc goback {} {
 
 proc goforw {} {
     global history historyindex
+    focus .
 
     if {$historyindex < [llength $history]} {
 	set cmd [lindex $history $historyindex]