[gtk/gbsneto/filechooser-column-view: 100/105] filechooser: Some work on popup menus
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gbsneto/filechooser-column-view: 100/105] filechooser: Some work on popup menus
- Date: Wed, 12 Oct 2022 20:42:38 +0000 (UTC)
commit ede3dbb392000992d2f5aec79b5886e218fc66b1
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 12 00:24:15 2022 -0400
filechooser: Some work on popup menus
This is a start towards placing menus properly.
We once again center keyboard-triggered menus
on the file list.
gtk/gtkfilechooserwidget.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index e9170c7da7..e7b6f39b49 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -1856,17 +1856,11 @@ file_list_show_popover (GtkFileChooserWidget *impl,
double y)
{
GdkRectangle rect;
- graphene_rect_t bounds;
-
- if (!gtk_widget_compute_bounds (impl->browse_files_column_view,
- impl->browse_files_column_view,
- &bounds))
- return;
file_list_update_popover (impl);
/* TODO: figure out popover position */
- rect = (GdkRectangle) { 0, 0, 0, 0 };
+ rect = (GdkRectangle) { (int) x, (int) y, 1, 1 };
gtk_popover_set_pointing_to (GTK_POPOVER (impl->browse_files_popover), &rect);
gtk_popover_popup (GTK_POPOVER (impl->browse_files_popover));
@@ -1880,15 +1874,16 @@ list_popup_menu_cb (GtkWidget *widget,
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (user_data);
graphene_rect_t bounds;
- if (gtk_widget_compute_bounds (impl->browse_files_column_view,
- impl->browse_files_column_view,
- &bounds))
- {
- file_list_show_popover (impl, 0.5 * bounds.size.width, 0.5 * bounds.size.height);
- return TRUE;
- }
+ if (!gtk_widget_compute_bounds (impl->browse_files_column_view,
+ GTK_WIDGET (impl),
+ &bounds))
+ return FALSE;
- return FALSE;
+ file_list_show_popover (impl,
+ bounds.origin.x + bounds.size.width / 2,
+ bounds.origin.y + bounds.size.height / 2);
+
+ return TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]