r22101 - gnucash/trunk/src - Bug #486658: [win32] Cannot use period on decimal keypad in my locale

Christian Stimming cstim at code.gnucash.org
Mon Mar 19 16:49:03 EDT 2012


Author: cstim
Date: 2012-03-19 16:49:03 -0400 (Mon, 19 Mar 2012)
New Revision: 22101
Trac: http://svn.gnucash.org/trac/changeset/22101

Modified:
   gnucash/trunk/src/gnome-utils/gnc-amount-edit.c
   gnucash/trunk/src/register/register-gnome/formulacell-gnome.c
   gnucash/trunk/src/register/register-gnome/gnucash-sheet.c
   gnucash/trunk/src/register/register-gnome/pricecell-gnome.c
Log:
Bug #486658: [win32] Cannot use period on decimal keypad in my locale

Patch by Sebastien Alborini:

On win32, gdk never sends GDK_KP_Decimal, so this key cannot be detected.
Work around this by watching the underlying virtual keycode VK_DECIMAL.

Modified: gnucash/trunk/src/gnome-utils/gnc-amount-edit.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-amount-edit.c	2012-03-19 20:48:48 UTC (rev 22100)
+++ gnucash/trunk/src/gnome-utils/gnc-amount-edit.c	2012-03-19 20:49:03 UTC (rev 22101)
@@ -43,6 +43,9 @@
 #include "gnc-ui-util.h"
 #include "qof.h"
 
+#ifdef G_OS_WIN32
+# include <gdk/gdkwin32.h>
+#endif
 
 /* Signal codes */
 enum
@@ -154,6 +157,11 @@
     GNCAmountEdit *gae = GNC_AMOUNT_EDIT(widget);
     gint result;
 
+#ifdef G_OS_WIN32
+    /* gdk never sends GDK_KP_Decimal on win32. See #486658 */
+    if (event->hardware_keycode == VK_DECIMAL)
+        event->keyval = GDK_KP_Decimal;
+#endif
     if (event->keyval == GDK_KP_Decimal)
     {
         if (gae->print_info.monetary)

Modified: gnucash/trunk/src/register/register-gnome/formulacell-gnome.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/formulacell-gnome.c	2012-03-19 20:48:48 UTC (rev 22100)
+++ gnucash/trunk/src/register/register-gnome/formulacell-gnome.c	2012-03-19 20:49:03 UTC (rev 22101)
@@ -41,6 +41,10 @@
 #include "formulacell-gnome.h"
 #include "pricecell-gnome.h"
 
+#ifdef G_OS_WIN32
+# include <gdk/gdkwin32.h>
+#endif
+
 //static QofLogModule log_module = GNC_MOD_REGISTER;
 
 static
@@ -68,6 +72,11 @@
      * this after fixing a bug where one copy was kept up to date, and the
      * other not.  So, fix this.
      */
+#ifdef G_OS_WIN32
+    /* gdk never sends GDK_KP_Decimal on win32. See #486658 */
+    if (event->hardware_keycode == VK_DECIMAL)
+        event->keyval = GDK_KP_Decimal;
+#endif
     switch (event->keyval)
     {
     case GDK_Return:

Modified: gnucash/trunk/src/register/register-gnome/gnucash-sheet.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-sheet.c	2012-03-19 20:48:48 UTC (rev 22100)
+++ gnucash/trunk/src/register/register-gnome/gnucash-sheet.c	2012-03-19 20:49:03 UTC (rev 22101)
@@ -45,6 +45,10 @@
 #include "split-register.h"
 #include "gnc-engine.h"		// For debugging, e.g. ENTER(), LEAVE()
 
+#ifdef G_OS_WIN32
+# include <gdk/gdkwin32.h>
+#endif
+
 #define DEFAULT_REGISTER_HEIGHT 400
 #define DEFAULT_REGISTER_WIDTH  400
 /* Used to calculate the minimum preferred height of the register window: */
@@ -1885,6 +1889,11 @@
        bug#618434
            save keyval to handle GDK_KP_Decimal event
      */
+#ifdef G_OS_WIN32
+    /* gdk never sends GDK_KP_Decimal on win32. See #486658 */
+    if (event->hardware_keycode == VK_DECIMAL)
+        event->keyval = GDK_KP_Decimal;
+#endif
     if (sheet->preedit_length)
     {
         sheet->shift_state = 0;

Modified: gnucash/trunk/src/register/register-gnome/pricecell-gnome.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/pricecell-gnome.c	2012-03-19 20:48:48 UTC (rev 22100)
+++ gnucash/trunk/src/register/register-gnome/pricecell-gnome.c	2012-03-19 20:49:03 UTC (rev 22101)
@@ -37,6 +37,9 @@
 #include "pricecell.h"
 #include "pricecell-gnome.h"
 
+#ifdef G_OS_WIN32
+# include <gdk/gdkwin32.h>
+#endif
 
 static gboolean
 gnc_price_cell_direct_update (BasicCell *bcell,
@@ -57,6 +60,11 @@
 
     is_return = FALSE;
 
+#ifdef G_OS_WIN32
+    /* gdk never sends GDK_KP_Decimal on win32. See #486658 */
+    if (event->hardware_keycode == VK_DECIMAL)
+        event->keyval = GDK_KP_Decimal;
+#endif
     switch (event->keyval)
     {
     case GDK_Return:



More information about the gnucash-changes mailing list