Bug 1775116 - Use last mouse press event to trigger native menus. r=stransky

Otherwise (sometimes?) Mutter sends us an "Esc" key event on button
release (why tho?) which causes Gtk to hide the widget.

This is ironically trivial to fix after the drag service fix.

Differential Revision: https://phabricator.services.mozilla.com/D149871
This commit is contained in:
Emilio Cobos Álvarez 2022-06-21 10:56:44 +00:00
Родитель 4e346fe941
Коммит b7f4cda7be
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -7,6 +7,7 @@
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/dom/XULCommandEvent.h"
#include "mozilla/WidgetUtilsGtk.h"
#include "mozilla/EventDispatcher.h"
#include "nsPresContext.h"
#include "nsIWidget.h"
@ -380,7 +381,7 @@ void NativeMenuGtk::ShowAsContextMenu(nsPresContext* aPc,
const GdkRectangle rect = {gdkPos.x, gdkPos.y, 1, 1};
auto openFn = GetPopupAtRectFn();
openFn(GTK_MENU(mNativeMenu.get()), win, &rect, GDK_GRAVITY_NORTH_WEST,
GDK_GRAVITY_NORTH_WEST, nullptr);
GDK_GRAVITY_NORTH_WEST, GetLastMousePressEvent());
RefPtr pin{this};
FireEvent(eXULPopupShown);