diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 8f387dc..a93aa50 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -824,8 +824,8 @@ void DesktopWindow::ungrabKeyboard()
serial = XNextRequest(fl_display);
- XUngrabPointer(fl_display, fl_event_time);
- XUngrabKeyboard(fl_display, fl_event_time);
+ XUngrabPointer(fl_display, CurrentTime);
+ XUngrabKeyboard(fl_display, CurrentTime);
// See grabKeyboard()
XSync(fl_display, False);