mirror of
https://github.com/elementary/gala.git
synced 2024-12-20 15:52:04 +03:00
plugin: disable input to stage when screen is locked
This is a slightly modified version of jaapz' branch trying to make the method more general by applying the lock in update_input_area. begin_modal will now set the the input area to FULLSCREEN, so set_input_area is no longer required to be called from the windowoverview or the workspaceview.
This commit is contained in:
commit
fec97f1469
@ -69,6 +69,7 @@ vala_precompile(VALA_C
|
|||||||
src/DragDropAction.vala
|
src/DragDropAction.vala
|
||||||
src/Main.vala
|
src/Main.vala
|
||||||
src/Plugin.vala
|
src/Plugin.vala
|
||||||
|
src/ScreenSaver.vala
|
||||||
src/Settings.vala
|
src/Settings.vala
|
||||||
src/TextShadowEffect.vala
|
src/TextShadowEffect.vala
|
||||||
src/Utils.vala
|
src/Utils.vala
|
||||||
|
@ -45,6 +45,8 @@ namespace Gala
|
|||||||
WorkspaceView workspace_view;
|
WorkspaceView workspace_view;
|
||||||
Zooming zooming;
|
Zooming zooming;
|
||||||
WindowOverview window_overview;
|
WindowOverview window_overview;
|
||||||
|
|
||||||
|
ScreenSaver? screensaver;
|
||||||
|
|
||||||
#if HAS_MUTTER38
|
#if HAS_MUTTER38
|
||||||
// FIXME we need a proper-sized background for every monitor
|
// FIXME we need a proper-sized background for every monitor
|
||||||
@ -87,6 +89,17 @@ namespace Gala
|
|||||||
|
|
||||||
DBus.init (this);
|
DBus.init (this);
|
||||||
|
|
||||||
|
// Due to a bug which enables access to the stage when using multiple monitors
|
||||||
|
// in the screensaver, we have to listen for changes and make sure the input area
|
||||||
|
// is set to NONE when we are in locked mode
|
||||||
|
try {
|
||||||
|
screensaver = Bus.get_proxy_sync (BusType.SESSION, "org.gnome.ScreenSaver",
|
||||||
|
"/org/gnome/ScreenSaver");
|
||||||
|
screensaver.active_changed.connect (() => {
|
||||||
|
update_input_area ();
|
||||||
|
});
|
||||||
|
} catch (Error e) { warning (e.message); }
|
||||||
|
|
||||||
var stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage;
|
var stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage;
|
||||||
|
|
||||||
string color = new Settings ("org.gnome.desktop.background").get_string ("primary-color");
|
string color = new Settings ("org.gnome.desktop.background").get_string ("primary-color");
|
||||||
@ -250,14 +263,22 @@ namespace Gala
|
|||||||
public void update_input_area ()
|
public void update_input_area ()
|
||||||
{
|
{
|
||||||
var schema = BehaviorSettings.get_default ().schema;
|
var schema = BehaviorSettings.get_default ().schema;
|
||||||
|
var screen = get_screen ();
|
||||||
|
|
||||||
if (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ||
|
if (screensaver != null && screensaver.get_active ()) {
|
||||||
|
Utils.set_input_area (screen, InputArea.NONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modal_count > 0)
|
||||||
|
Utils.set_input_area (screen, InputArea.FULLSCREEN);
|
||||||
|
else if (schema.get_enum ("hotcorner-topleft") != ActionType.NONE ||
|
||||||
schema.get_enum ("hotcorner-topright") != ActionType.NONE ||
|
schema.get_enum ("hotcorner-topright") != ActionType.NONE ||
|
||||||
schema.get_enum ("hotcorner-bottomleft") != ActionType.NONE ||
|
schema.get_enum ("hotcorner-bottomleft") != ActionType.NONE ||
|
||||||
schema.get_enum ("hotcorner-bottomright") != ActionType.NONE)
|
schema.get_enum ("hotcorner-bottomright") != ActionType.NONE)
|
||||||
Utils.set_input_area (get_screen (), InputArea.HOT_CORNER);
|
Utils.set_input_area (screen, InputArea.HOT_CORNER);
|
||||||
else
|
else
|
||||||
Utils.set_input_area (get_screen (), InputArea.NONE);
|
Utils.set_input_area (screen, InputArea.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint32[] get_all_xids ()
|
public uint32[] get_all_xids ()
|
||||||
@ -318,6 +339,7 @@ namespace Gala
|
|||||||
var screen = get_screen ();
|
var screen = get_screen ();
|
||||||
var display = screen.get_display ();
|
var display = screen.get_display ();
|
||||||
|
|
||||||
|
update_input_area ();
|
||||||
base.begin_modal (x_get_stage_window (Compositor.get_stage_for_screen (screen)), {}, 0, display.get_current_time ());
|
base.begin_modal (x_get_stage_window (Compositor.get_stage_for_screen (screen)), {}, 0, display.get_current_time ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,6 +349,7 @@ namespace Gala
|
|||||||
if (modal_count > 0)
|
if (modal_count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
update_input_area ();
|
||||||
base.end_modal (get_screen ().get_display ().get_current_time ());
|
base.end_modal (get_screen ().get_display ().get_current_time ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
27
src/ScreenSaver.vala
Normal file
27
src/ScreenSaver.vala
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// 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/>.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace Gala
|
||||||
|
{
|
||||||
|
[DBus (name = "org.gnome.ScreenSaver")]
|
||||||
|
public interface ScreenSaver : GLib.Object
|
||||||
|
{
|
||||||
|
public abstract bool get_active () throws GLib.IOError;
|
||||||
|
public signal void active_changed (bool active);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -581,7 +581,6 @@ namespace Gala
|
|||||||
grab_key_focus ();
|
grab_key_focus ();
|
||||||
|
|
||||||
plugin.begin_modal ();
|
plugin.begin_modal ();
|
||||||
Utils.set_input_area (screen, InputArea.FULLSCREEN);
|
|
||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
||||||
|
@ -388,7 +388,6 @@ namespace Gala
|
|||||||
visible = true;
|
visible = true;
|
||||||
grab_key_focus ();
|
grab_key_focus ();
|
||||||
|
|
||||||
Utils.set_input_area (screen, InputArea.FULLSCREEN);
|
|
||||||
plugin.begin_modal ();
|
plugin.begin_modal ();
|
||||||
|
|
||||||
var area = screen.get_monitor_geometry (screen.get_primary_monitor ());
|
var area = screen.get_monitor_geometry (screen.get_primary_monitor ());
|
||||||
|
Loading…
Reference in New Issue
Block a user