There is no way to fix this as long as X11 is still being used. Lock screen timing issues are usually caused by a few different things:
1- Hardware issues. Certain models of computers have known issues where they don't generate the proper events when the laptop lid is closed or the suspend hotkey is pressed. In those cases, the laptop will enter the suspend state before notifying the OS, which results in the screen not being locked when the laptop wakes up. These issues need to be addressed with a firmware update, or with a quirk being added to whatever platform specific driver is in the kernel. This is the type of thing that is tested and fixed when a laptop gets certified and preloaded with Ubuntu. 2- Actual bugs in the screen locking code. This has happened in the past, and still occurs occasionally. 3- X11 not allowing the screen lock to forcibly remove keyboard and mouse grabs. This is the major reason why screen locking will never work reliably as long as we haven't switched to Wayland or Mir. For the screen to lock, it must be able to exclusively grab the keyboard or mouse. Unfortunately, there is no way under X11 to forcibly remove a keyboard or mouse grab that belongs to another application. When this happens, for example when you have a menu open, or you're using software such as Virtalbox, the screen is unable to lock before the laptop goes into suspend mode. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gnome-screensaver in Ubuntu. https://bugs.launchpad.net/bugs/1280300 Title: Desktop contents displayed on resume, before lock screen is shown To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/1280300/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs