From 36f1ab168fa33372377807087bdfff320bae92b6 Mon Sep 17 00:00:00 2001 From: gambas Date: Tue, 22 Jun 2021 21:41:03 +0200 Subject: [PATCH] Popup menus should not sometimes close immediately anymore when the mouse button is released. [GB.GTK3] * BUG: Popup menus should not sometimes close immediately anymore when the mouse button is released. --- gb.gtk/src/gmenu.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/gb.gtk/src/gmenu.cpp b/gb.gtk/src/gmenu.cpp index aed63a8bd..a160ae5f6 100644 --- a/gb.gtk/src/gmenu.cpp +++ b/gb.gtk/src/gmenu.cpp @@ -861,19 +861,14 @@ void gMenu::doPopup(bool move, int x, int y) GdkWindow *win; GdkRectangle rect; GdkEvent *event; - bool free = false; gt_disable_warnings(true); - event = gApplication::lastEvent(); - if (!event) - { - event = gdk_event_new(GDK_BUTTON_PRESS); - event->button.time = GDK_CURRENT_TIME; - event->button.window = gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(menu))); - gdk_event_set_device(event, gMouse::getPointer()); - free = true; - } + event = gdk_event_new(GDK_BUTTON_PRESS); + event->button.time = gApplication::lastEventTime(); //GDK_CURRENT_TIME; + event->button.button = 1; + event->button.window = gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(menu))); + gdk_event_set_device(event, gMouse::getPointer()); if (move) { @@ -893,11 +888,8 @@ void gMenu::doPopup(bool move, int x, int y) gt_disable_warnings(false); - if (free) - { - event->button.window = NULL; - gdk_event_free(event); - } + event->button.window = NULL; + gdk_event_free(event); #else