[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#685686: unblock: putty/0.62-9



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

putty 0.62-9 fixes a regression caused by a pre-freeze upload (0.62-8)
introducing support for dead keys and compose sequences.  This is an
important feature so I'd rather fix it than back it out, particularly
since upstream has provided a fix.  Here's the upstream commit message
and the diff.

------------------------------------------------------------------------
r9573 | simon | 2012-07-06 00:45:20 +0100 (Fri, 06 Jul 2012) | 13 lines

Turns out that the compose-keys fix in r9567 did in fact break one
piece of keyboard handling: if Num Lock is on, numeric keypad keys are
eaten by the IM, so we must avoid passing them to the IM in the first
place if we're in any non-default numeric keypad mode (application or
Nethack).

This is a grubby way to do it, but the more obvious approach of just
moving the Nethack and app-keypad if statements up to above the IM
call doesn't work because those statements depend on the generic
Alt-prefix handling that happens just _below_ the IM call. So instead
I just repeat the list of keystrokes and modes in an if statement
conditionalising the IM call.

------------------------------------------------------------------------

diff -Nru putty-0.62/debian/changelog putty-0.62/debian/changelog
--- putty-0.62/debian/changelog	2012-06-22 15:18:52.000000000 +0100
+++ putty-0.62/debian/changelog	2012-08-23 12:58:53.000000000 +0100
@@ -1,3 +1,11 @@
+putty (0.62-9) unstable; urgency=low
+
+  * Backport from upstream (Simon Tatham):
+    - Fix handling of non-default numeric keypad modes when Num Lock is on
+      (closes: #680261).
+
+ -- Colin Watson <cjwatson@debian.org>  Thu, 23 Aug 2012 12:58:52 +0100
+
 putty (0.62-8) unstable; urgency=low
 
   * Backport from upstream (Simon Tatham):
diff -Nru putty-0.62/debian/patches/compose.patch putty-0.62/debian/patches/compose.patch
--- putty-0.62/debian/patches/compose.patch	2012-06-22 15:05:52.000000000 +0100
+++ putty-0.62/debian/patches/compose.patch	2012-08-23 12:58:31.000000000 +0100
@@ -1,6 +1,7 @@
 Description: Support dead keys and compose sequences
 Origin: backport, http://svn.tartarus.org/sgt?view=rev&revision=9567
 Origin: upstream, http://svn.tartarus.org/sgt?view=rev&revision=9568
+Origin: backport, http://svn.tartarus.org/sgt?view=rev&revision=9573
 Forwarded: not-needed
 Last-Update: 2012-06-22
 
@@ -48,7 +49,15 @@
      return TRUE;
  }
  
-@@ -528,21 +540,26 @@
+@@ -509,6 +521,7 @@
+     char output[256];
+     wchar_t ucsoutput[2];
+     int ucsval, start, end, special, output_charset, use_ucsoutput;
++    int nethack_mode, app_keypad_mode;
+ 
+     /* Remember the timestamp. */
+     inst->input_event_time = event->time;
+@@ -528,21 +541,26 @@
       * inconvenience in having to type a zero before a single-digit
       * character code.
       */
@@ -88,12 +97,83 @@
      }
  
      if (event->type == GDK_KEY_PRESS) {
-@@ -658,13 +675,13 @@
+@@ -645,6 +663,10 @@
+ 	special = FALSE;
+ 	use_ucsoutput = FALSE;
+ 
++        nethack_mode = inst->cfg.nethack_keypad;
++        app_keypad_mode = (inst->term->app_keypad_keys &&
++                           !inst->cfg.no_applic_k);
++
+ 	/* ALT+things gives leading Escape. */
+ 	output[0] = '\033';
+ #if !GTK_CHECK_VERSION(2,0,0)
+@@ -658,13 +680,73 @@
  	output_charset = CS_ISO8859_1;
  	strncpy(output+1, event->string, lenof(output)-1);
  #else
-+        if (gtk_im_context_filter_keypress(inst->imc, event))
-+            return TRUE;
++        /*
++         * Most things can now be passed to
++         * gtk_im_context_filter_keypress without breaking anything
++         * below this point. An exception is the numeric keypad if
++         * we're in Nethack or application mode: the IM will eat
++         * numeric keypad presses if Num Lock is on, but we don't want
++         * it to.
++         */
++	if (app_keypad_mode &&
++            (event->keyval == GDK_Num_Lock ||
++             event->keyval == GDK_KP_Divide ||
++             event->keyval == GDK_KP_Multiply ||
++             event->keyval == GDK_KP_Subtract ||
++             event->keyval == GDK_KP_Add ||
++             event->keyval == GDK_KP_Enter ||
++             event->keyval == GDK_KP_0 ||
++             event->keyval == GDK_KP_Insert ||
++             event->keyval == GDK_KP_1 ||
++             event->keyval == GDK_KP_End ||
++             event->keyval == GDK_KP_2 ||
++             event->keyval == GDK_KP_Down ||
++             event->keyval == GDK_KP_3 ||
++             event->keyval == GDK_KP_Page_Down ||
++             event->keyval == GDK_KP_4 ||
++             event->keyval == GDK_KP_Left ||
++             event->keyval == GDK_KP_5 ||
++             event->keyval == GDK_KP_Begin ||
++             event->keyval == GDK_KP_6 ||
++             event->keyval == GDK_KP_Right ||
++             event->keyval == GDK_KP_7 ||
++             event->keyval == GDK_KP_Home ||
++             event->keyval == GDK_KP_8 ||
++             event->keyval == GDK_KP_Up ||
++             event->keyval == GDK_KP_9 ||
++             event->keyval == GDK_KP_Page_Up ||
++             event->keyval == GDK_KP_Decimal ||
++             event->keyval == GDK_KP_Delete)) {
++            /* app keypad; do nothing */
++        } else if (nethack_mode &&
++                   (event->keyval == GDK_KP_1 ||
++                    event->keyval == GDK_KP_End ||
++                    event->keyval == GDK_KP_2 ||
++                    event->keyval == GDK_KP_Down ||
++                    event->keyval == GDK_KP_3 ||
++                    event->keyval == GDK_KP_Page_Down ||
++                    event->keyval == GDK_KP_4 ||
++                    event->keyval == GDK_KP_Left ||
++                    event->keyval == GDK_KP_5 ||
++                    event->keyval == GDK_KP_Begin ||
++                    event->keyval == GDK_KP_6 ||
++                    event->keyval == GDK_KP_Right ||
++                    event->keyval == GDK_KP_7 ||
++                    event->keyval == GDK_KP_Home ||
++                    event->keyval == GDK_KP_8 ||
++                    event->keyval == GDK_KP_Up ||
++                    event->keyval == GDK_KP_9 ||
++                    event->keyval == GDK_KP_Page_Up)) {
++            /* nethack mode; do nothing */
++        } else {
++            if (gtk_im_context_filter_keypress(inst->imc, event))
++                return TRUE;
++        }
 +
  	/*
  	 * GDK 2.0 arranges to have done some translation for us: in
@@ -105,7 +185,25 @@
  	 * So we use the standard C library function mbstowcs() to
  	 * convert from the current locale into Unicode; from there
  	 * we can convert to whatever PuTTY is currently working in.
-@@ -1119,6 +1136,16 @@
+@@ -786,7 +868,7 @@
+ 	/*
+ 	 * NetHack keypad mode.
+ 	 */
+-	if (inst->cfg.nethack_keypad) {
++	if (nethack_mode) {
+ 	    char *keys = NULL;
+ 	    switch (event->keyval) {
+ 	      case GDK_KP_1: case GDK_KP_End: keys = "bB\002"; break;
+@@ -815,7 +897,7 @@
+ 	/*
+ 	 * Application keypad mode.
+ 	 */
+-	if (inst->term->app_keypad_keys && !inst->cfg.no_applic_k) {
++	if (app_keypad_mode) {
+ 	    int xkey = 0;
+ 	    switch (event->keyval) {
+ 	      case GDK_Num_Lock: xkey = 'P'; break;
+@@ -1119,6 +1201,16 @@
      return TRUE;
  }
  
@@ -122,7 +220,7 @@
  gboolean button_internal(struct gui_data *inst, guint32 timestamp,
  			 GdkEventType type, guint ebutton, guint state,
  			 gdouble ex, gdouble ey)
-@@ -2310,6 +2337,17 @@
+@@ -2310,6 +2402,17 @@
  		    x*inst->font_width+inst->cfg.window_border,
  		    y*inst->font_height+inst->cfg.window_border,
  		    len*widefactor*inst->font_width, inst->font_height);
@@ -140,7 +238,7 @@
  }
  
  GdkCursor *make_mouse_ptr(struct gui_data *inst, int cursor_val)
-@@ -3367,6 +3405,8 @@
+@@ -3367,6 +3470,8 @@
      extern int cfgbox(Config *cfg);
      struct gui_data *inst;
  
@@ -149,7 +247,7 @@
      /*
       * Create an instance structure and initialise to zeroes
       */
-@@ -3426,6 +3466,10 @@
+@@ -3426,6 +3531,10 @@
  
      inst->area = gtk_drawing_area_new();
  
@@ -160,7 +258,7 @@
      setup_fonts_ucs(inst);
      init_cutbuffers();
  
-@@ -3512,6 +3556,10 @@
+@@ -3512,6 +3621,10 @@
  		       GTK_SIGNAL_FUNC(selection_get), inst);
      gtk_signal_connect(GTK_OBJECT(inst->area), "selection_clear_event",
  		       GTK_SIGNAL_FUNC(selection_clear), inst);

Thanks,

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: