[Xfce4-commits] [xfce/thunar] 01/01: Fix popup menus size (Bug #15832)
noreply at xfce.org
noreply at xfce.org
Sun Aug 25 23:42:43 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/thunar.
commit 88f5f5ca03fc3bc88291eabf1097edd17bef6ce0
Author: Andre Miranda <andreldm at xfce.org>
Date: Sun Aug 25 16:16:50 2019 -0300
Fix popup menus size (Bug #15832)
This is the same workaround used by Nemo:
https://github.com/linuxmint/nemo/commit/ff08b987b8630f690bfebb6b0b7a931e519079d7
---
thunar/thunar-gtk-extensions.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/thunar/thunar-gtk-extensions.c b/thunar/thunar-gtk-extensions.c
index dd349a3..f2a0c22 100644
--- a/thunar/thunar-gtk-extensions.c
+++ b/thunar/thunar-gtk-extensions.c
@@ -143,6 +143,33 @@ thunar_gtk_menu_run (GtkMenu *menu)
+#if GTK_CHECK_VERSION (3, 24, 8)
+static void
+moved_to_rect_cb (GdkWindow *window,
+ const GdkRectangle *flipped_rect,
+ const GdkRectangle *final_rect,
+ gboolean flipped_x,
+ gboolean flipped_y,
+ GtkMenu *menu)
+{
+ g_signal_emit_by_name (menu, "popped-up", 0, flipped_rect, final_rect, flipped_x, flipped_y);
+ g_signal_stop_emission_by_name (window, "moved-to-rect");
+}
+
+
+
+static void
+popup_menu_realized (GtkWidget *menu,
+ gpointer user_data)
+{
+ GdkWindow *toplevel = gtk_widget_get_window (gtk_widget_get_toplevel (menu));
+ g_signal_handlers_disconnect_by_func (toplevel, moved_to_rect_cb, menu);
+ g_signal_connect (toplevel, "moved-to-rect", G_CALLBACK (moved_to_rect_cb), menu);
+}
+#endif
+
+
+
/**
* thunar_gtk_menu_run_at_event:
* @menu : a #GtkMenu.
@@ -157,7 +184,8 @@ thunar_gtk_menu_run (GtkMenu *menu)
*
**/
void
-thunar_gtk_menu_run_at_event (GtkMenu *menu, GdkEvent *event)
+thunar_gtk_menu_run_at_event (GtkMenu *menu,
+ GdkEvent *event)
{
GMainLoop *loop;
gulong signal_id;
@@ -170,6 +198,13 @@ thunar_gtk_menu_run_at_event (GtkMenu *menu, GdkEvent *event)
/* run an internal main loop */
loop = g_main_loop_new (NULL, FALSE);
signal_id = g_signal_connect_swapped (G_OBJECT (menu), "deactivate", G_CALLBACK (g_main_loop_quit), loop);
+
+#if GTK_CHECK_VERSION (3, 24, 8)
+ /* Workaround for incorrect popup menus size */
+ g_signal_connect (G_OBJECT (menu), "realize", G_CALLBACK (popup_menu_realized), NULL);
+ gtk_widget_realize (GTK_WIDGET (menu));
+#endif
+
gtk_menu_popup_at_pointer (menu, event);
gtk_menu_reposition (menu);
gtk_grab_add (GTK_WIDGET (menu));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list