[gcalctool] Fix shift button keybinding crash
- From: Robert Ancell <rancell src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcalctool] Fix shift button keybinding crash
- Date: Tue, 22 Dec 2009 23:12:38 +0000 (UTC)
commit a0b463426e27b0a0cfd6588079f1623621c89716
Author: Robert Ancell <robert ancell gmail com>
Date: Wed Dec 23 10:08:12 2009 +1100
Fix shift button keybinding crash
ChangeLog | 4 ++++
src/gtk.c | 20 ++++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ebad4f2..00a2c5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
gcalctool change history.
=========================
+2009-12-23 Robert Ancell <robert ancell gmail com>
+
+ * Fix shift button keybinding crash (Robert Ancell)
+
2009-12-22 Robert Ancell <robert ancell gmail com>
* README:
diff --git a/src/gtk.c b/src/gtk.c
index bda826a..f5ab317 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -374,6 +374,7 @@ do_button(int function, gpointer arg)
{
GtkTextIter start, end;
gint cursor_start, cursor_end;
+ printf("%d %d %p\n", function, FN_TEXT, arg);
/* Disable super/subscript mode when finished entering */
if (function == FN_CALCULATE ||
@@ -1104,10 +1105,17 @@ popup_cb(GtkWidget *widget, GdkEventButton *event)
if (event == NULL) {
GtkAllocation allocation;
- gdk_window_get_origin(gtk_widget_get_window(widget), &loc.x, &loc.y);
- gtk_widget_get_allocation(widget, &allocation);
- loc.x += allocation.x;
- loc.y += allocation.y;
+ if (X.mode == PROGRAMMING) {
+ gdk_window_get_origin(gtk_widget_get_window(widget), &loc.x, &loc.y);
+ gtk_widget_get_allocation(widget, &allocation);
+ loc.x += allocation.x;
+ loc.y += allocation.y;
+ } else {
+ gdk_window_get_origin(gtk_widget_get_window(X.display_item), &loc.x, &loc.y);
+ gtk_widget_get_allocation(X.display_item, &allocation);
+ loc.x += allocation.x + allocation.width;
+ loc.y += allocation.y + allocation.height;
+ }
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, menu_pos_func,
(gpointer) &loc, 0, gtk_get_current_event_time());
} else if (event->button == 1) {
@@ -1327,10 +1335,10 @@ main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event)
switch(*event->string)
{
case '<':
- button_cb(GET_WIDGET("calc_shift_left_button"), NULL);
+ popup_cb(GET_WIDGET("calc_shift_left_button"), NULL);
return TRUE;
case '>':
- button_cb(GET_WIDGET("calc_shift_right_button"), NULL);
+ popup_cb(GET_WIDGET("calc_shift_right_button"), NULL);
return TRUE;
case '\n':
do_button(FN_CALCULATE, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]