summaryrefslogtreecommitdiff
path: root/stickynotes/stickynotes_callbacks.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2021-10-07 19:43:23 +0200
committerraveit65 <[email protected]>2021-10-26 16:00:45 +0200
commit999eec53c643721b37bc7ad847cdfdf93c124085 (patch)
tree7b6eb27b0e6d3588179141c834e225d7d1a93cf4 /stickynotes/stickynotes_callbacks.c
parentd3527344f928d0352e6ec92e6e6d954374664e71 (diff)
downloadmate-applets-999eec53c643721b37bc7ad847cdfdf93c124085.tar.bz2
mate-applets-999eec53c643721b37bc7ad847cdfdf93c124085.tar.xz
stickynotes: Popup the note menu with the keyboard
Diffstat (limited to 'stickynotes/stickynotes_callbacks.c')
-rw-r--r--stickynotes/stickynotes_callbacks.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/stickynotes/stickynotes_callbacks.c b/stickynotes/stickynotes_callbacks.c
index 3e849131..dac681a1 100644
--- a/stickynotes/stickynotes_callbacks.c
+++ b/stickynotes/stickynotes_callbacks.c
@@ -122,11 +122,12 @@ stickynote_show_popup_menu (GtkWidget *widget,
return FALSE;
}
-/* Sticky Window Callback : Exit entry field on key press. */
+/* Sticky Window Callback : Exit entry field on key press or popup
+ * the right click menu. */
gboolean
-stickynote_keypress_cb (GtkWidget *widget,
- GdkEventKey *event,
- StickyNote *note)
+stickynote_keypress_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ GtkMenu *popup_menu)
{
GdkModifierType state = event->state & gtk_accelerator_get_default_mod_mask ();
@@ -143,6 +144,22 @@ stickynote_keypress_cb (GtkWidget *widget,
break;
}
+ if ((event->keyval == GDK_KEY_F10 && (state == 0 || state == GDK_SHIFT_MASK)) ||
+ (event->keyval == GDK_KEY_Menu && state == 0)) {
+ GtkWidget *focus_widget = NULL;
+
+ if (GTK_IS_WINDOW (widget))
+ focus_widget = gtk_window_get_focus (GTK_WINDOW (widget));
+ if (! focus_widget)
+ focus_widget = widget;
+
+ gtk_menu_popup_at_widget (popup_menu, focus_widget,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (const GdkEvent*) event);
+ return TRUE;
+ }
+
return FALSE;
}