Keyboard navigation in Message Windows patch.
- From: "Jesse D . Sightler" <jsight pair com>
- To: balsa-list gnome org
- Subject: Keyboard navigation in Message Windows patch.
- Date: Sat, 13 Mar 1999 21:11:25 -0500
This little baboon wart allows you to use the keyboard navigation keys
to move up and down while reading email. Implemented are the arrow
keys, PgUp, PgDn, Home, and End.
Note that there is almost certainly "A Better Way" (TM) to do this, but
this works here. :)
---------------
Jesse D. Sightler
http://www3.pair.com/jsight/
"An honest answer can get you into a lot of trouble."
- Anonymous
--- /home/jsight/gnomecvs/balsa/src/balsa-message.c Tue Mar 2 19:59:41 1999
+++ balsa-message.c Sat Mar 13 20:57:35 1999
@@ -312,6 +312,75 @@
(y2 > allocation->height) ? y2 : allocation->height);
}
+gint key_press (GtkWidget *widget, GdkEventKey *event, gpointer callback_data)
+{
+
+ int x;
+ int y;
+
+ double x2,x3;
+ double y2,y3;
+
+ if (event->keyval == 65362) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, y-15);
+ printf ("Scroll offset: %d\n\n", y);
+ return (TRUE);
+ }
+ if (event->keyval == 65364) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, y+15);
+ printf ("Scroll offset: %d\n\n", y);
+ return (TRUE);
+ }
+ if (event->keyval == 65361) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x-15, y);
+ printf ("Scroll offset: %d\n\n", y);
+ return (TRUE);
+ }
+ if (event->keyval == 65363) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x+15, y);
+ printf ("Scroll offset: %d\n\n", y);
+ return (TRUE);
+ }
+ if (event->keyval == 65365) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ printf ("Scroll offsget: %d\n\n", y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, y-(GTK_WIDGET (widget))->allocation.height);
+ printf ("Scroll offset: %d\n\n", y);
+ return (TRUE);
+ }
+ if (event->keyval == 65366) {
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ printf ("Scroll offsegt: %d\n\n", y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, y+(GTK_WIDGET (widget))->allocation.height);
+ return (TRUE);
+ }
+ if (event->keyval == 65360) {
+ gnome_canvas_get_scroll_region (GNOME_CANVAS(widget), &x2, &y2, &x3, &y3);
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ printf ("Scroll offsegt: %d\n\n", -y);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, 0);
+ return (FALSE);
+ }
+ if (event->keyval == 65367) {
+ gnome_canvas_get_scroll_region (GNOME_CANVAS(widget), &x2, &y2, &x3, &y3);
+ gnome_canvas_get_scroll_offsets (GNOME_CANVAS(widget), &x, &y);
+ printf ("Scroll offsgjket: %f\n\n", y3);
+ gnome_canvas_scroll_to (GNOME_CANVAS(widget), x, y3);
+ return (FALSE);
+ }
+
+ printf ("KeyPressed was: %d\n\n", event->keyval);
+ return (FALSE);
+}
+
+void button_pressed_here (GtkWidget *widget, GdkEventButton *event, gpointer callback_data) {
+ (*(GTK_WIDGET_CLASS (GTK_WIDGET(widget)->object.klass)->grab_focus))(widget);
+ printf ("THat thar button got pressed%d\n\n",1);
+}
void
balsa_message_set (BalsaMessage * bmessage,
@@ -349,6 +418,10 @@
0,
(x2 > alloc->width) ? x2 : alloc->width,
(y2 > alloc->height) ? y2 : alloc->height);
+
+ gtk_signal_connect_after(GTK_OBJECT (bmessage), "key_press_event", key_press, NULL);
+ gtk_signal_connect(GTK_OBJECT (bmessage), "button_press_event", button_pressed_here, NULL);
+ printf ("Test,test,test,test,test,test%d\n\n",1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]