forked from pool/lxsession
Accepting request 42889 from home:gberh:branches:X11:lxde
Copy from home:gberh:branches:X11:lxde/lxsession via accept of submit request 42889 revision 2. Request was accepted with message: OK OBS-URL: https://build.opensuse.org/request/show/42889 OBS-URL: https://build.opensuse.org/package/show/X11:lxde/lxsession?expand=0&rev=28
This commit is contained in:
parent
dc73a06d42
commit
69a7364391
99
lxsession-0.4.4-lock-screen.patch
Normal file
99
lxsession-0.4.4-lock-screen.patch
Normal file
@ -0,0 +1,99 @@
|
||||
diff -urN lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c lxsession-0.4.4/lxsession-logout/lxsession-logout.c
|
||||
--- lxsession-0.4.4.orig/lxsession-logout/lxsession-logout.c 2010-03-31 18:28:50.000000000 +0200
|
||||
+++ lxsession-0.4.4/lxsession-logout/lxsession-logout.c 2010-07-14 00:10:28.000000000 +0200
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
@@ -72,6 +73,7 @@
|
||||
int ltsp : 1; /* under LTSP environment */
|
||||
} HandlerContext;
|
||||
|
||||
+static gboolean lock_screen(void);
|
||||
static gboolean verify_running(char * display_manager, char * executable);
|
||||
static void logout_clicked(GtkButton * button, HandlerContext * handler_context);
|
||||
static void shutdown_clicked(GtkButton * button, HandlerContext * handler_context);
|
||||
@@ -83,6 +85,52 @@
|
||||
static GtkPositionType get_banner_position(void);
|
||||
static GdkPixbuf * get_background_pixbuf(void);
|
||||
|
||||
+/* Try to lock the screen, return TRUE on success, FALSE if no suitable
|
||||
+ * screensaver was found or the screensaver command exited abnormally.
|
||||
+ */
|
||||
+static gboolean lock_screen(void)
|
||||
+{
|
||||
+ gchar *dummy;
|
||||
+ gint exit_status;
|
||||
+
|
||||
+ if ((dummy = g_find_program_in_path("xscreensaver-command")) != NULL)
|
||||
+ {
|
||||
+ g_spawn_command_line_sync("xscreensaver-command -lock",
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ &exit_status,
|
||||
+ NULL);
|
||||
+ }
|
||||
+ else if ((dummy = g_find_program_in_path("gnome-screensaver-command")) !=
|
||||
+ NULL)
|
||||
+ {
|
||||
+ g_spawn_command_line_sync("gnome-screensaver-command --lock",
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ &exit_status,
|
||||
+ NULL);
|
||||
+ }
|
||||
+ else if ((dummy = g_find_program_in_path("xlock")) != NULL)
|
||||
+ {
|
||||
+ g_spawn_command_line_sync("xlock -mode blank",
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ &exit_status,
|
||||
+ NULL);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ g_free(dummy);
|
||||
+
|
||||
+ if (WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == 0)
|
||||
+ return TRUE;
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
/* Verify that a program is running and that an executable is available. */
|
||||
static gboolean verify_running(char * display_manager, char * executable)
|
||||
{
|
||||
@@ -187,6 +235,8 @@
|
||||
/* Handler for "clicked" signal on Suspend button. */
|
||||
static void suspend_clicked(GtkButton * button, HandlerContext * handler_context)
|
||||
{
|
||||
+ lock_screen();
|
||||
+
|
||||
if (handler_context->suspend_DeviceKit)
|
||||
dbus_DeviceKit_Suspend();
|
||||
else if (handler_context->suspend_HAL)
|
||||
@@ -197,6 +247,8 @@
|
||||
/* Handler for "clicked" signal on Hibernate button. */
|
||||
static void hibernate_clicked(GtkButton * button, HandlerContext * handler_context)
|
||||
{
|
||||
+ lock_screen();
|
||||
+
|
||||
if (handler_context->hibernate_DeviceKit)
|
||||
dbus_DeviceKit_Hibernate();
|
||||
else if (handler_context->hibernate_HAL)
|
||||
@@ -207,6 +259,8 @@
|
||||
/* Handler for "clicked" signal on Switch User button. */
|
||||
static void switch_user_clicked(GtkButton * button, HandlerContext * handler_context)
|
||||
{
|
||||
+ lock_screen();
|
||||
+
|
||||
if (handler_context->switch_user_GDM)
|
||||
g_spawn_command_line_sync("gdmflexiserver --startnew", NULL, NULL, NULL, NULL);
|
||||
else if (handler_context->switch_user_KDM)
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 13 22:12:42 UTC 2010 - guido+opensuse.org@berhoerster.name
|
||||
|
||||
- lock screen when suspending/hibernating/switching users, fixes
|
||||
bnc#622083
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 7 14:18:10 UTC 2010 - andrea@opensuse.org
|
||||
|
||||
- changed RPM Group to System/GUI/LXDE
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 5 19:00:33 UTC 2010 - andrea@opensuse.org
|
||||
|
||||
|
@ -20,12 +20,15 @@
|
||||
|
||||
Name: lxsession
|
||||
Version: 0.4.4
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: LXDE Session Manager, required for running the desktop environment
|
||||
Group: System/GUI/Other
|
||||
Group: System/GUI/LXDE
|
||||
License: GPL
|
||||
Url: http://www.lxde.org/
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
# PATCH-FIX-UPSTREAM lxsession-0.4.4-lock-screen.patch bnc# guido+opensuse.org@berhoerster.name
|
||||
# lxsession-logout should lock the screen before suspending/hibernating/switching users, this fixes bnc#622083
|
||||
Patch0: %{name}-0.4.4-lock-screen.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: dbus-1-glib-devel fdupes gtk2-devel intltool pkg-config
|
||||
BuildRequires: docbook-utils docbook-xsl-stylesheets hal-devel libxslt
|
||||
@ -42,6 +45,7 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q -n %name-%version
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
|
Loading…
Reference in New Issue
Block a user