diff --git a/src/events.c b/src/events.c
index 4b8f5b86d2f7292893dc0ec39d54a7a757642318..fe6f7f31e0ce5cf0dca463c9ebe14776bad00f55 100644
--- a/src/events.c
+++ b/src/events.c
@@ -542,7 +542,7 @@ handleKeyPress (DisplayInfo *display_info, XKeyEvent * ev)
         default:
             break;
     }
-    XAllowEvents (display_info->dpy, SyncKeyboard, ev->time);
+    XAllowEvents (display_info->dpy, SyncKeyboard, myDisplayGetCurrentTime (display_info));
 }
 
 /* User has clicked on an edge or corner.
@@ -986,11 +986,11 @@ handleButtonPress (DisplayInfo *display_info, XButtonEvent * ev)
 
         if (replay)
         {
-            XAllowEvents (display_info->dpy, ReplayPointer, ev->time);
+            XAllowEvents (display_info->dpy, ReplayPointer, myDisplayGetCurrentTime (display_info));
         }
         else
         {
-            XAllowEvents (display_info->dpy, SyncPointer, ev->time);
+            XAllowEvents (display_info->dpy, SyncPointer, myDisplayGetCurrentTime (display_info));
         }
 
         return;