manager, listener-x11: Prevent session unlock bypass and trap transient X11 errors

This MR addresses two related issues that can leave the session unintentionally unlocked:

  1. Immediate Lock on Activation: When lock_timeout == 0 and lock_with_saver_enabled is set, gs-manager now synchronously enables manager->priv->lock_active = TRUE prior to window creation, and gs-listener-x11 emits the lock signal directly on ScreenSaverOn events. This eliminates race conditions where the screen saver is active but the lock state has not engaged.

  2. Trap Transient X11 BadWindow on Dialog Cancellation: When the authentication dialog times out after 60 seconds (or is cancelled), the dialog socket window is destroyed while seat pointer regrabbing operations occur. On X11, XIQueryPointer (request 131, minor 40) executed against the destroyed window produces an X11 BadWindow (code 3) error. By default, GDK's error handler calls abort(), terminating xfce4-screensaver and completely unlocking the user's desktop.

    This patch wraps seat grab movements with gdk_x11_display_error_trap_push/pop_ignored and installs a top-level X11 error handler (screensaver_x_error_handler) to trap transient BadWindow, BadMatch, and BadDrawable events, preventing crashes and keeping the screensaver securely running.

Signed-off-by: Kalpesh Solanki skalpesh942@gmail.com


Fixes: #204 (closed)

Edited by Gaël Bonithon

Merge request reports

Loading