Use gdk_event_triggers_context_menu()
This commit is contained in:
parent
6f83d1dceb
commit
5bae7c1bd2
@ -1085,11 +1085,18 @@ fiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
|||||||
gtk_widget_get_focus_on_click(widget))
|
gtk_widget_get_focus_on_click(widget))
|
||||||
gtk_widget_grab_focus(widget);
|
gtk_widget_grab_focus(widget);
|
||||||
|
|
||||||
|
// In accordance with Nautilus, Thunar, and the mildly confusing
|
||||||
|
// Apple Human Interface Guidelines, but not with the ugly Windows User
|
||||||
|
// Experience Interaction Guidelines, open the context menu on button press.
|
||||||
|
// (Originally our own behaviour, but the GDK3 function also does this.)
|
||||||
|
gboolean triggers_menu =
|
||||||
|
gdk_event_triggers_context_menu((const GdkEvent *) event);
|
||||||
|
|
||||||
const Entry *entry = entry_at(self, event->x, event->y);
|
const Entry *entry = entry_at(self, event->x, event->y);
|
||||||
if (!entry && state == 0) {
|
if (!entry) {
|
||||||
if (event->button == GDK_BUTTON_SECONDARY)
|
if (triggers_menu)
|
||||||
show_context_menu(widget, fiv_io_model_get_location(self->model));
|
show_context_menu(widget, fiv_io_model_get_location(self->model));
|
||||||
else if (event->button != GDK_BUTTON_PRIMARY)
|
else if (state || event->button != GDK_BUTTON_PRIMARY)
|
||||||
return GDK_EVENT_PROPAGATE;
|
return GDK_EVENT_PROPAGATE;
|
||||||
|
|
||||||
if (self->selected) {
|
if (self->selected) {
|
||||||
@ -1099,10 +1106,7 @@ fiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
|||||||
return GDK_EVENT_STOP;
|
return GDK_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In accordance with Nautilus, Thunar, and the mildly confusing
|
if (entry && triggers_menu) {
|
||||||
// Apple Human Interface Guidelines, but not with the ugly Windows User
|
|
||||||
// Experience Interaction Guidelines, open the context menu on button press.
|
|
||||||
if (entry && event->button == GDK_BUTTON_SECONDARY) {
|
|
||||||
self->selected = entry;
|
self->selected = entry;
|
||||||
gtk_widget_queue_draw(widget);
|
gtk_widget_queue_draw(widget);
|
||||||
|
|
||||||
|
@ -196,14 +196,13 @@ static gboolean
|
|||||||
on_breadcrumb_button_press(GtkWidget *widget, GdkEventButton *event,
|
on_breadcrumb_button_press(GtkWidget *widget, GdkEventButton *event,
|
||||||
G_GNUC_UNUSED gpointer user_data)
|
G_GNUC_UNUSED gpointer user_data)
|
||||||
{
|
{
|
||||||
if (event->type != GDK_BUTTON_PRESS ||
|
if (!gdk_event_triggers_context_menu((const GdkEvent *) event))
|
||||||
event->button != GDK_BUTTON_SECONDARY)
|
return GDK_EVENT_PROPAGATE;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
GFile *location =
|
GFile *location =
|
||||||
g_object_get_qdata(G_OBJECT(widget), fiv_sidebar_location_quark());
|
g_object_get_qdata(G_OBJECT(widget), fiv_sidebar_location_quark());
|
||||||
gtk_menu_popup_at_pointer(fiv_context_menu_new(widget, location), NULL);
|
gtk_menu_popup_at_pointer(fiv_context_menu_new(widget, location), NULL);
|
||||||
return TRUE;
|
return GDK_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user