parent
54e1aa00db
commit
d299fcb369
@ -0,0 +1,96 @@
|
|||||||
|
From aa40e0ee762dce8f33af945a002bab52257486ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Uwe Scholz <u.scholz83@gmx.de>
|
||||||
|
Date: Mon, 22 Feb 2021 22:48:38 +0100
|
||||||
|
Subject: [PATCH] Open properties popup by keypress at the position of the
|
||||||
|
file/directory in the file list, fixing #96
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 1 +
|
||||||
|
doc/C/releases.xml | 3 +++
|
||||||
|
src/gnome-cmd-file-list.cc | 47 ++++++++++++++++++++++++++------------
|
||||||
|
3 files changed, 36 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
|
||||||
|
index d4f1d417..d21578e2 100644
|
||||||
|
--- a/src/gnome-cmd-file-list.cc
|
||||||
|
+++ b/src/gnome-cmd-file-list.cc
|
||||||
|
@@ -808,28 +808,45 @@ static char *build_selected_file_list (GnomeCmdFileList *fl, int *file_list_len)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-static void show_file_popup (GnomeCmdFileList *fl, GdkEventButton *event)
|
||||||
|
+static void get_popup_pos (GtkMenu *menu, gint *x, gint *y, gboolean push_in, GnomeCmdFileList *gnomeCmdFileList)
|
||||||
|
{
|
||||||
|
- // create the popup menu
|
||||||
|
- GtkWidget *menu = gnome_cmd_file_popmenu_new (fl);
|
||||||
|
- if (!menu) return;
|
||||||
|
+ g_return_if_fail (GNOME_CMD_IS_FILE_LIST (gnomeCmdFileList));
|
||||||
|
|
||||||
|
- g_object_ref (menu);
|
||||||
|
- g_object_set_data_full (*fl, "file_popup_menu", menu, g_object_unref);
|
||||||
|
+ gint w, h;
|
||||||
|
|
||||||
|
- gtk_menu_popup (GTK_MENU (menu), nullptr, nullptr, nullptr, fl, event->button, event->time);
|
||||||
|
+ get_focus_row_coordinates (gnomeCmdFileList, *x, *y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-inline void show_file_popup_with_warp (GnomeCmdFileList *fl)
|
||||||
|
+static void show_file_popup (GnomeCmdFileList *fl, GdkEventButton *event)
|
||||||
|
{
|
||||||
|
- gint x, y, w, h;
|
||||||
|
-
|
||||||
|
- get_focus_row_coordinates (fl, x, y, w, h);
|
||||||
|
+ // create the popup menu
|
||||||
|
+ GtkWidget *menu = gnome_cmd_file_popmenu_new (fl);
|
||||||
|
+ if (!menu) return;
|
||||||
|
|
||||||
|
- //FIXME: Warp the pointer to x, y here
|
||||||
|
+ g_object_ref (menu);
|
||||||
|
+ g_object_set_data_full (*fl, "file_popup_menu", menu, g_object_unref);
|
||||||
|
|
||||||
|
- show_file_popup (fl, nullptr);
|
||||||
|
+ if (event)
|
||||||
|
+ {
|
||||||
|
+ gtk_menu_popup (GTK_MENU (menu),
|
||||||
|
+ nullptr,
|
||||||
|
+ nullptr,
|
||||||
|
+ nullptr,
|
||||||
|
+ fl,
|
||||||
|
+ event->button,
|
||||||
|
+ event->time);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ gtk_menu_popup (GTK_MENU (menu),
|
||||||
|
+ nullptr,
|
||||||
|
+ nullptr,
|
||||||
|
+ (GtkMenuPositionFunc) get_popup_pos,
|
||||||
|
+ fl,
|
||||||
|
+ 0,
|
||||||
|
+ gtk_get_current_event_time ());
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2480,7 +2497,7 @@ gboolean GnomeCmdFileList::key_pressed(GdkEventKey *event)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case GDK_F10:
|
||||||
|
- show_file_popup_with_warp (this);
|
||||||
|
+ show_file_popup (this, nullptr);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case GDK_Left:
|
||||||
|
@@ -2662,7 +2679,7 @@ gboolean GnomeCmdFileList::key_pressed(GdkEventKey *event)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case GDK_Menu:
|
||||||
|
- show_file_popup_with_warp (this);
|
||||||
|
+ show_file_popup (this, nullptr);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
Loading…
Reference in new issue