HowScreenLockingWorks

Differences between revisions 3 and 4
Revision 3 as of 2010-01-07 14:50:36
Size: 3872
Editor: modemcable144
Comment:
Revision 4 as of 2010-01-08 14:56:03
Size: 5814
Editor: modemcable144
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:

** This page is a work in progress **
Line 59: Line 57:
xdg-screensaver is part of the xdg-utils package and is a command-line tool for controlling the screensaver in a desktop environment-independent way. When running under a GNOME desktop, it acts as a wrapper around the gnome-screensaver-command utility.
Line 60: Line 60:

gnome-panel has an applet called "Lock Screen" that enables a user to lock the screen by clicking on it. When the applet is clicked, gnome-panel performs the following actions:

 * Checks if gnome-screensaver-command is available, or else falls back to xscreensaver-command
 * Calls the appropriate command with the "--lock" parameter

(Ref.: gnome-panel/panel-util.c in gnome-panel)
Line 63: Line 70:
To be completed. Prior to Karmic, applications that wished to temporarily suspend the screensaver from coming up could periodically send the "poke" command to gnome-screensaver, either using the DBus API, or with the gnome-screensaver-command tool. This would cause gnome-screensaver to reset the idle counter, preventing it from reaching the preset value.

Beginning with Karmic, the proper way to suspend the screensaver is to use the gnome-screensaver DBus API "Inhibit" method. (Ref.: [[http://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions#I.27m_developing_an_application_that_has_a_fullscreen_mode.__Is_there_a_way_that_I_can_disable_the_screensaver.3F|gnome-screensaver FAQ]])

Unfortunately, many applications such as VLC, Mplayer and xdg-screensaver still use the "poke" command, which was deprecated and disabled in the current gnome-screensaver codebase. See the following bugs for more information:

 * https://bugzilla.gnome.org/show_bug.cgi?id=579430
 * https://bugs.edge.launchpad.net/gnome-screensaver/+bug/428884

An update for gnome-screensaver was released for Karmic to re-enable the "poke" command until applications have been converted to the new API. (Ref.: [[https://www.launchpad.net/ubuntu/karmic/+source/gnome-screensaver/2.28.0-0ubuntu3.2|gnome-screensaver 2.28.0-0ubuntu3.2]])
Line 67: Line 84:
To be completed. (This section needs to be completed.)
Line 71: Line 88:
To be completed. (This section needs to be completed.)

Debugging Central

This page is part of the debugging series — pages with debugging details for a variety of Ubuntu packages.

Introduction

Screen locking is a complex combination of many different packages, applications, and tools. Different desktop environments, such as Gnome and KDE, do not lock the screen using the same applications. This wiki page documents the screen locking process for each desktop environment.

Gnome (Ubuntu)

Software

gnome-screensaver

gnome-screensaver is the main application that starts the screensaver, and displays the locked screen authentication dialog. It has an application to set preferences, and has a DBus interface. It also comes with a command-line tool called "gnome-screensaver-command" that can be used to control gnome-screensaver.

gnome-screensaver supports native "themes" and xscreensaver "hacks".

The screensaver can be activated in one of the following ways: with an idle timeout, or from being manually triggered by the user.

Beginning with Karmic, gnome-screensaver relies on gnome-session's idle signal, instead of using it's own idle watcher. (Ref.: https://bugzilla.gnome.org/show_bug.cgi?id=567919)

GNOME Power Manager

GNOME Power Manager is a session daemon that manages, among other things, automatically blanking the screen or suspending the computer after a timeout, or when the battery is low.

The screen blanking is unrelated to gnome-screensaver, and uses DPMS to actually turn the screen off. It uses a different idle timeout than the one set for the screensaver.

When GNOME Power Manager wants to put the computer into a suspend state, it performs the following steps:

  • Locks the GNOME Keyring
  • Using DBus, sends a "lock screen" signal to gnome-screensaver
  • Waits to get confirmation from gnome-screensaver that the screen is locked (with a 5 second timeout)
  • Tells DeviceKit-Power to suspend the hardware (prior to Karmic, HAL was used)

GNOME Power Manager waits for confirmation from gnome-screensaver before triggering the suspend so the hardware doesn't suspend while gnome-screensaver is fading the screen. If that happens, when the machine is resumed, the desktop will be visible for a couple of seconds before the lock screen authentication dialog appears.

Unfortunately, if gnome-screensaver is not running, or if it doesn't respond in 5 seconds, GNOME Power Manager will suspend anyway. This may result in bug reports about the desktop being visible after resume, or bug reports about resume not coming up with a locked screen.

(Ref.: src/gpm-control.c and src/gpm-screensaver.c in gnome-power-manager)

The Session Menu

indicator-applet-session is the GNOME panel applet that provides status changing, user choosing and session management. It can be used to lock the screen, or to suspend/hibernate the computer. It is a front-end to indicator-session.

When a user selects "Lock Screen" from the applet, indicator-session sends a "Lock" message to gnome-screensaver via DBus.

When a user selects "Suspend" from the applet, indicator-session does the following:

  • Using DBus, sends a "lock screen" signal to gnome-screensaver
  • Waits for 1 second
  • Tells DeviceKit-Power to suspend the hardware

(Ref.: src/session-service.c and src/lock-helper.c in indicator-session)

xdg-screensaver

xdg-screensaver is part of the xdg-utils package and is a command-line tool for controlling the screensaver in a desktop environment-independent way. When running under a GNOME desktop, it acts as a wrapper around the gnome-screensaver-command utility.

"Lock Screen" gnome-panel applet

gnome-panel has an applet called "Lock Screen" that enables a user to lock the screen by clicking on it. When the applet is clicked, gnome-panel performs the following actions:

  • Checks if gnome-screensaver-command is available, or else falls back to xscreensaver-command
  • Calls the appropriate command with the "--lock" parameter

(Ref.: gnome-panel/panel-util.c in gnome-panel)

Screensaver Inhibiting

Prior to Karmic, applications that wished to temporarily suspend the screensaver from coming up could periodically send the "poke" command to gnome-screensaver, either using the DBus API, or with the gnome-screensaver-command tool. This would cause gnome-screensaver to reset the idle counter, preventing it from reaching the preset value.

Beginning with Karmic, the proper way to suspend the screensaver is to use the gnome-screensaver DBus API "Inhibit" method. (Ref.: gnome-screensaver FAQ)

Unfortunately, many applications such as VLC, Mplayer and xdg-screensaver still use the "poke" command, which was deprecated and disabled in the current gnome-screensaver codebase. See the following bugs for more information:

An update for gnome-screensaver was released for Karmic to re-enable the "poke" command until applications have been converted to the new API. (Ref.: gnome-screensaver 2.28.0-0ubuntu3.2)

KDE (Kubuntu)

(This section needs to be completed.)

XFCE (Xubuntu, Mythbuntu)

(This section needs to be completed.)


CategoryBugSquad CategoryDebugging

DebuggingScreenLocking/HowScreenLockingWorks (last edited 2018-03-02 19:01:24 by nathanst)