Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gtk_menu_popup_at_pointer for GTK 3.22+ in FmFolderView #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/gtk/fm-folder-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ static void on_file_prop(GtkAction* act, FmFolderView* fv)
}
}

#if !GTK_CHECK_VERSION(3, 22, 0)
static void popup_position_func(GtkMenu *menu, gint *x, gint *y,
gboolean *push_in, gpointer user_data)
{
Expand Down Expand Up @@ -1161,6 +1162,7 @@ static void popup_position_func(GtkMenu *menu, gint *x, gint *y,
else
*y = MAX(mr.y, *y); /* place menu below cursor */
}
#endif

static void on_menu(GtkAction* act, FmFolderView* fv)
{
Expand Down Expand Up @@ -1283,8 +1285,12 @@ static void on_menu(GtkAction* act, FmFolderView* fv)

/* open popup */
gtk_ui_manager_ensure_update(ui);
#if GTK_CHECK_VERSION(3, 22, 0)
gtk_menu_popup_at_pointer(popup, NULL);
#else
gtk_menu_popup(popup, NULL, NULL, popup_position_func, fv, 3,
gtk_get_current_event_time());
#endif
}

/* handle 'Menu' and 'Shift+F10' here */
Expand Down Expand Up @@ -1397,8 +1403,12 @@ static void on_file_menu(GtkAction* act, FmFolderView* fv)
iface->get_custom_menu_callbacks(fv, &update_popup, &open_folders);
popup = _make_file_menu(fv, win, update_popup, open_folders, files);
fm_file_info_list_unref(files);
#if GTK_CHECK_VERSION(3, 22, 0)
gtk_menu_popup_at_pointer(popup, NULL);
#else
gtk_menu_popup(popup, NULL, NULL, popup_position_func, fv, 3,
gtk_get_current_event_time());
#endif
}
}

Expand Down Expand Up @@ -1777,8 +1787,12 @@ void fm_folder_view_item_clicked(FmFolderView* fv, GtkTreePath* path,
files = iface->dup_selected_files(fv);
popup = _make_file_menu(fv, win, update_popup, open_folders, files);
fm_file_info_list_unref(files);
#if GTK_CHECK_VERSION(3, 22, 0)
gtk_menu_popup_at_pointer(popup, NULL);
#else
gtk_menu_popup(popup, NULL, NULL, popup_position_func, fv, 3,
gtk_get_current_event_time());
#endif
}
else /* no files are selected. Show context menu of current folder. */
on_menu(NULL, fv);
Expand Down