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
This commit is contained in:
Caolán McNamara
2016-12-06 21:03:07 +00:00
parent 6ce819eefe
commit adfcd16220
3 changed files with 8 additions and 1 deletions

View File

@@ -546,6 +546,7 @@ public:
guint* pGdkKeyCode, GdkModifierType *pGdkModifiers); guint* pGdkKeyCode, GdkModifierType *pGdkModifiers);
static guint32 GetLastInputEventTime(); static guint32 GetLastInputEventTime();
static void UpdateLastInputEventTime(guint32 nUserInputTime);
}; };
#define OOO_TYPE_FIXED ooo_fixed_get_type() #define OOO_TYPE_FIXED ooo_fixed_get_type()

View File

@@ -750,6 +750,7 @@ bool GtkSalMenu::TakeFocus()
static void MenuBarReturnFocus(GtkMenuShell*, gpointer menu) static void MenuBarReturnFocus(GtkMenuShell*, gpointer menu)
{ {
GtkSalFrame::UpdateLastInputEventTime(gtk_get_current_event_time());
GtkSalMenu* pMenu = static_cast<GtkSalMenu*>(menu); GtkSalMenu* pMenu = static_cast<GtkSalMenu*>(menu);
pMenu->ReturnFocus(); pMenu->ReturnFocus();
} }

View File

@@ -2040,8 +2040,13 @@ guint32 GtkSalFrame::GetLastInputEventTime()
return nLastUserInputTime; 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; nLastUserInputTime = nUserInputTime;
} }