From 1bb0b4d1562dd45fde80e882936acc64e6096449 Mon Sep 17 00:00:00 2001 From: Jaap Broekhuizen Date: Fri, 30 Nov 2012 16:09:46 +0100 Subject: [PATCH 1/2] Check if gnome-screensaver is running before activating hot corners, fix bug #1084288. --- CMakeLists.txt | 1 + src/Plugin.vala | 20 ++++++++++++++++++++ src/Services/ScreenSaver.vala | 29 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/Services/ScreenSaver.vala diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e636646..7502e58a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ vala_precompile(VALA_C src/Widgets/WindowThumb.vala src/Widgets/WorkspaceThumb.vala src/Widgets/WorkspaceView.vala + src/Services/ScreenSaver.vala ${CMAKE_BINARY_DIR}/src/Config.vala PACKAGES granite diff --git a/src/Plugin.vala b/src/Plugin.vala index 3dddf183..e5f95d64 100644 --- a/src/Plugin.vala +++ b/src/Plugin.vala @@ -43,6 +43,8 @@ namespace Gala WorkspaceView workspace_view; Zooming zooming; WindowOverview window_overview; + + Gala.Services.ScreenSaver screensaver; Window? moving; //place for the window that is being moved over @@ -192,6 +194,9 @@ namespace Gala stage.add_child (hot_corner); hot_corner.enter_event.connect (() => { + if (screensaver_active ()) + return false; + perform_action ((ActionType)BehaviorSettings.get_default ().schema.get_enum (key)); return false; }); @@ -200,6 +205,21 @@ namespace Gala hot_corner.x = x; hot_corner.y = y; } + + bool screensaver_active () + { + if (screensaver == null) { + try { + screensaver = Bus.get_proxy_sync (BusType.SESSION, + "org.gnome.ScreenSaver", + "/org/gnome/ScreenSaver"); + } catch (GLib.IOError error) { + return false; + } + } + + return screensaver.GetActive (); + } public void update_input_area () { diff --git a/src/Services/ScreenSaver.vala b/src/Services/ScreenSaver.vala new file mode 100644 index 00000000..2f2638d7 --- /dev/null +++ b/src/Services/ScreenSaver.vala @@ -0,0 +1,29 @@ +// +// Copyright (C) 2012 Jaap Broekhuizen +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +using Meta; + +namespace Gala.Services +{ + + [DBus (name = "org.gnome.ScreenSaver")] + public interface ScreenSaver : GLib.Object + { + public abstract bool GetActive () throws GLib.IOError; + } + +} \ No newline at end of file From b84141a074b5a196c0ff2c30a0a09bdad75a58d3 Mon Sep 17 00:00:00 2001 From: Jaap Broekhuizen Date: Fri, 30 Nov 2012 16:14:50 +0100 Subject: [PATCH 2/2] Remove Meta using statement from ScreenSaver.vala. --- src/Services/ScreenSaver.vala | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Services/ScreenSaver.vala b/src/Services/ScreenSaver.vala index 2f2638d7..209b2813 100644 --- a/src/Services/ScreenSaver.vala +++ b/src/Services/ScreenSaver.vala @@ -15,8 +15,6 @@ // along with this program. If not, see . // -using Meta; - namespace Gala.Services {