[gcalctool] Handle keycode for '^' used in non-English layouts (German, Spanish, etc) and allow '**' to be conve
- From: Robert Ancell <rancell src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcalctool] Handle keycode for '^' used in non-English layouts (German, Spanish, etc) and allow '**' to be conve
- Date: Fri, 18 Sep 2009 23:21:47 +0000 (UTC)
commit f89456712edb758eae899457acad6665ffcd9faa
Author: Robert Ancell <robert ancell gmail com>
Date: Fri Sep 18 11:20:05 2009 +1000
Handle keycode for '^' used in non-English layouts (German, Spanish, etc) and allow '**' to be converted to a '^' for layouts that do not support it (Robert Ancell, Bug #546819) (Hard code freeze approved by Frederic Crozat and Lucas Rocha)
ChangeLog | 6 ++++++
src/gtk.c | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb620cd..3117bf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,12 @@
gcalctool change history.
=========================
+2009-09-18 Robert Ancell <robert ancell gmail com>
+
+ * Handle keycode for '^' used in non-English layouts (German, Spanish, etc)
+ and allow '**' to be converted to a '^' for layouts that do not support it
+ (Robert Ancell, Bug #546819)
+
2009-09-17 Robert Ancell <robert ancell gmail com>
* Don't override space bar when buttons are focussed as this stops keyboard control
diff --git a/src/gtk.c b/src/gtk.c
index f91fec4..ce90439 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -396,8 +396,8 @@ static struct button_widget button_widgets[] = {
{ GDK_H, 0 }},
{FN_X_POW_Y, "x_pow_y",
- { 0, 0, 0, 0 },
- { GDK_o, GDK_caret, GDK_asciicircum, 0 }},
+ { 0, 0, 0, 0, 0 },
+ { GDK_o, GDK_caret, GDK_asciicircum, GDK_dead_circumflex, 0 }},
{FN_X_POW_Y_INV, "x_pow_y",
{ 0, 0 },
@@ -529,7 +529,9 @@ typedef struct {
GdkAtom clipboard_atom;
GdkAtom primary_atom;
- char *shelf; /* PUT selection shelf contents. */
+ char *shelf; /* PUT selection shelf contents. */
+
+ int last_function;
} GtkUI;
static GtkUI X;
@@ -998,8 +1000,17 @@ static void do_button(int function, int arg)
cursor_start = -1;
cursor_end = cursor_start;
}
-
- do_expression(function, arg, cursor_start, cursor_end);
+
+ /* Some keyboards don't have a '^' button so convert two multiplies to one '^' */
+ if (cursor_start == cursor_end &&
+ function == FN_MULTIPLY && X.last_function == FN_MULTIPLY) {
+ do_button(FN_BACKSPACE, 0);
+ do_button(FN_X_POW_Y, 0);
+ }
+ else {
+ do_expression(function, arg, cursor_start, cursor_end);
+ X.last_function = function;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]