From adfcd16220444ef3ea318515c5a331210250e45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 6 Dec 2016 21:03:07 +0000 Subject: [PATCH] Resolves: rhbz#1401778 gtk3+wayland switching windows from the window woes ignore 0 timestamps cause they're useless and get the current event time stamp during MenuBarReturnFocus to determine the timestamp of the menu command dispatch Change-Id: Ia4b00aafc9ef47b41dcca2c160e943200db5c524 --- vcl/inc/unx/gtk/gtkframe.hxx | 1 + vcl/unx/gtk/gtksalmenu.cxx | 1 + vcl/unx/gtk3/gtk3gtkframe.cxx | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 5d61c5a57b06..e92932f39d90 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -546,6 +546,7 @@ public: guint* pGdkKeyCode, GdkModifierType *pGdkModifiers); static guint32 GetLastInputEventTime(); + static void UpdateLastInputEventTime(guint32 nUserInputTime); }; #define OOO_TYPE_FIXED ooo_fixed_get_type() diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index c5cbb542c591..2cf072a01d5d 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -750,6 +750,7 @@ bool GtkSalMenu::TakeFocus() static void MenuBarReturnFocus(GtkMenuShell*, gpointer menu) { + GtkSalFrame::UpdateLastInputEventTime(gtk_get_current_event_time()); GtkSalMenu* pMenu = static_cast(menu); pMenu->ReturnFocus(); } diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 8702c62031b0..e6e043777f83 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -2040,8 +2040,13 @@ guint32 GtkSalFrame::GetLastInputEventTime() return nLastUserInputTime; } -static void UpdateLastInputEventTime(guint32 nUserInputTime) +void GtkSalFrame::UpdateLastInputEventTime(guint32 nUserInputTime) { + //gtk3 can generate a synthetic crossing event with a useless 0 + //(GDK_CURRENT_TIME) timestamp on showing a menu from the main + //menubar, which is unhelpful, so ignore the 0 timestamps + if (nUserInputTime == GDK_CURRENT_TIME) + return; nLastUserInputTime = nUserInputTime; }