[file-roller/wip/iainl/keypress-fixes: 4/4] fr-window: Show the right click menu on the "Menu" key too
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/iainl/keypress-fixes: 4/4] fr-window: Show the right click menu on the "Menu" key too
- Date: Tue, 23 Apr 2019 14:56:40 +0000 (UTC)
commit 855f68056a11606d630eef4954ac19182f44363e
Author: Iain Lane <iainl gnome org>
Date: Tue Apr 23 15:47:18 2019 +0100
fr-window: Show the right click menu on the "Menu" key too
This copies code from gtkplacessidebar.c in GTK. Here we also start
using `gtk_accelerator_get_default_mod_mask()`, so that we work with
exactly the keys requested and not extra ones (e.g. `Shift-F10` works
but `Ctrl-Shift-F10` now does not).
src/fr-window.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index de8f3330..040df2db 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4813,6 +4813,7 @@ key_press_cb (GtkWidget *widget,
FrWindow *window = data;
gboolean retval = GDK_EVENT_PROPAGATE;
gboolean alt;
+ guint modifiers;
if (gtk_widget_has_focus (window->priv->location_entry))
return GDK_EVENT_PROPAGATE;
@@ -4820,7 +4821,9 @@ key_press_cb (GtkWidget *widget,
if (gtk_widget_has_focus (window->priv->filter_entry))
return GDK_EVENT_PROPAGATE;
- alt = (event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK;
+ modifiers = gtk_accelerator_get_default_mod_mask ();
+
+ alt = (event->state & modifiers) == GDK_MOD1_MASK;
switch (event->keyval) {
case GDK_KEY_Escape:
@@ -4831,7 +4834,10 @@ key_press_cb (GtkWidget *widget,
break;
case GDK_KEY_F10:
- if (event->state & GDK_SHIFT_MASK) {
+ case GDK_KEY_Menu:
+ if ((event->keyval == GDK_KEY_Menu) ||
+ ((event->keyval == GDK_KEY_F10) &&
+ (event->state & modifiers) == GDK_SHIFT_MASK)) {
GtkTreeSelection *selection;
GList *selected_rows;
GtkTreePath *first_selected_row_path;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]