From e79ebe3019e4e30b6105f2a36b0372f8ff51bc93 Mon Sep 17 00:00:00 2001 From: Nat Friedman Date: Wed, 20 Jan 1999 07:01:10 +0000 Subject: Only trap printable characters such that hotkeys work. (UNSELECT_TIMEOUT): 1999-01-20 Nat Friedman * gncal-full-day.c (gncal_full_day_key_press): Only trap printable characters such that hotkeys work. (UNSELECT_TIMEOUT): Changed to 0. Much saner behavior. * prop.c (properties): Connect gnome_help_pbox_display to the GnomePropertyBox help button. svn path=/trunk/; revision=615 --- calendar/ChangeLog | 9 +++++++ calendar/gncal-full-day.c | 56 ++++++++++++++++++++++++------------------- calendar/gui/gncal-full-day.c | 56 ++++++++++++++++++++++++------------------- calendar/gui/prop.c | 8 +++++++ calendar/prop.c | 8 +++++++ 5 files changed, 89 insertions(+), 48 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index c795e58417..05753e6020 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +1999-01-20 Nat Friedman + + * gncal-full-day.c (gncal_full_day_key_press): Only trap printable + characters such that hotkeys work. + (UNSELECT_TIMEOUT): Changed to 0. Much saner behavior. + + * prop.c (properties): Connect gnome_help_pbox_display to the + GnomePropertyBox help button. + 1999-01-19 Federico Mena Quintero * quick-view.c (quick_view_do_popup): Do not grab the mouse here diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index 402c19acee..343eb1281c 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -24,7 +24,7 @@ #define HANDLE_SIZE 8 #define MIN_WIDTH 200 #define XOR_RECT_WIDTH 2 -#define UNSELECT_TIMEOUT 150 /* ms */ +#define UNSELECT_TIMEOUT 0 /* ms */ /* Size of the pixmaps */ #define DECOR_WIDTH 16 @@ -109,7 +109,6 @@ static void gncal_full_day_forall (GtkContainer *container, static void range_activated (GncalFullDay *fullday); - static GtkContainerClass *parent_class; static int fullday_signals[LAST_SIGNAL] = { 0 }; @@ -1816,10 +1815,10 @@ gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event) break; case DRAG_SELECT: - if ((event->time - di->click_time) < UNSELECT_TIMEOUT) - di->sel_rows_used = 0; - else - recompute_motion (fullday, y); + if ((event->time - di->click_time) < UNSELECT_TIMEOUT) + di->sel_rows_used = 0; + else + recompute_motion (fullday, y); gdk_pointer_ungrab (event->time); @@ -1960,28 +1959,37 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } - if (event->length > 0) { - /* This means some printable key was pressed */ - - gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]); - - /* Find the new child, which should hopefully be focused, and insert the keypress */ - - for (children = fullday->children; children; children = children->next) { - child = children->data; + /* + * If a non-printable key was pressed, bail. Otherwise, begin + * editing the appointment. + */ + if ((event->keyval < 0x20) || (event->keyval > 0xFF) + || (event->length == 0) || (event->state & GDK_CONTROL_MASK) + || (event->state & GDK_MOD1_MASK)) + return FALSE; + + gtk_signal_emit (GTK_OBJECT (fullday), + fullday_signals[RANGE_ACTIVATED]); + + /* + * Find the new child, which should hopefully be focused, and + * insert the keypress. + */ + for (children = fullday->children; children; children = children->next) + { + child = children->data; - if (GTK_WIDGET_HAS_FOCUS (child->widget)) { - pos = gtk_text_get_length (GTK_TEXT (child->widget)); + if (GTK_WIDGET_HAS_FOCUS (child->widget)) { + pos = gtk_text_get_length (GTK_TEXT (child->widget)); - gtk_editable_insert_text (GTK_EDITABLE (child->widget), - event->string, - event->length, - &pos); + gtk_editable_insert_text (GTK_EDITABLE (child->widget), + event->string, + event->length, + &pos); - return TRUE; - } + return TRUE; } - } + } return FALSE; } diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c index 402c19acee..343eb1281c 100644 --- a/calendar/gui/gncal-full-day.c +++ b/calendar/gui/gncal-full-day.c @@ -24,7 +24,7 @@ #define HANDLE_SIZE 8 #define MIN_WIDTH 200 #define XOR_RECT_WIDTH 2 -#define UNSELECT_TIMEOUT 150 /* ms */ +#define UNSELECT_TIMEOUT 0 /* ms */ /* Size of the pixmaps */ #define DECOR_WIDTH 16 @@ -109,7 +109,6 @@ static void gncal_full_day_forall (GtkContainer *container, static void range_activated (GncalFullDay *fullday); - static GtkContainerClass *parent_class; static int fullday_signals[LAST_SIGNAL] = { 0 }; @@ -1816,10 +1815,10 @@ gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event) break; case DRAG_SELECT: - if ((event->time - di->click_time) < UNSELECT_TIMEOUT) - di->sel_rows_used = 0; - else - recompute_motion (fullday, y); + if ((event->time - di->click_time) < UNSELECT_TIMEOUT) + di->sel_rows_used = 0; + else + recompute_motion (fullday, y); gdk_pointer_ungrab (event->time); @@ -1960,28 +1959,37 @@ gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } - if (event->length > 0) { - /* This means some printable key was pressed */ - - gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]); - - /* Find the new child, which should hopefully be focused, and insert the keypress */ - - for (children = fullday->children; children; children = children->next) { - child = children->data; + /* + * If a non-printable key was pressed, bail. Otherwise, begin + * editing the appointment. + */ + if ((event->keyval < 0x20) || (event->keyval > 0xFF) + || (event->length == 0) || (event->state & GDK_CONTROL_MASK) + || (event->state & GDK_MOD1_MASK)) + return FALSE; + + gtk_signal_emit (GTK_OBJECT (fullday), + fullday_signals[RANGE_ACTIVATED]); + + /* + * Find the new child, which should hopefully be focused, and + * insert the keypress. + */ + for (children = fullday->children; children; children = children->next) + { + child = children->data; - if (GTK_WIDGET_HAS_FOCUS (child->widget)) { - pos = gtk_text_get_length (GTK_TEXT (child->widget)); + if (GTK_WIDGET_HAS_FOCUS (child->widget)) { + pos = gtk_text_get_length (GTK_TEXT (child->widget)); - gtk_editable_insert_text (GTK_EDITABLE (child->widget), - event->string, - event->length, - &pos); + gtk_editable_insert_text (GTK_EDITABLE (child->widget), + event->string, + event->length, + &pos); - return TRUE; - } + return TRUE; } - } + } return FALSE; } diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c index 4ae7359f06..1e771812f9 100644 --- a/calendar/gui/prop.c +++ b/calendar/gui/prop.c @@ -498,6 +498,10 @@ create_colors_page (void) void properties (GtkWidget *toplevel) { + static GnomeHelpMenuEntry help_entry = { NULL, "properties" }; + + help_entry.name = gnome_app_id; + if (prop_win) return; @@ -517,6 +521,10 @@ properties (GtkWidget *toplevel) gtk_signal_connect (GTK_OBJECT (prop_win), "apply", (GtkSignalFunc) prop_apply, NULL); + gtk_signal_connect (GTK_OBJECT (prop_win), "help", + GTK_SIGNAL_FUNC (gnome_help_pbox_display), + &help_entry); + gtk_widget_show_all (prop_win); } diff --git a/calendar/prop.c b/calendar/prop.c index 4ae7359f06..1e771812f9 100644 --- a/calendar/prop.c +++ b/calendar/prop.c @@ -498,6 +498,10 @@ create_colors_page (void) void properties (GtkWidget *toplevel) { + static GnomeHelpMenuEntry help_entry = { NULL, "properties" }; + + help_entry.name = gnome_app_id; + if (prop_win) return; @@ -517,6 +521,10 @@ properties (GtkWidget *toplevel) gtk_signal_connect (GTK_OBJECT (prop_win), "apply", (GtkSignalFunc) prop_apply, NULL); + gtk_signal_connect (GTK_OBJECT (prop_win), "help", + GTK_SIGNAL_FUNC (gnome_help_pbox_display), + &help_entry); + gtk_widget_show_all (prop_win); } -- cgit v1.2.3