summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stickynotes/stickynotes.c4
-rw-r--r--stickynotes/stickynotes_callbacks.c23
-rw-r--r--stickynotes/stickynotes_callbacks.h4
3 files changed, 31 insertions, 0 deletions
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index be05a5fb..978e731e 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -368,6 +368,10 @@ stickynote_new_aux (GdkScreen *screen,
G_CALLBACK (gtk_widget_hide),
note);
+ g_signal_connect (note->w_window, "key-press-event",
+ G_CALLBACK (stickynote_keypress_cb),
+ note);
+
g_object_unref (builder);
g_signal_connect_after (note->w_body, "button-press-event",
diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c
index 1d416f0f..b80f34e4 100644
--- a/stickynotes/stickynotes_callbacks.c
+++ b/stickynotes/stickynotes_callbacks.c
@@ -122,6 +122,29 @@ stickynote_show_popup_menu (GtkWidget *widget,
return FALSE;
}
+/* Sticky Window Callback : Exit entry field on key press. */
+gboolean
+stickynote_keypress_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ StickyNote *note)
+{
+ GdkModifierType state = event->state & gtk_accelerator_get_default_mod_mask ();
+
+ switch (event->keyval) {
+ case GDK_KEY_F6:
+ if (state == 0)
+ gtk_widget_child_focus(widget, GTK_DIR_TAB_FORWARD);
+ else if (state == GDK_SHIFT_MASK)
+ gtk_widget_child_focus(widget, GTK_DIR_TAB_BACKWARD);
+ else
+ break;
+ return TRUE;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
/* Popup Menu Callback : Create a new sticky note */
void popup_create_cb (GtkWidget *widget,
diff --git a/stickynotes/stickynotes_callbacks.h b/stickynotes/stickynotes_callbacks.h
index 42c86bb1..8934011f 100644
--- a/stickynotes/stickynotes_callbacks.h
+++ b/stickynotes/stickynotes_callbacks.h
@@ -49,6 +49,10 @@ gboolean
stickynote_show_popup_menu (GtkWidget *widget,
GdkEventButton *event,
GtkWidget *popup_menu);
+gboolean
+stickynote_keypress_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ StickyNote *note);
/* Callbacks for the sticky notes popup menu */
void