diff --git a/gb.gtk/src/CWidget.cpp b/gb.gtk/src/CWidget.cpp index b58b06357..98116dd6e 100644 --- a/gb.gtk/src/CWidget.cpp +++ b/gb.gtk/src/CWidget.cpp @@ -190,8 +190,9 @@ bool gb_raise_MouseEvent(gControl *sender, int type) { if (GB.CanRaise(ob, EVENT_Menu)) { - GB.Raise(ob, EVENT_Menu, 0); - return true; + int old = gMenu::popupCount(); + if (GB.Raise(ob, EVENT_Menu, 0) || old != gMenu::popupCount()) + return true; } if (ob->popup) diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index d52d63393..74e83cc99 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -580,7 +580,10 @@ __FOUND_WIDGET: while (control) { if (control->onMouseEvent(control, gEvent_MouseMenu)) + { + cancel = true; break; + } control = control->_proxy_for; } } diff --git a/gb.gtk/src/gmenu.cpp b/gb.gtk/src/gmenu.cpp index 50245b298..d87b5488b 100644 --- a/gb.gtk/src/gmenu.cpp +++ b/gb.gtk/src/gmenu.cpp @@ -36,6 +36,7 @@ typedef gMenu *gMenu::_current_popup = NULL; int gMenu::_in_popup = 0; +int gMenu::_popup_count = 0; static GList *menus = NULL; @@ -741,7 +742,8 @@ void gMenu::doPopup(bool move, int x, int y) _current_popup = this; _in_popup++; - + _popup_count++; + gtk_menu_popup(child, NULL, NULL, move ? (GtkMenuPositionFunc)position_menu : NULL, (gpointer)pos, 0, gApplication::lastEventTime()); #if GTK_CHECK_VERSION(2, 20, 0) diff --git a/gb.gtk/src/gmenu.h b/gb.gtk/src/gmenu.h index f3754b263..57c2d3686 100644 --- a/gb.gtk/src/gmenu.h +++ b/gb.gtk/src/gmenu.h @@ -42,6 +42,8 @@ public: static void updateColor(gMainWindow *win); static gMenu *findFromName(gMainWindow *win, const char *name); + static int popupCount() { return _popup_count; } + //"Properties" bool checked() const { return _checked; } bool toggle() const { return _toggle; } @@ -129,6 +131,7 @@ private: static gMenu *_current_popup; static int _in_popup; + static int _popup_count; void doPopup(bool move, int x = 0, int y = 0); void update(); diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index ecdc5d8b1..dad628422 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -2498,15 +2498,14 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) //qDebug("Menu event! %p %d", control, EVENT_Menu); if (GB.CanRaise(control, EVENT_Menu)) { - static int old = MENU_popup_count; + int old = MENU_popup_count; ((QContextMenuEvent *)event)->accept(); - GB.Raise(control, EVENT_Menu, 0); - if (MENU_popup_count != old) + if (GB.Raise(control, EVENT_Menu, 0) || MENU_popup_count != old) return true; - else - goto __NEXT; + //else + // goto __NEXT; } if (EXT(control) && EXT(control)->popup)