Skip to content

fix for no dialog after screenlock issue (#13)

This patch adds a test of whether the screen is locked by another application (e.g., light-locker) before attempting to show the time-out lock screen. If the screen appears to be locked, it activates an info dialog box message instead of attempting to lock the screen under the existing lock screen. The user will see the dialog when the system screen lock ends, and time-out-plugin proceeds as normal once the user closes the dialog.

This is to avoid the problems described in issue #13 (closed), which arises when time-out-plugin attempts to show its custom GTK_WINDOW_POPUP-based dialog when the screen is already locked and hidden by a system screen locker such as light-locker. If the popup is shown even once while the system screen locker is active, the widgets on the popup remain invisible thereafter. In addition, the keyboard cannot be grabbed while another screen locker has grabbed it, so this workaround avoids that issue too.

This way it tests whether the screen is locked is by attempting to make and show a temporary GTK_WINDOW_POPUP (which is how the time-out-plugin custom dialog is implemented) and then attempting to grab and release the keyboard. If it can do this, the time-out-screen-lock proceeds as normal. Only if it can't get the keyboard lock does it bring up the dialog box.

You might wonder why not poll until the other screen locker goes away. Since there are other clients that can grab the keyboard, I thought it was better to pop up a dialog letting the user know what is going on rather than having time-out-plugin mysteriously wait to lock.

Merge request reports