Check if gnome-screensaver is running before activating hot corners, fix bug #1084288.

This commit is contained in:
Jaap Broekhuizen 2012-11-30 16:09:46 +01:00
parent f6fe5814fc
commit 1bb0b4d156
3 changed files with 50 additions and 0 deletions

View File

@ -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

View File

@ -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 ()
{

View File

@ -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 <http://www.gnu.org/licenses/>.
//
using Meta;
namespace Gala.Services
{
[DBus (name = "org.gnome.ScreenSaver")]
public interface ScreenSaver : GLib.Object
{
public abstract bool GetActive () throws GLib.IOError;
}
}