mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 07:05:30 +03:00
Use one true brace style in src (#685)
This commit is contained in:
parent
abe5bcc8ae
commit
7a76ae3028
@ -275,8 +275,7 @@ namespace Gala {
|
|||||||
*
|
*
|
||||||
* @param display The display to flash, if necessary
|
* @param display The display to flash, if necessary
|
||||||
*/
|
*/
|
||||||
public static void bell (Meta.Display display)
|
public static void bell (Meta.Display display) {
|
||||||
{
|
|
||||||
if (Meta.Prefs.bell_is_audible ())
|
if (Meta.Prefs.bell_is_audible ())
|
||||||
Gdk.beep ();
|
Gdk.beep ();
|
||||||
else
|
else
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class Animation : Object {
|
||||||
public class Animation : Object
|
|
||||||
{
|
|
||||||
public string filename { get; construct; }
|
public string filename { get; construct; }
|
||||||
public string[] key_frame_files { get; private set; default = {}; }
|
public string[] key_frame_files { get; private set; default = {}; }
|
||||||
public double transition_progress { get; private set; default = 0.0; }
|
public double transition_progress { get; private set; default = 0.0; }
|
||||||
@ -27,13 +25,11 @@ namespace Gala
|
|||||||
|
|
||||||
Gnome.BGSlideShow? show = null;
|
Gnome.BGSlideShow? show = null;
|
||||||
|
|
||||||
public Animation (string filename)
|
public Animation (string filename) {
|
||||||
{
|
|
||||||
Object (filename: filename);
|
Object (filename: filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void load ()
|
public async void load () {
|
||||||
{
|
|
||||||
show = new Gnome.BGSlideShow (filename);
|
show = new Gnome.BGSlideShow (filename);
|
||||||
|
|
||||||
show.load_async (null, (obj, res) => {
|
show.load_async (null, (obj, res) => {
|
||||||
@ -45,8 +41,7 @@ namespace Gala
|
|||||||
yield;
|
yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update (Meta.Rectangle monitor)
|
public void update (Meta.Rectangle monitor) {
|
||||||
{
|
|
||||||
string[] key_frame_files = {};
|
string[] key_frame_files = {};
|
||||||
|
|
||||||
if (show == null)
|
if (show == null)
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class Background : Object {
|
||||||
public class Background : Object
|
|
||||||
{
|
|
||||||
const double ANIMATION_OPACITY_STEP_INCREMENT = 4.0;
|
const double ANIMATION_OPACITY_STEP_INCREMENT = 4.0;
|
||||||
const double ANIMATION_MIN_WAKEUP_INTERVAL = 1.0;
|
const double ANIMATION_MIN_WAKEUP_INTERVAL = 1.0;
|
||||||
|
|
||||||
@ -44,8 +42,7 @@ namespace Gala
|
|||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public Background (Meta.Display display, int monitor_index, string? filename,
|
public Background (Meta.Display display, int monitor_index, string? filename,
|
||||||
BackgroundSource background_source, GDesktop.BackgroundStyle style)
|
BackgroundSource background_source, GDesktop.BackgroundStyle style) {
|
||||||
{
|
|
||||||
Object (display: display,
|
Object (display: display,
|
||||||
monitor_index: monitor_index,
|
monitor_index: monitor_index,
|
||||||
background_source: background_source,
|
background_source: background_source,
|
||||||
@ -54,8 +51,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public Background (Meta.Screen screen, int monitor_index, string? filename,
|
public Background (Meta.Screen screen, int monitor_index, string? filename,
|
||||||
BackgroundSource background_source, GDesktop.BackgroundStyle style)
|
BackgroundSource background_source, GDesktop.BackgroundStyle style) {
|
||||||
{
|
|
||||||
Object (screen: screen,
|
Object (screen: screen,
|
||||||
monitor_index: monitor_index,
|
monitor_index: monitor_index,
|
||||||
background_source: background_source,
|
background_source: background_source,
|
||||||
@ -64,8 +60,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
background = new Meta.Background (display);
|
background = new Meta.Background (display);
|
||||||
#else
|
#else
|
||||||
@ -81,8 +76,7 @@ namespace Gala
|
|||||||
load ();
|
load ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy ()
|
public void destroy () {
|
||||||
{
|
|
||||||
cancellable.cancel ();
|
cancellable.cancel ();
|
||||||
remove_animation_timeout ();
|
remove_animation_timeout ();
|
||||||
|
|
||||||
@ -95,16 +89,14 @@ namespace Gala
|
|||||||
background_source.changed.disconnect (settings_changed);
|
background_source.changed.disconnect (settings_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update_resolution ()
|
public void update_resolution () {
|
||||||
{
|
|
||||||
if (animation != null) {
|
if (animation != null) {
|
||||||
remove_animation_timeout ();
|
remove_animation_timeout ();
|
||||||
update_animation ();
|
update_animation ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_loaded ()
|
void set_loaded () {
|
||||||
{
|
|
||||||
if (is_loaded)
|
if (is_loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -116,8 +108,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_pattern ()
|
void load_pattern () {
|
||||||
{
|
|
||||||
string color_string;
|
string color_string;
|
||||||
var settings = background_source.settings;
|
var settings = background_source.settings;
|
||||||
|
|
||||||
@ -135,8 +126,7 @@ namespace Gala
|
|||||||
background.set_gradient ((GDesktop.BackgroundShading) shading_type, color, second_color);
|
background.set_gradient ((GDesktop.BackgroundShading) shading_type, color, second_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void watch_file (string filename)
|
void watch_file (string filename) {
|
||||||
{
|
|
||||||
if (file_watches.has_key (filename))
|
if (file_watches.has_key (filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -153,16 +143,14 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_animation_timeout ()
|
void remove_animation_timeout () {
|
||||||
{
|
|
||||||
if (update_animation_timeout_id != 0) {
|
if (update_animation_timeout_id != 0) {
|
||||||
Source.remove (update_animation_timeout_id);
|
Source.remove (update_animation_timeout_id);
|
||||||
update_animation_timeout_id = 0;
|
update_animation_timeout_id = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_animation ()
|
void update_animation () {
|
||||||
{
|
|
||||||
update_animation_timeout_id = 0;
|
update_animation_timeout_id = 0;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -232,8 +220,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async void load_animation (string filename)
|
async void load_animation (string filename) {
|
||||||
{
|
|
||||||
animation = yield BackgroundCache.get_default ().get_animation (filename);
|
animation = yield BackgroundCache.get_default ().get_animation (filename);
|
||||||
|
|
||||||
if (animation == null || cancellable.is_cancelled ()) {
|
if (animation == null || cancellable.is_cancelled ()) {
|
||||||
@ -245,8 +232,7 @@ namespace Gala
|
|||||||
watch_file (filename);
|
watch_file (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_image (string filename)
|
void load_image (string filename) {
|
||||||
{
|
|
||||||
background.set_file (File.new_for_path (filename), style);
|
background.set_file (File.new_for_path (filename), style);
|
||||||
watch_file (filename);
|
watch_file (filename);
|
||||||
|
|
||||||
@ -263,16 +249,14 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_file (string filename)
|
void load_file (string filename) {
|
||||||
{
|
|
||||||
if (filename.has_suffix (".xml"))
|
if (filename.has_suffix (".xml"))
|
||||||
load_animation.begin (filename);
|
load_animation.begin (filename);
|
||||||
else
|
else
|
||||||
load_image (filename);
|
load_image (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load ()
|
void load () {
|
||||||
{
|
|
||||||
load_pattern ();
|
load_pattern ();
|
||||||
|
|
||||||
if (filename == null)
|
if (filename == null)
|
||||||
@ -281,8 +265,7 @@ namespace Gala
|
|||||||
load_file (filename);
|
load_file (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_changed ()
|
void settings_changed () {
|
||||||
{
|
|
||||||
changed ();
|
changed ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,11 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class BackgroundCache : Object {
|
||||||
public class BackgroundCache : Object
|
|
||||||
{
|
|
||||||
static BackgroundCache? instance = null;
|
static BackgroundCache? instance = null;
|
||||||
|
|
||||||
public static unowned BackgroundCache get_default ()
|
public static unowned BackgroundCache get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new BackgroundCache ();
|
instance = new BackgroundCache ();
|
||||||
|
|
||||||
@ -37,19 +34,16 @@ namespace Gala
|
|||||||
Animation animation;
|
Animation animation;
|
||||||
string animation_filename;
|
string animation_filename;
|
||||||
|
|
||||||
public BackgroundCache ()
|
public BackgroundCache () {
|
||||||
{
|
|
||||||
Object ();
|
Object ();
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
file_monitors = new Gee.HashMap<string,FileMonitor> ();
|
file_monitors = new Gee.HashMap<string,FileMonitor> ();
|
||||||
background_sources = new Gee.HashMap<string,BackgroundSource> ();
|
background_sources = new Gee.HashMap<string,BackgroundSource> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void monitor_file (string filename)
|
public void monitor_file (string filename) {
|
||||||
{
|
|
||||||
if (file_monitors.has_key (filename))
|
if (file_monitors.has_key (filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -66,8 +60,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Animation get_animation (string filename)
|
public async Animation get_animation (string filename) {
|
||||||
{
|
|
||||||
if (animation_filename == filename) {
|
if (animation_filename == filename) {
|
||||||
Idle.add (() => {
|
Idle.add (() => {
|
||||||
get_animation.callback ();
|
get_animation.callback ();
|
||||||
@ -92,11 +85,10 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public BackgroundSource get_background_source (Meta.Display display, string settings_schema)
|
public BackgroundSource get_background_source (Meta.Display display, string settings_schema) {
|
||||||
#else
|
#else
|
||||||
public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema)
|
public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema) {
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
var background_source = background_sources[settings_schema];
|
var background_source = background_sources[settings_schema];
|
||||||
if (background_source == null) {
|
if (background_source == null) {
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -112,8 +104,7 @@ namespace Gala
|
|||||||
return background_source;
|
return background_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release_background_source (string settings_schema)
|
public void release_background_source (string settings_schema) {
|
||||||
{
|
|
||||||
if (background_sources.has_key (settings_schema)) {
|
if (background_sources.has_key (settings_schema)) {
|
||||||
var source = background_sources[settings_schema];
|
var source = background_sources[settings_schema];
|
||||||
if (--source.use_count == 0) {
|
if (--source.use_count == 0) {
|
||||||
|
@ -15,54 +15,45 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class BackgroundContainer : Meta.BackgroundGroup {
|
||||||
public class BackgroundContainer : Meta.BackgroundGroup
|
|
||||||
{
|
|
||||||
public signal void changed ();
|
public signal void changed ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public Meta.Display display { get; construct; }
|
public Meta.Display display { get; construct; }
|
||||||
|
|
||||||
public BackgroundContainer (Meta.Display display)
|
public BackgroundContainer (Meta.Display display) {
|
||||||
{
|
|
||||||
Object (display: display);
|
Object (display: display);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
Meta.MonitorManager.@get ().monitors_changed.connect (update);
|
Meta.MonitorManager.@get ().monitors_changed.connect (update);
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~BackgroundContainer ()
|
~BackgroundContainer () {
|
||||||
{
|
|
||||||
Meta.MonitorManager.@get ().monitors_changed.disconnect (update);
|
Meta.MonitorManager.@get ().monitors_changed.disconnect (update);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public Meta.Screen screen { get; construct; }
|
public Meta.Screen screen { get; construct; }
|
||||||
|
|
||||||
public BackgroundContainer (Meta.Screen screen)
|
public BackgroundContainer (Meta.Screen screen) {
|
||||||
{
|
|
||||||
Object (screen: screen);
|
Object (screen: screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
screen.monitors_changed.connect (update);
|
screen.monitors_changed.connect (update);
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~BackgroundContainer ()
|
~BackgroundContainer () {
|
||||||
{
|
|
||||||
screen.monitors_changed.disconnect (update);
|
screen.monitors_changed.disconnect (update);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void update ()
|
void update () {
|
||||||
{
|
|
||||||
var reference_child = (get_child_at_index (0) as BackgroundManager);
|
var reference_child = (get_child_at_index (0) as BackgroundManager);
|
||||||
if (reference_child != null)
|
if (reference_child != null)
|
||||||
reference_child.changed.disconnect (background_changed);
|
reference_child.changed.disconnect (background_changed);
|
||||||
@ -84,8 +75,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_changed ()
|
void background_changed () {
|
||||||
{
|
|
||||||
changed ();
|
changed ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class BackgroundManager : Meta.BackgroundGroup {
|
||||||
public class BackgroundManager : Meta.BackgroundGroup
|
|
||||||
{
|
|
||||||
const string BACKGROUND_SCHEMA = "org.gnome.desktop.background";
|
const string BACKGROUND_SCHEMA = "org.gnome.desktop.background";
|
||||||
const int FADE_ANIMATION_TIME = 1000;
|
const int FADE_ANIMATION_TIME = 1000;
|
||||||
|
|
||||||
@ -37,19 +35,16 @@ namespace Gala
|
|||||||
Meta.BackgroundActor? new_background_actor = null;
|
Meta.BackgroundActor? new_background_actor = null;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true)
|
public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true) {
|
||||||
{
|
|
||||||
Object (display: display, monitor_index: monitor_index, control_position: control_position);
|
Object (display: display, monitor_index: monitor_index, control_position: control_position);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public BackgroundManager (Meta.Screen screen, int monitor_index, bool control_position = true)
|
public BackgroundManager (Meta.Screen screen, int monitor_index, bool control_position = true) {
|
||||||
{
|
|
||||||
Object (screen: screen, monitor_index: monitor_index, control_position: control_position);
|
Object (screen: screen, monitor_index: monitor_index, control_position: control_position);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
background_source = BackgroundCache.get_default ().get_background_source (display, BACKGROUND_SCHEMA);
|
background_source = BackgroundCache.get_default ().get_background_source (display, BACKGROUND_SCHEMA);
|
||||||
#else
|
#else
|
||||||
@ -61,8 +56,7 @@ namespace Gala
|
|||||||
destroy.connect (on_destroy);
|
destroy.connect (on_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_destroy ()
|
void on_destroy () {
|
||||||
{
|
|
||||||
BackgroundCache.get_default ().release_background_source (BACKGROUND_SCHEMA);
|
BackgroundCache.get_default ().release_background_source (BACKGROUND_SCHEMA);
|
||||||
background_source = null;
|
background_source = null;
|
||||||
|
|
||||||
@ -77,8 +71,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap_background_actor ()
|
void swap_background_actor () {
|
||||||
{
|
|
||||||
return_if_fail (new_background_actor != null);
|
return_if_fail (new_background_actor != null);
|
||||||
|
|
||||||
var old_background_actor = background_actor;
|
var old_background_actor = background_actor;
|
||||||
@ -103,8 +96,7 @@ namespace Gala
|
|||||||
old_background_actor.add_transition ("fade-out", transition);
|
old_background_actor.add_transition ("fade-out", transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_background_actor ()
|
void update_background_actor () {
|
||||||
{
|
|
||||||
if (new_background_actor != null) {
|
if (new_background_actor != null) {
|
||||||
// Skip displaying existing background queued for load
|
// Skip displaying existing background queued for load
|
||||||
new_background_actor.destroy ();
|
new_background_actor.destroy ();
|
||||||
@ -137,8 +129,7 @@ namespace Gala
|
|||||||
background_actor.set_size (width, height);
|
background_actor.set_size (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
Meta.BackgroundActor create_background_actor ()
|
Meta.BackgroundActor create_background_actor () {
|
||||||
{
|
|
||||||
var background = background_source.get_background (monitor_index);
|
var background = background_source.get_background (monitor_index);
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var background_actor = new Meta.BackgroundActor (display, monitor_index);
|
var background_actor = new Meta.BackgroundActor (display, monitor_index);
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class BackgroundSource : Object {
|
||||||
public class BackgroundSource : Object
|
|
||||||
{
|
|
||||||
public signal void changed ();
|
public signal void changed ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -33,19 +31,16 @@ namespace Gala
|
|||||||
Gee.HashMap<int,Background> backgrounds;
|
Gee.HashMap<int,Background> backgrounds;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public BackgroundSource (Meta.Display display, string settings_schema)
|
public BackgroundSource (Meta.Display display, string settings_schema) {
|
||||||
{
|
|
||||||
Object (display: display, settings: new Settings (settings_schema));
|
Object (display: display, settings: new Settings (settings_schema));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public BackgroundSource (Meta.Screen screen, string settings_schema)
|
public BackgroundSource (Meta.Screen screen, string settings_schema) {
|
||||||
{
|
|
||||||
Object (screen: screen, settings: new Settings (settings_schema));
|
Object (screen: screen, settings: new Settings (settings_schema));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
backgrounds = new Gee.HashMap<int,Background> ();
|
backgrounds = new Gee.HashMap<int,Background> ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -58,8 +53,7 @@ namespace Gala
|
|||||||
settings.changed.connect (settings_changed);
|
settings.changed.connect (settings_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitors_changed ()
|
void monitors_changed () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var n = display.get_n_monitors ();
|
var n = display.get_n_monitors ();
|
||||||
#else
|
#else
|
||||||
@ -80,8 +74,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Background get_background (int monitor_index)
|
public Background get_background (int monitor_index) {
|
||||||
{
|
|
||||||
string? filename = null;
|
string? filename = null;
|
||||||
|
|
||||||
var style = settings.get_enum ("picture-options");
|
var style = settings.get_enum ("picture-options");
|
||||||
@ -113,15 +106,13 @@ namespace Gala
|
|||||||
return backgrounds[monitor_index];
|
return backgrounds[monitor_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_changed (Background background)
|
void background_changed (Background background) {
|
||||||
{
|
|
||||||
background.changed.disconnect (background_changed);
|
background.changed.disconnect (background_changed);
|
||||||
background.destroy ();
|
background.destroy ();
|
||||||
backgrounds.unset (background.monitor_index);
|
backgrounds.unset (background.monitor_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy ()
|
public void destroy () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
Meta.MonitorManager.@get ().monitors_changed.disconnect (monitors_changed);
|
Meta.MonitorManager.@get ().monitors_changed.disconnect (monitors_changed);
|
||||||
#else
|
#else
|
||||||
@ -139,8 +130,7 @@ namespace Gala
|
|||||||
// new actors all the time, which lead to some problems in other areas of the code
|
// new actors all the time, which lead to some problems in other areas of the code
|
||||||
|
|
||||||
// helper struct which stores the hash values generated by g_variant_hash
|
// helper struct which stores the hash values generated by g_variant_hash
|
||||||
struct SettingsHashCache
|
struct SettingsHashCache {
|
||||||
{
|
|
||||||
uint color_shading_type;
|
uint color_shading_type;
|
||||||
uint picture_opacity;
|
uint picture_opacity;
|
||||||
uint picture_options;
|
uint picture_options;
|
||||||
@ -155,8 +145,7 @@ namespace Gala
|
|||||||
const string[] options = { "color-shading-type", "picture-opacity",
|
const string[] options = { "color-shading-type", "picture-opacity",
|
||||||
"picture-options", "picture-uri", "primary-color", "secondary-color" };
|
"picture-options", "picture-uri", "primary-color", "secondary-color" };
|
||||||
|
|
||||||
void settings_changed (string key)
|
void settings_changed (string key) {
|
||||||
{
|
|
||||||
if (!(key in options))
|
if (!(key in options))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -171,8 +160,7 @@ namespace Gala
|
|||||||
changed ();
|
changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsHashCache get_current_settings_hash_cache ()
|
SettingsHashCache get_current_settings_hash_cache () {
|
||||||
{
|
|
||||||
return {
|
return {
|
||||||
settings.get_value ("color-shading-type").hash (),
|
settings.get_value ("color-shading-type").hash (),
|
||||||
settings.get_value ("picture-opacity").hash (),
|
settings.get_value ("picture-opacity").hash (),
|
||||||
|
@ -15,14 +15,12 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
#if HAS_MUTTER332
|
#if HAS_MUTTER332
|
||||||
public class SystemBackground : GLib.Object
|
public class SystemBackground : GLib.Object {
|
||||||
#else
|
#else
|
||||||
public class SystemBackground : Meta.BackgroundActor
|
public class SystemBackground : Meta.BackgroundActor {
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
|
const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
|
||||||
|
|
||||||
static Meta.Background? system_background = null;
|
static Meta.Background? system_background = null;
|
||||||
@ -33,8 +31,7 @@ namespace Gala
|
|||||||
public signal void loaded ();
|
public signal void loaded ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public SystemBackground (Meta.Display display)
|
public SystemBackground (Meta.Display display) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER332
|
#if HAS_MUTTER332
|
||||||
Object (background_actor: new Meta.BackgroundActor (display, 0));
|
Object (background_actor: new Meta.BackgroundActor (display, 0));
|
||||||
#else
|
#else
|
||||||
@ -42,14 +39,12 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public SystemBackground (Meta.Screen screen)
|
public SystemBackground (Meta.Screen screen) {
|
||||||
{
|
|
||||||
Object (meta_screen: screen, monitor: 0);
|
Object (meta_screen: screen, monitor: 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
var background_file = GLib.File.new_for_uri ("resource:///io/elementary/desktop/gala/texture.png");
|
var background_file = GLib.File.new_for_uri ("resource:///io/elementary/desktop/gala/texture.png");
|
||||||
unowned string custom_path = AppearanceSettings.get_default ().workspace_switcher_background;
|
unowned string custom_path = AppearanceSettings.get_default ().workspace_switcher_background;
|
||||||
if (custom_path != "" && FileUtils.test (custom_path, FileTest.IS_REGULAR)) {
|
if (custom_path != "" && FileUtils.test (custom_path, FileTest.IS_REGULAR)) {
|
||||||
@ -92,8 +87,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void refresh ()
|
public static void refresh () {
|
||||||
{
|
|
||||||
// Meta.Background.refresh_all does not refresh backgrounds with the WALLPAPER style.
|
// Meta.Background.refresh_all does not refresh backgrounds with the WALLPAPER style.
|
||||||
// (Last tested with mutter 3.28)
|
// (Last tested with mutter 3.28)
|
||||||
// As a workaround, re-apply the current color again to force the wallpaper texture
|
// As a workaround, re-apply the current color again to force the wallpaper texture
|
||||||
|
@ -15,17 +15,14 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
[DBus (name="org.pantheon.gala")]
|
[DBus (name="org.pantheon.gala")]
|
||||||
public class DBus
|
public class DBus {
|
||||||
{
|
|
||||||
static DBus? instance;
|
static DBus? instance;
|
||||||
static WindowManager wm;
|
static WindowManager wm;
|
||||||
|
|
||||||
[DBus (visible = false)]
|
[DBus (visible = false)]
|
||||||
public static void init (WindowManager _wm)
|
public static void init (WindowManager _wm) {
|
||||||
{
|
|
||||||
wm = _wm;
|
wm = _wm;
|
||||||
|
|
||||||
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
|
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
|
||||||
@ -65,16 +62,14 @@ namespace Gala
|
|||||||
() => critical ("Could not acquire name") );
|
() => critical ("Could not acquire name") );
|
||||||
}
|
}
|
||||||
|
|
||||||
private DBus ()
|
private DBus () {
|
||||||
{
|
|
||||||
if (wm.background_group != null)
|
if (wm.background_group != null)
|
||||||
(wm.background_group as BackgroundContainer).changed.connect (() => background_changed ());
|
(wm.background_group as BackgroundContainer).changed.connect (() => background_changed ());
|
||||||
else
|
else
|
||||||
assert_not_reached ();
|
assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void perform_action (ActionType type) throws DBusError, IOError
|
public void perform_action (ActionType type) throws DBusError, IOError {
|
||||||
{
|
|
||||||
wm.perform_action (type);
|
wm.perform_action (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,15 +78,13 @@ namespace Gala
|
|||||||
|
|
||||||
class DummyOffscreenEffect : Clutter.OffscreenEffect {
|
class DummyOffscreenEffect : Clutter.OffscreenEffect {
|
||||||
public signal void done_painting ();
|
public signal void done_painting ();
|
||||||
public override void post_paint ()
|
public override void post_paint () {
|
||||||
{
|
|
||||||
base.post_paint ();
|
base.post_paint ();
|
||||||
done_painting ();
|
done_painting ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ColorInformation
|
public struct ColorInformation {
|
||||||
{
|
|
||||||
double average_red;
|
double average_red;
|
||||||
double average_green;
|
double average_green;
|
||||||
double average_blue;
|
double average_blue;
|
||||||
@ -123,8 +116,7 @@ namespace Gala
|
|||||||
*/
|
*/
|
||||||
public async ColorInformation get_background_color_information (int monitor,
|
public async ColorInformation get_background_color_information (int monitor,
|
||||||
int reference_x, int reference_y, int reference_width, int reference_height)
|
int reference_x, int reference_y, int reference_width, int reference_height)
|
||||||
throws DBusError, IOError
|
throws DBusError, IOError {
|
||||||
{
|
|
||||||
var background = wm.background_group.get_child_at_index (monitor);
|
var background = wm.background_group.get_child_at_index (monitor);
|
||||||
if (background == null)
|
if (background == null)
|
||||||
throw new DBusError.INVALID_ARGS ("Invalid monitor requested");
|
throw new DBusError.INVALID_ARGS ("Invalid monitor requested");
|
||||||
|
@ -15,22 +15,18 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public struct Accelerator {
|
||||||
public struct Accelerator
|
|
||||||
{
|
|
||||||
public string name;
|
public string name;
|
||||||
public Meta.KeyBindingFlags flags;
|
public Meta.KeyBindingFlags flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DBus (name="org.gnome.Shell")]
|
[DBus (name="org.gnome.Shell")]
|
||||||
public class DBusAccelerator
|
public class DBusAccelerator {
|
||||||
{
|
|
||||||
static DBusAccelerator? instance;
|
static DBusAccelerator? instance;
|
||||||
|
|
||||||
[DBus (visible = false)]
|
[DBus (visible = false)]
|
||||||
public static unowned DBusAccelerator init (WindowManager wm)
|
public static unowned DBusAccelerator init (WindowManager wm) {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new DBusAccelerator (wm);
|
instance = new DBusAccelerator (wm);
|
||||||
|
|
||||||
@ -42,8 +38,7 @@ namespace Gala
|
|||||||
WindowManager wm;
|
WindowManager wm;
|
||||||
HashTable<string, uint?> grabbed_accelerators;
|
HashTable<string, uint?> grabbed_accelerators;
|
||||||
|
|
||||||
DBusAccelerator (WindowManager _wm)
|
DBusAccelerator (WindowManager _wm) {
|
||||||
{
|
|
||||||
wm = _wm;
|
wm = _wm;
|
||||||
grabbed_accelerators = new HashTable<string, uint?> (str_hash, str_equal);
|
grabbed_accelerators = new HashTable<string, uint?> (str_hash, str_equal);
|
||||||
|
|
||||||
@ -55,11 +50,10 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER334
|
#if HAS_MUTTER334
|
||||||
void on_accelerator_activated (uint action, Clutter.InputDevice device, uint timestamp)
|
void on_accelerator_activated (uint action, Clutter.InputDevice device, uint timestamp) {
|
||||||
#else
|
#else
|
||||||
void on_accelerator_activated (uint action, uint device_id, uint timestamp)
|
void on_accelerator_activated (uint action, uint device_id, uint timestamp) {
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
foreach (string accelerator in grabbed_accelerators.get_keys ()) {
|
foreach (string accelerator in grabbed_accelerators.get_keys ()) {
|
||||||
if (grabbed_accelerators[accelerator] == action) {
|
if (grabbed_accelerators[accelerator] == action) {
|
||||||
var parameters = new GLib.HashTable<string, Variant> (null, null);
|
var parameters = new GLib.HashTable<string, Variant> (null, null);
|
||||||
@ -75,8 +69,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint grab_accelerator (string accelerator, uint flags) throws DBusError, IOError
|
public uint grab_accelerator (string accelerator, uint flags) throws DBusError, IOError {
|
||||||
{
|
|
||||||
uint? action = grabbed_accelerators[accelerator];
|
uint? action = grabbed_accelerators[accelerator];
|
||||||
|
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
@ -95,8 +88,7 @@ namespace Gala
|
|||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint[] grab_accelerators (Accelerator[] accelerators) throws DBusError, IOError
|
public uint[] grab_accelerators (Accelerator[] accelerators) throws DBusError, IOError {
|
||||||
{
|
|
||||||
uint[] actions = {};
|
uint[] actions = {};
|
||||||
|
|
||||||
foreach (unowned Accelerator? accelerator in accelerators) {
|
foreach (unowned Accelerator? accelerator in accelerators) {
|
||||||
@ -106,8 +98,7 @@ namespace Gala
|
|||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ungrab_accelerator (uint action) throws DBusError, IOError
|
public bool ungrab_accelerator (uint action) throws DBusError, IOError {
|
||||||
{
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
foreach (unowned string accelerator in grabbed_accelerators.get_keys ()) {
|
foreach (unowned string accelerator in grabbed_accelerators.get_keys ()) {
|
||||||
@ -126,8 +117,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DBus (name = "ShowOSD")]
|
[DBus (name = "ShowOSD")]
|
||||||
public void show_osd (GLib.HashTable<string, Variant> parameters) throws DBusError, IOError
|
public void show_osd (GLib.HashTable<string, Variant> parameters) throws DBusError, IOError {
|
||||||
{
|
|
||||||
int32 monitor_index = -1;
|
int32 monitor_index = -1;
|
||||||
if (parameters.contains ("monitor"))
|
if (parameters.contains ("monitor"))
|
||||||
monitor_index = parameters["monitor"].get_int32 ();
|
monitor_index = parameters["monitor"].get_int32 ();
|
||||||
@ -140,10 +130,10 @@ namespace Gala
|
|||||||
int32 level = 0;
|
int32 level = 0;
|
||||||
if (parameters.contains ("level"))
|
if (parameters.contains ("level"))
|
||||||
level = parameters["level"].get_int32 ();
|
level = parameters["level"].get_int32 ();
|
||||||
|
|
||||||
//if (monitor_index > -1)
|
//if (monitor_index > -1)
|
||||||
// message ("MediaFeedback requested for specific monitor %i which is not supported", monitor_index);
|
// message ("MediaFeedback requested for specific monitor %i which is not supported", monitor_index);
|
||||||
|
|
||||||
MediaFeedback.send (icon, level);
|
MediaFeedback.send (icon, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,14 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Provides access to a PlankDrawingDockTheme and PlankDockPrefereces
|
* Provides access to a PlankDrawingDockTheme and PlankDockPrefereces
|
||||||
*/
|
*/
|
||||||
public class DockThemeManager : Object
|
public class DockThemeManager : Object {
|
||||||
{
|
|
||||||
static DockThemeManager? instance = null;
|
static DockThemeManager? instance = null;
|
||||||
|
|
||||||
public static unowned DockThemeManager get_default ()
|
public static unowned DockThemeManager get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new DockThemeManager ();
|
instance = new DockThemeManager ();
|
||||||
|
|
||||||
@ -38,27 +35,23 @@ namespace Gala
|
|||||||
public signal void dock_theme_changed (Plank.DockTheme? old_theme,
|
public signal void dock_theme_changed (Plank.DockTheme? old_theme,
|
||||||
Plank.DockTheme new_theme);
|
Plank.DockTheme new_theme);
|
||||||
|
|
||||||
DockThemeManager ()
|
DockThemeManager () {
|
||||||
{
|
|
||||||
dock_settings = new Plank.DockPreferences ("dock1");
|
dock_settings = new Plank.DockPreferences ("dock1");
|
||||||
dock_settings.notify["Theme"].connect (load_dock_theme);
|
dock_settings.notify["Theme"].connect (load_dock_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plank.DockTheme get_dock_theme ()
|
public Plank.DockTheme get_dock_theme () {
|
||||||
{
|
|
||||||
if (dock_theme == null)
|
if (dock_theme == null)
|
||||||
load_dock_theme ();
|
load_dock_theme ();
|
||||||
|
|
||||||
return dock_theme;
|
return dock_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plank.DockPreferences get_dock_settings ()
|
public Plank.DockPreferences get_dock_settings () {
|
||||||
{
|
|
||||||
return dock_settings;
|
return dock_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_dock_theme ()
|
void load_dock_theme () {
|
||||||
{
|
|
||||||
var new_theme = new Plank.DockTheme (dock_settings.Theme);
|
var new_theme = new Plank.DockTheme (dock_settings.Theme);
|
||||||
new_theme.load ("dock");
|
new_theme.load ("dock");
|
||||||
dock_theme_changed (dock_theme, new_theme);
|
dock_theme_changed (dock_theme, new_theme);
|
||||||
|
@ -17,17 +17,14 @@
|
|||||||
|
|
||||||
using Clutter;
|
using Clutter;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum DragDropActionType
|
public enum DragDropActionType {
|
||||||
{
|
|
||||||
SOURCE,
|
SOURCE,
|
||||||
DESTINATION
|
DESTINATION
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DragDropAction : Clutter.Action
|
public class DragDropAction : Clutter.Action {
|
||||||
{
|
|
||||||
static Gee.HashMap<string,Gee.LinkedList<Actor>>? sources = null;
|
static Gee.HashMap<string,Gee.LinkedList<Actor>>? sources = null;
|
||||||
static Gee.HashMap<string,Gee.LinkedList<Actor>>? destinations = null;
|
static Gee.HashMap<string,Gee.LinkedList<Actor>>? destinations = null;
|
||||||
|
|
||||||
@ -101,7 +98,7 @@ namespace Gala
|
|||||||
public bool allow_bubbling { get; set; default = true; }
|
public bool allow_bubbling { get; set; default = true; }
|
||||||
|
|
||||||
public Actor? hovered { private get; set; default = null; }
|
public Actor? hovered { private get; set; default = null; }
|
||||||
|
|
||||||
bool clicked = false;
|
bool clicked = false;
|
||||||
float last_x;
|
float last_x;
|
||||||
float last_y;
|
float last_y;
|
||||||
@ -114,8 +111,7 @@ namespace Gala
|
|||||||
* which destinations. It has to be the same for all actors that
|
* which destinations. It has to be the same for all actors that
|
||||||
* should be compatible with each other.
|
* should be compatible with each other.
|
||||||
*/
|
*/
|
||||||
public DragDropAction (DragDropActionType type, string id)
|
public DragDropAction (DragDropActionType type, string id) {
|
||||||
{
|
|
||||||
Object (drag_type : type, drag_id : id);
|
Object (drag_type : type, drag_id : id);
|
||||||
|
|
||||||
if (sources == null)
|
if (sources == null)
|
||||||
@ -126,14 +122,12 @@ namespace Gala
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~DragDropAction ()
|
~DragDropAction () {
|
||||||
{
|
|
||||||
if (actor != null)
|
if (actor != null)
|
||||||
release_actor (actor);
|
release_actor (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void set_actor (Actor? new_actor)
|
public override void set_actor (Actor? new_actor) {
|
||||||
{
|
|
||||||
if (actor != null) {
|
if (actor != null) {
|
||||||
release_actor (actor);
|
release_actor (actor);
|
||||||
}
|
}
|
||||||
@ -145,23 +139,21 @@ namespace Gala
|
|||||||
base.set_actor (new_actor);
|
base.set_actor (new_actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void release_actor (Actor actor)
|
void release_actor (Actor actor) {
|
||||||
{
|
|
||||||
if (DragDropActionType.SOURCE in drag_type) {
|
if (DragDropActionType.SOURCE in drag_type) {
|
||||||
actor.button_press_event.disconnect (source_clicked);
|
actor.button_press_event.disconnect (source_clicked);
|
||||||
|
|
||||||
var source_list = sources.@get (drag_id);
|
var source_list = sources.@get (drag_id);
|
||||||
source_list.remove (actor);
|
source_list.remove (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DragDropActionType.DESTINATION in drag_type) {
|
if (DragDropActionType.DESTINATION in drag_type) {
|
||||||
var dest_list = destinations[drag_id];
|
var dest_list = destinations[drag_id];
|
||||||
dest_list.remove (actor);
|
dest_list.remove (actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void connect_actor (Actor actor)
|
void connect_actor (Actor actor) {
|
||||||
{
|
|
||||||
if (DragDropActionType.SOURCE in drag_type) {
|
if (DragDropActionType.SOURCE in drag_type) {
|
||||||
actor.button_press_event.connect (source_clicked);
|
actor.button_press_event.connect (source_clicked);
|
||||||
|
|
||||||
@ -185,14 +177,12 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void emit_crossed (Actor destination, bool is_hovered)
|
void emit_crossed (Actor destination, bool is_hovered) {
|
||||||
{
|
|
||||||
get_drag_drop_action (destination).crossed (actor, is_hovered);
|
get_drag_drop_action (destination).crossed (actor, is_hovered);
|
||||||
destination_crossed (destination, is_hovered);
|
destination_crossed (destination, is_hovered);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool source_clicked (ButtonEvent event)
|
bool source_clicked (ButtonEvent event) {
|
||||||
{
|
|
||||||
if (event.button != 1) {
|
if (event.button != 1) {
|
||||||
actor_clicked (event.button);
|
actor_clicked (event.button);
|
||||||
return false;
|
return false;
|
||||||
@ -206,8 +196,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool follow_move (Event event)
|
bool follow_move (Event event) {
|
||||||
{
|
|
||||||
// still determining if we actually want to start a drag action
|
// still determining if we actually want to start a drag action
|
||||||
if (!dragging) {
|
if (!dragging) {
|
||||||
switch (event.get_type ()) {
|
switch (event.get_type ()) {
|
||||||
@ -332,8 +321,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @return the DragDropAction instance on this actor or NULL
|
* @return the DragDropAction instance on this actor or NULL
|
||||||
*/
|
*/
|
||||||
DragDropAction? get_drag_drop_action (Actor actor)
|
DragDropAction? get_drag_drop_action (Actor actor) {
|
||||||
{
|
|
||||||
DragDropAction? drop_action = null;
|
DragDropAction? drop_action = null;
|
||||||
|
|
||||||
foreach (var action in actor.get_actions ()) {
|
foreach (var action in actor.get_actions ()) {
|
||||||
@ -352,8 +340,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Abort the drag
|
* Abort the drag
|
||||||
*/
|
*/
|
||||||
public void cancel ()
|
public void cancel () {
|
||||||
{
|
|
||||||
cleanup ();
|
cleanup ();
|
||||||
|
|
||||||
drag_canceled ();
|
drag_canceled ();
|
||||||
@ -362,8 +349,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Allows you to abort all drags currently running for a given drag-id
|
* Allows you to abort all drags currently running for a given drag-id
|
||||||
*/
|
*/
|
||||||
public static void cancel_all_by_id (string id)
|
public static void cancel_all_by_id (string id) {
|
||||||
{
|
|
||||||
var actors = sources.@get (id);
|
var actors = sources.@get (id);
|
||||||
if (actors == null)
|
if (actors == null)
|
||||||
return;
|
return;
|
||||||
@ -379,8 +365,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish ()
|
void finish () {
|
||||||
{
|
|
||||||
// make sure they reset the style or whatever they changed when hovered
|
// make sure they reset the style or whatever they changed when hovered
|
||||||
emit_crossed (hovered, false);
|
emit_crossed (hovered, false);
|
||||||
|
|
||||||
@ -389,8 +374,7 @@ namespace Gala
|
|||||||
drag_end (hovered);
|
drag_end (hovered);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup ()
|
void cleanup () {
|
||||||
{
|
|
||||||
var source_list = sources.@get (drag_id);
|
var source_list = sources.@get (drag_id);
|
||||||
if (source_list != null) {
|
if (source_list != null) {
|
||||||
foreach (var actor in source_list) {
|
foreach (var actor in source_list) {
|
||||||
|
@ -17,19 +17,15 @@
|
|||||||
|
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public enum InputArea {
|
||||||
public enum InputArea
|
|
||||||
{
|
|
||||||
NONE,
|
NONE,
|
||||||
FULLSCREEN,
|
FULLSCREEN,
|
||||||
DEFAULT
|
DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InternalUtils
|
public class InternalUtils {
|
||||||
{
|
public static bool workspaces_only_on_primary () {
|
||||||
public static bool workspaces_only_on_primary ()
|
|
||||||
{
|
|
||||||
return Prefs.get_dynamic_workspaces ()
|
return Prefs.get_dynamic_workspaces ()
|
||||||
&& Prefs.get_workspaces_only_on_primary ();
|
&& Prefs.get_workspaces_only_on_primary ();
|
||||||
}
|
}
|
||||||
@ -37,8 +33,7 @@ namespace Gala
|
|||||||
/*
|
/*
|
||||||
* Reload shadow settings
|
* Reload shadow settings
|
||||||
*/
|
*/
|
||||||
public static void reload_shadow ()
|
public static void reload_shadow () {
|
||||||
{
|
|
||||||
var factory = ShadowFactory.get_default ();
|
var factory = ShadowFactory.get_default ();
|
||||||
var settings = ShadowSettings.get_default ();
|
var settings = ShadowSettings.get_default ();
|
||||||
Meta.ShadowParams shadow;
|
Meta.ShadowParams shadow;
|
||||||
@ -72,8 +67,7 @@ namespace Gala
|
|||||||
* set the area where clutter can receive events
|
* set the area where clutter can receive events
|
||||||
**/
|
**/
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public static void set_input_area (Display display, InputArea area)
|
public static void set_input_area (Display display, InputArea area) {
|
||||||
{
|
|
||||||
X.Xrectangle[] rects = {};
|
X.Xrectangle[] rects = {};
|
||||||
int width, height;
|
int width, height;
|
||||||
display.get_size (out width, out height);
|
display.get_size (out width, out height);
|
||||||
@ -128,8 +122,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static void set_input_area (Screen screen, InputArea area)
|
public static void set_input_area (Screen screen, InputArea area) {
|
||||||
{
|
|
||||||
var display = screen.get_display ();
|
var display = screen.get_display ();
|
||||||
|
|
||||||
X.Xrectangle[] rects = {};
|
X.Xrectangle[] rects = {};
|
||||||
@ -183,8 +176,7 @@ namespace Gala
|
|||||||
* @param index The index at which to insert the workspace
|
* @param index The index at which to insert the workspace
|
||||||
* @param new_window A window that should be moved to the new workspace
|
* @param new_window A window that should be moved to the new workspace
|
||||||
*/
|
*/
|
||||||
public static void insert_workspace_with_window (int index, Window new_window)
|
public static void insert_workspace_with_window (int index, Window new_window) {
|
||||||
{
|
|
||||||
unowned WorkspaceManager workspace_manager = WorkspaceManager.get_default ();
|
unowned WorkspaceManager workspace_manager = WorkspaceManager.get_default ();
|
||||||
workspace_manager.freeze_remove ();
|
workspace_manager.freeze_remove ();
|
||||||
|
|
||||||
@ -223,33 +215,27 @@ namespace Gala
|
|||||||
const int ACCURACY = 20;
|
const int ACCURACY = 20;
|
||||||
|
|
||||||
// some math utilities
|
// some math utilities
|
||||||
static int squared_distance (Gdk.Point a, Gdk.Point b)
|
static int squared_distance (Gdk.Point a, Gdk.Point b) {
|
||||||
{
|
|
||||||
var k1 = b.x - a.x;
|
var k1 = b.x - a.x;
|
||||||
var k2 = b.y - a.y;
|
var k2 = b.y - a.y;
|
||||||
|
|
||||||
return k1*k1 + k2*k2;
|
return k1*k1 + k2*k2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Meta.Rectangle rect_adjusted (Meta.Rectangle rect, int dx1, int dy1, int dx2, int dy2)
|
static Meta.Rectangle rect_adjusted (Meta.Rectangle rect, int dx1, int dy1, int dx2, int dy2) {
|
||||||
{
|
|
||||||
return {rect.x + dx1, rect.y + dy1, rect.width + (-dx1 + dx2), rect.height + (-dy1 + dy2)};
|
return {rect.x + dx1, rect.y + dy1, rect.width + (-dx1 + dx2), rect.height + (-dy1 + dy2)};
|
||||||
}
|
}
|
||||||
|
|
||||||
static Gdk.Point rect_center (Meta.Rectangle rect)
|
static Gdk.Point rect_center (Meta.Rectangle rect) {
|
||||||
{
|
|
||||||
return {rect.x + rect.width / 2, rect.y + rect.height / 2};
|
return {rect.x + rect.width / 2, rect.y + rect.height / 2};
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TilableWindow
|
public struct TilableWindow {
|
||||||
{
|
|
||||||
Meta.Rectangle rect;
|
Meta.Rectangle rect;
|
||||||
void *id;
|
void *id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<TilableWindow?> calculate_grid_placement (Meta.Rectangle area,
|
public static List<TilableWindow?> calculate_grid_placement (Meta.Rectangle area, List<TilableWindow?> windows) {
|
||||||
List<TilableWindow?> windows)
|
|
||||||
{
|
|
||||||
uint window_count = windows.length ();
|
uint window_count = windows.length ();
|
||||||
int columns = (int)Math.ceil (Math.sqrt (window_count));
|
int columns = (int)Math.ceil (Math.sqrt (window_count));
|
||||||
int rows = (int)Math.ceil (window_count / (double)columns);
|
int rows = (int)Math.ceil (window_count / (double)columns);
|
||||||
@ -366,8 +352,7 @@ namespace Gala
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static inline bool get_window_is_normal (Meta.Window window)
|
public static inline bool get_window_is_normal (Meta.Window window) {
|
||||||
{
|
|
||||||
switch (window.get_window_type ()) {
|
switch (window.get_window_type ()) {
|
||||||
case Meta.WindowType.NORMAL:
|
case Meta.WindowType.NORMAL:
|
||||||
case Meta.WindowType.DIALOG:
|
case Meta.WindowType.DIALOG:
|
||||||
@ -378,8 +363,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int get_ui_scaling_factor ()
|
public static int get_ui_scaling_factor () {
|
||||||
{
|
|
||||||
return Meta.Backend.get_backend ().get_settings ().get_ui_scaling_factor ();
|
return Meta.Backend.get_backend ().get_settings ().get_ui_scaling_factor ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,12 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class KeyboardManager : Object {
|
||||||
public class KeyboardManager : Object
|
|
||||||
{
|
|
||||||
static KeyboardManager? instance;
|
static KeyboardManager? instance;
|
||||||
static VariantType sources_variant_type;
|
static VariantType sources_variant_type;
|
||||||
|
|
||||||
public static void init (Meta.Display display)
|
public static void init (Meta.Display display) {
|
||||||
{
|
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -32,20 +29,17 @@ namespace Gala
|
|||||||
display.modifiers_accelerator_activated.connect (instance.handle_modifiers_accelerator_activated);
|
display.modifiers_accelerator_activated.connect (instance.handle_modifiers_accelerator_activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
static construct
|
static construct {
|
||||||
{
|
|
||||||
sources_variant_type = new VariantType ("a(ss)");
|
sources_variant_type = new VariantType ("a(ss)");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLib.Settings settings;
|
GLib.Settings settings;
|
||||||
|
|
||||||
KeyboardManager ()
|
KeyboardManager () {
|
||||||
{
|
|
||||||
Object ();
|
Object ();
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
var schema = GLib.SettingsSchemaSource.get_default ().lookup ("org.gnome.desktop.input-sources", true);
|
var schema = GLib.SettingsSchemaSource.get_default ().lookup ("org.gnome.desktop.input-sources", true);
|
||||||
if (schema == null)
|
if (schema == null)
|
||||||
return;
|
return;
|
||||||
@ -57,8 +51,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
bool handle_modifiers_accelerator_activated (Meta.Display display)
|
bool handle_modifiers_accelerator_activated (Meta.Display display) {
|
||||||
{
|
|
||||||
display.ungrab_keyboard (display.get_current_time ());
|
display.ungrab_keyboard (display.get_current_time ());
|
||||||
|
|
||||||
var sources = settings.get_value ("sources");
|
var sources = settings.get_value ("sources");
|
||||||
@ -76,8 +69,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void set_keyboard_layout (GLib.Settings settings, string key)
|
void set_keyboard_layout (GLib.Settings settings, string key) {
|
||||||
{
|
|
||||||
if (!(key == "current" || key == "source" || key == "xkb-options"))
|
if (!(key == "current" || key == "source" || key == "xkb-options"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
const OptionEntry[] OPTIONS = {
|
const OptionEntry[] OPTIONS = {
|
||||||
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
|
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
|
||||||
{ null }
|
{ null }
|
||||||
@ -27,8 +26,7 @@ namespace Gala
|
|||||||
Meta.exit (Meta.ExitCode.SUCCESS);
|
Meta.exit (Meta.ExitCode.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int main (string[] args)
|
public static int main (string[] args) {
|
||||||
{
|
|
||||||
unowned OptionContext ctx = Meta.get_option_context ();
|
unowned OptionContext ctx = Meta.get_option_context ();
|
||||||
ctx.add_main_entries (Gala.OPTIONS, null);
|
ctx.add_main_entries (Gala.OPTIONS, null);
|
||||||
try {
|
try {
|
||||||
|
@ -15,25 +15,20 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
[DBus (name = "org.freedesktop.Notifications")]
|
[DBus (name = "org.freedesktop.Notifications")]
|
||||||
interface DBusNotifications : GLib.Object
|
interface DBusNotifications : GLib.Object {
|
||||||
{
|
|
||||||
public abstract uint32 notify (string app_name, uint32 replaces_id, string app_icon, string summary,
|
public abstract uint32 notify (string app_name, uint32 replaces_id, string app_icon, string summary,
|
||||||
string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout) throws DBusError, IOError;
|
string body, string[] actions, HashTable<string, Variant> hints, int32 expire_timeout) throws DBusError, IOError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MediaFeedback : GLib.Object
|
public class MediaFeedback : GLib.Object {
|
||||||
{
|
|
||||||
[Compact]
|
[Compact]
|
||||||
class Feedback
|
class Feedback {
|
||||||
{
|
|
||||||
public string icon;
|
public string icon;
|
||||||
public int32 level;
|
public int32 level;
|
||||||
|
|
||||||
public Feedback (string _icon, int32 _level)
|
public Feedback (string _icon, int32 _level) {
|
||||||
{
|
|
||||||
icon = _icon;
|
icon = _icon;
|
||||||
level = _level;
|
level = _level;
|
||||||
}
|
}
|
||||||
@ -42,15 +37,13 @@ namespace Gala
|
|||||||
static MediaFeedback? instance = null;
|
static MediaFeedback? instance = null;
|
||||||
static ThreadPool<Feedback>? pool = null;
|
static ThreadPool<Feedback>? pool = null;
|
||||||
|
|
||||||
public static void init ()
|
public static void init () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new MediaFeedback ();
|
instance = new MediaFeedback ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void send (string icon, int val)
|
public static void send (string icon, int val)
|
||||||
requires (instance != null && pool != null)
|
requires (instance != null && pool != null) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
pool.add (new Feedback (icon, val));
|
pool.add (new Feedback (icon, val));
|
||||||
} catch (ThreadError e) {
|
} catch (ThreadError e) {
|
||||||
@ -62,13 +55,11 @@ namespace Gala
|
|||||||
uint dbus_name_owner_changed_signal_id = 0;
|
uint dbus_name_owner_changed_signal_id = 0;
|
||||||
uint32 notification_id = 0;
|
uint32 notification_id = 0;
|
||||||
|
|
||||||
MediaFeedback ()
|
MediaFeedback () {
|
||||||
{
|
|
||||||
Object ();
|
Object ();
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
pool = new ThreadPool<Feedback>.with_owned_data ((ThreadPoolFunc<Feedback>) send_feedback, 1, false);
|
pool = new ThreadPool<Feedback>.with_owned_data ((ThreadPoolFunc<Feedback>) send_feedback, 1, false);
|
||||||
} catch (ThreadError e) {
|
} catch (ThreadError e) {
|
||||||
@ -86,8 +77,7 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_name_owner_changed (DBusConnection connection, string sender_name, string object_path,
|
void handle_name_owner_changed (DBusConnection connection, string sender_name, string object_path,
|
||||||
string interface_name, string signal_name, Variant parameters)
|
string interface_name, string signal_name, Variant parameters) {
|
||||||
{
|
|
||||||
string name, before, after;
|
string name, before, after;
|
||||||
parameters.get ("(sss)", out name, out before, out after);
|
parameters.get ("(sss)", out name, out before, out after);
|
||||||
|
|
||||||
@ -113,8 +103,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void send_feedback (owned Feedback feedback)
|
void send_feedback (owned Feedback feedback) {
|
||||||
{
|
|
||||||
var hints = new GLib.HashTable<string, Variant> (null, null);
|
var hints = new GLib.HashTable<string, Variant> (null, null);
|
||||||
hints.set ("x-canonical-private-synchronous", new Variant.string ("gala-feedback"));
|
hints.set ("x-canonical-private-synchronous", new Variant.string ("gala-feedback"));
|
||||||
hints.set ("value", new Variant.int32 (feedback.level));
|
hints.set ("value", new Variant.int32 (feedback.level));
|
||||||
|
@ -15,15 +15,12 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
delegate PluginInfo RegisterPluginFunction ();
|
delegate PluginInfo RegisterPluginFunction ();
|
||||||
|
|
||||||
public class PluginManager : Object
|
public class PluginManager : Object {
|
||||||
{
|
|
||||||
static PluginManager? instance = null;
|
static PluginManager? instance = null;
|
||||||
public static unowned PluginManager get_default ()
|
public static unowned PluginManager get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new PluginManager ();
|
instance = new PluginManager ();
|
||||||
|
|
||||||
@ -48,8 +45,7 @@ namespace Gala
|
|||||||
|
|
||||||
Gee.LinkedList<PluginInfo?> load_later_plugins;
|
Gee.LinkedList<PluginInfo?> load_later_plugins;
|
||||||
|
|
||||||
PluginManager ()
|
PluginManager () {
|
||||||
{
|
|
||||||
plugins = new HashTable<string,Plugin> (str_hash, str_equal);
|
plugins = new HashTable<string,Plugin> (str_hash, str_equal);
|
||||||
load_later_plugins = new Gee.LinkedList<PluginInfo?> ();
|
load_later_plugins = new Gee.LinkedList<PluginInfo?> ();
|
||||||
|
|
||||||
@ -85,8 +81,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load_module (string plugin_name)
|
bool load_module (string plugin_name) {
|
||||||
{
|
|
||||||
var path = Module.build_path (plugin_dir.get_path (), plugin_name);
|
var path = Module.build_path (plugin_dir.get_path (), plugin_name);
|
||||||
var module = Module.open (path, ModuleFlags.BIND_LOCAL);
|
var module = Module.open (path, ModuleFlags.BIND_LOCAL);
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
@ -124,8 +119,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_plugin_class (PluginInfo info)
|
void load_plugin_class (PluginInfo info) {
|
||||||
{
|
|
||||||
var plugin = (Plugin)Object.@new (info.plugin_type);
|
var plugin = (Plugin)Object.@new (info.plugin_type);
|
||||||
plugins.set (info.module_name, plugin);
|
plugins.set (info.module_name, plugin);
|
||||||
|
|
||||||
@ -137,14 +131,12 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize_plugin (string plugin_name, Plugin plugin)
|
void initialize_plugin (string plugin_name, Plugin plugin) {
|
||||||
{
|
|
||||||
plugin.initialize (wm);
|
plugin.initialize (wm);
|
||||||
plugin.region_changed.connect (recalculate_regions);
|
plugin.region_changed.connect (recalculate_regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_provides (string name, PluginFunction provides)
|
bool check_provides (string name, PluginFunction provides) {
|
||||||
{
|
|
||||||
var message = "Plugins %s and %s both provide %s functionality, using first one only";
|
var message = "Plugins %s and %s both provide %s functionality, using first one only";
|
||||||
switch (provides) {
|
switch (provides) {
|
||||||
case PluginFunction.WORKSPACE_VIEW:
|
case PluginFunction.WORKSPACE_VIEW:
|
||||||
@ -180,8 +172,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize (WindowManager _wm)
|
public void initialize (WindowManager _wm) {
|
||||||
{
|
|
||||||
wm = _wm;
|
wm = _wm;
|
||||||
|
|
||||||
plugins.@foreach (initialize_plugin);
|
plugins.@foreach (initialize_plugin);
|
||||||
@ -190,8 +181,7 @@ namespace Gala
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load_waiting_plugins ()
|
public void load_waiting_plugins () {
|
||||||
{
|
|
||||||
foreach (var info in load_later_plugins) {
|
foreach (var info in load_later_plugins) {
|
||||||
load_plugin_class (info);
|
load_plugin_class (info);
|
||||||
}
|
}
|
||||||
@ -199,8 +189,7 @@ namespace Gala
|
|||||||
load_later_plugins.clear ();
|
load_later_plugins.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plugin? get_plugin (string id)
|
public Plugin? get_plugin (string id) {
|
||||||
{
|
|
||||||
return plugins.lookup (id);
|
return plugins.lookup (id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,8 +197,7 @@ namespace Gala
|
|||||||
* Iterate over all plugins and grab their regions, update the regions
|
* Iterate over all plugins and grab their regions, update the regions
|
||||||
* array accordingly and emit the regions_changed signal.
|
* array accordingly and emit the regions_changed signal.
|
||||||
*/
|
*/
|
||||||
void recalculate_regions ()
|
void recalculate_regions () {
|
||||||
{
|
|
||||||
X.Xrectangle[] regions = {};
|
X.Xrectangle[] regions = {};
|
||||||
|
|
||||||
plugins.@foreach ((name, plugin) => {
|
plugins.@foreach ((name, plugin) => {
|
||||||
|
@ -15,13 +15,10 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
[DBus (name = "org.gnome.ScreenSaver")]
|
[DBus (name = "org.gnome.ScreenSaver")]
|
||||||
public interface ScreenSaver : GLib.Object
|
public interface ScreenSaver : GLib.Object {
|
||||||
{
|
|
||||||
public abstract bool get_active () throws DBusError, IOError;
|
public abstract bool get_active () throws DBusError, IOError;
|
||||||
public signal void active_changed (bool active);
|
public signal void active_changed (bool active);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,19 +15,16 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
const string EXTENSION = ".png";
|
const string EXTENSION = ".png";
|
||||||
const int UNCONCEAL_TEXT_TIMEOUT = 2000;
|
const int UNCONCEAL_TEXT_TIMEOUT = 2000;
|
||||||
|
|
||||||
[DBus (name="org.gnome.Shell.Screenshot")]
|
[DBus (name="org.gnome.Shell.Screenshot")]
|
||||||
public class ScreenshotManager : Object
|
public class ScreenshotManager : Object {
|
||||||
{
|
|
||||||
static ScreenshotManager? instance;
|
static ScreenshotManager? instance;
|
||||||
|
|
||||||
[DBus (visible = false)]
|
[DBus (visible = false)]
|
||||||
public static unowned ScreenshotManager init (WindowManager wm)
|
public static unowned ScreenshotManager init (WindowManager wm) {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new ScreenshotManager (wm);
|
instance = new ScreenshotManager (wm);
|
||||||
|
|
||||||
@ -46,13 +43,11 @@ namespace Gala
|
|||||||
desktop_settings = new Settings ("org.gnome.desktop.interface");
|
desktop_settings = new Settings ("org.gnome.desktop.interface");
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenshotManager (WindowManager _wm)
|
ScreenshotManager (WindowManager _wm) {
|
||||||
{
|
|
||||||
wm = _wm;
|
wm = _wm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flash_area (int x, int y, int width, int height) throws DBusError, IOError
|
public void flash_area (int x, int y, int width, int height) throws DBusError, IOError {
|
||||||
{
|
|
||||||
debug ("Flashing area");
|
debug ("Flashing area");
|
||||||
|
|
||||||
double[] keyframes = { 0.3f, 0.8f };
|
double[] keyframes = { 0.3f, 0.8f };
|
||||||
@ -80,8 +75,7 @@ namespace Gala
|
|||||||
flash_actor.add_transition ("flash", transition);
|
flash_actor.add_transition ("flash", transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void screenshot (bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
|
public async void screenshot (bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError {
|
||||||
{
|
|
||||||
debug ("Taking screenshot");
|
debug ("Taking screenshot");
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
@ -101,13 +95,11 @@ namespace Gala
|
|||||||
success = yield save_image (image, filename, out filename_used);
|
success = yield save_image (image, filename, out filename_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void screenshot_area (int x, int y, int width, int height, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
|
public async void screenshot_area (int x, int y, int width, int height, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError {
|
||||||
{
|
|
||||||
yield screenshot_area_with_cursor (x, y, width, height, false, flash, filename, out success, out filename_used);
|
yield screenshot_area_with_cursor (x, y, width, height, false, flash, filename, out success, out filename_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void screenshot_area_with_cursor (int x, int y, int width, int height, bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
|
public async void screenshot_area_with_cursor (int x, int y, int width, int height, bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError {
|
||||||
{
|
|
||||||
debug ("Taking area screenshot");
|
debug ("Taking area screenshot");
|
||||||
|
|
||||||
yield wait_stage_repaint ();
|
yield wait_stage_repaint ();
|
||||||
@ -124,8 +116,7 @@ namespace Gala
|
|||||||
throw new DBusError.FAILED ("Failed to save image");
|
throw new DBusError.FAILED ("Failed to save image");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void screenshot_window (bool include_frame, bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError
|
public async void screenshot_window (bool include_frame, bool include_cursor, bool flash, string filename, out bool success, out string filename_used) throws DBusError, IOError {
|
||||||
{
|
|
||||||
debug ("Taking window screenshot");
|
debug ("Taking window screenshot");
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -165,8 +156,7 @@ namespace Gala
|
|||||||
success = yield save_image (image, filename, out filename_used);
|
success = yield save_image (image, filename, out filename_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void select_area (out int x, out int y, out int width, out int height) throws DBusError, IOError
|
public async void select_area (out int x, out int y, out int width, out int height) throws DBusError, IOError {
|
||||||
{
|
|
||||||
var selection_area = new SelectionArea (wm);
|
var selection_area = new SelectionArea (wm);
|
||||||
selection_area.closed.connect (() => Idle.add (select_area.callback));
|
selection_area.closed.connect (() => Idle.add (select_area.callback));
|
||||||
wm.ui_group.add (selection_area);
|
wm.ui_group.add (selection_area);
|
||||||
@ -183,8 +173,7 @@ namespace Gala
|
|||||||
selection_area.get_selection_rectangle (out x, out y, out width, out height);
|
selection_area.get_selection_rectangle (out x, out y, out width, out height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unconceal_text ()
|
private void unconceal_text () {
|
||||||
{
|
|
||||||
if (conceal_timeout == 0) {
|
if (conceal_timeout == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -197,8 +186,7 @@ namespace Gala
|
|||||||
conceal_timeout = 0;
|
conceal_timeout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void conceal_text () throws DBusError, IOError
|
public async void conceal_text () throws DBusError, IOError {
|
||||||
{
|
|
||||||
if (conceal_timeout > 0) {
|
if (conceal_timeout > 0) {
|
||||||
Source.remove (conceal_timeout);
|
Source.remove (conceal_timeout);
|
||||||
} else {
|
} else {
|
||||||
@ -217,8 +205,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static string find_target_path ()
|
static string find_target_path () {
|
||||||
{
|
|
||||||
// Try to create dedicated "Screenshots" subfolder in PICTURES xdg-dir
|
// Try to create dedicated "Screenshots" subfolder in PICTURES xdg-dir
|
||||||
unowned string? base_path = Environment.get_user_special_dir (UserDirectory.PICTURES);
|
unowned string? base_path = Environment.get_user_special_dir (UserDirectory.PICTURES);
|
||||||
if (base_path != null && FileUtils.test (base_path, FileTest.EXISTS)) {
|
if (base_path != null && FileUtils.test (base_path, FileTest.EXISTS)) {
|
||||||
@ -235,8 +222,7 @@ namespace Gala
|
|||||||
return Environment.get_home_dir ();
|
return Environment.get_home_dir ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async bool save_image (Cairo.ImageSurface image, string filename, out string used_filename)
|
static async bool save_image (Cairo.ImageSurface image, string filename, out string used_filename) {
|
||||||
{
|
|
||||||
used_filename = filename;
|
used_filename = filename;
|
||||||
|
|
||||||
// We only alter non absolute filename because absolute
|
// We only alter non absolute filename because absolute
|
||||||
@ -273,8 +259,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cairo.ImageSurface take_screenshot (int x, int y, int width, int height, bool include_cursor)
|
Cairo.ImageSurface take_screenshot (int x, int y, int width, int height, bool include_cursor) {
|
||||||
{
|
|
||||||
Cairo.ImageSurface image;
|
Cairo.ImageSurface image;
|
||||||
Clutter.Capture[] captures;
|
Clutter.Capture[] captures;
|
||||||
wm.stage.capture (false, {x, y, width, height}, out captures);
|
wm.stage.capture (false, {x, y, width, height}, out captures);
|
||||||
@ -294,8 +279,7 @@ namespace Gala
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cairo.ImageSurface composite_capture_images (Clutter.Capture[] captures, int x, int y, int width, int height)
|
Cairo.ImageSurface composite_capture_images (Clutter.Capture[] captures, int x, int y, int width, int height) {
|
||||||
{
|
|
||||||
var image = new Cairo.ImageSurface (captures[0].image.get_format (), width, height);
|
var image = new Cairo.ImageSurface (captures[0].image.get_format (), width, height);
|
||||||
var cr = new Cairo.Context (image);
|
var cr = new Cairo.Context (image);
|
||||||
|
|
||||||
@ -316,8 +300,7 @@ namespace Gala
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cairo.ImageSurface composite_stage_cursor (Cairo.ImageSurface image, Cairo.RectangleInt image_rect)
|
Cairo.ImageSurface composite_stage_cursor (Cairo.ImageSurface image, Cairo.RectangleInt image_rect) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.CursorTracker cursor_tracker = wm.get_display ().get_cursor_tracker ();
|
unowned Meta.CursorTracker cursor_tracker = wm.get_display ().get_cursor_tracker ();
|
||||||
#else
|
#else
|
||||||
@ -358,8 +341,7 @@ namespace Gala
|
|||||||
return (Cairo.ImageSurface)cr.get_target ();
|
return (Cairo.ImageSurface)cr.get_target ();
|
||||||
}
|
}
|
||||||
|
|
||||||
async void wait_stage_repaint ()
|
async void wait_stage_repaint () {
|
||||||
{
|
|
||||||
ulong signal_id = 0UL;
|
ulong signal_id = 0UL;
|
||||||
signal_id = wm.stage.paint.connect_after (() => {
|
signal_id = wm.stage.paint.connect_after (() => {
|
||||||
wm.stage.disconnect (signal_id);
|
wm.stage.disconnect (signal_id);
|
||||||
|
@ -18,11 +18,9 @@
|
|||||||
// Reference code by the Solus Project:
|
// Reference code by the Solus Project:
|
||||||
// https://github.com/solus-project/budgie-desktop/blob/master/src/wm/shim.vala
|
// https://github.com/solus-project/budgie-desktop/blob/master/src/wm/shim.vala
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
[DBus (name = "io.elementary.wingpanel.session.EndSessionDialog")]
|
[DBus (name = "io.elementary.wingpanel.session.EndSessionDialog")]
|
||||||
public interface WingpanelEndSessionDialog : Object
|
public interface WingpanelEndSessionDialog : Object {
|
||||||
{
|
|
||||||
public signal void confirmed_logout ();
|
public signal void confirmed_logout ();
|
||||||
public signal void confirmed_reboot ();
|
public signal void confirmed_reboot ();
|
||||||
public signal void confirmed_shutdown ();
|
public signal void confirmed_shutdown ();
|
||||||
@ -33,13 +31,11 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DBus (name = "org.gnome.SessionManager.EndSessionDialog")]
|
[DBus (name = "org.gnome.SessionManager.EndSessionDialog")]
|
||||||
public class SessionManager : Object
|
public class SessionManager : Object {
|
||||||
{
|
|
||||||
static SessionManager? instance;
|
static SessionManager? instance;
|
||||||
|
|
||||||
[DBus (visible = false)]
|
[DBus (visible = false)]
|
||||||
public static unowned SessionManager init ()
|
public static unowned SessionManager init () {
|
||||||
{
|
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new SessionManager ();
|
instance = new SessionManager ();
|
||||||
}
|
}
|
||||||
@ -55,14 +51,12 @@ namespace Gala
|
|||||||
|
|
||||||
WingpanelEndSessionDialog? proxy = null;
|
WingpanelEndSessionDialog? proxy = null;
|
||||||
|
|
||||||
SessionManager ()
|
SessionManager () {
|
||||||
{
|
|
||||||
Bus.watch_name (BusType.SESSION, "io.elementary.wingpanel.session.EndSessionDialog",
|
Bus.watch_name (BusType.SESSION, "io.elementary.wingpanel.session.EndSessionDialog",
|
||||||
BusNameWatcherFlags.NONE, proxy_appeared, proxy_vanished);
|
BusNameWatcherFlags.NONE, proxy_appeared, proxy_vanished);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_proxy_cb (Object? o, AsyncResult? res)
|
void get_proxy_cb (Object? o, AsyncResult? res) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
proxy = Bus.get_proxy.end (res);
|
proxy = Bus.get_proxy.end (res);
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
@ -77,20 +71,17 @@ namespace Gala
|
|||||||
proxy.closed.connect (() => closed ());
|
proxy.closed.connect (() => closed ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void proxy_appeared ()
|
void proxy_appeared () {
|
||||||
{
|
|
||||||
Bus.get_proxy.begin<WingpanelEndSessionDialog> (BusType.SESSION,
|
Bus.get_proxy.begin<WingpanelEndSessionDialog> (BusType.SESSION,
|
||||||
"io.elementary.wingpanel.session.EndSessionDialog", "/io/elementary/wingpanel/session/EndSessionDialog",
|
"io.elementary.wingpanel.session.EndSessionDialog", "/io/elementary/wingpanel/session/EndSessionDialog",
|
||||||
0, null, get_proxy_cb);
|
0, null, get_proxy_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void proxy_vanished ()
|
void proxy_vanished () {
|
||||||
{
|
|
||||||
proxy = null;
|
proxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open (uint type, uint timestamp, uint open_length, ObjectPath[] inhibiters) throws DBusError, IOError
|
public void open (uint type, uint timestamp, uint open_length, ObjectPath[] inhibiters) throws DBusError, IOError {
|
||||||
{
|
|
||||||
if (proxy == null) {
|
if (proxy == null) {
|
||||||
throw new DBusError.FAILED ("io.elementary.wingpanel.session.EndSessionDialog DBus interface is not registered.");
|
throw new DBusError.FAILED ("io.elementary.wingpanel.session.EndSessionDialog DBus interface is not registered.");
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class BehaviorSettings : Granite.Services.Settings {
|
||||||
public class BehaviorSettings : Granite.Services.Settings
|
|
||||||
{
|
|
||||||
public bool dynamic_workspaces { get; set; }
|
public bool dynamic_workspaces { get; set; }
|
||||||
public bool edge_tiling { get; set; }
|
public bool edge_tiling { get; set; }
|
||||||
public string panel_main_menu_action { get; set; }
|
public string panel_main_menu_action { get; set; }
|
||||||
@ -37,13 +35,11 @@ namespace Gala
|
|||||||
|
|
||||||
static BehaviorSettings? instance = null;
|
static BehaviorSettings? instance = null;
|
||||||
|
|
||||||
private BehaviorSettings ()
|
private BehaviorSettings () {
|
||||||
{
|
|
||||||
base (Config.SCHEMA + ".behavior");
|
base (Config.SCHEMA + ".behavior");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned BehaviorSettings get_default ()
|
public static unowned BehaviorSettings get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new BehaviorSettings ();
|
instance = new BehaviorSettings ();
|
||||||
|
|
||||||
@ -51,17 +47,14 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KeybindingSettings : Granite.Services.Settings
|
public class KeybindingSettings : Granite.Services.Settings {
|
||||||
{
|
|
||||||
static KeybindingSettings? instance = null;
|
static KeybindingSettings? instance = null;
|
||||||
|
|
||||||
private KeybindingSettings ()
|
private KeybindingSettings () {
|
||||||
{
|
|
||||||
base (Config.SCHEMA + ".keybindings");
|
base (Config.SCHEMA + ".keybindings");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned KeybindingSettings get_default ()
|
public static unowned KeybindingSettings get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new KeybindingSettings ();
|
instance = new KeybindingSettings ();
|
||||||
|
|
||||||
@ -69,8 +62,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AppearanceSettings : Granite.Services.Settings
|
public class AppearanceSettings : Granite.Services.Settings {
|
||||||
{
|
|
||||||
public string button_layout { get; set; }
|
public string button_layout { get; set; }
|
||||||
public bool attach_modal_dialogs { get; set; }
|
public bool attach_modal_dialogs { get; set; }
|
||||||
public bool dim_parents { get; set; }
|
public bool dim_parents { get; set; }
|
||||||
@ -78,13 +70,11 @@ namespace Gala
|
|||||||
|
|
||||||
static AppearanceSettings? instance = null;
|
static AppearanceSettings? instance = null;
|
||||||
|
|
||||||
private AppearanceSettings ()
|
private AppearanceSettings () {
|
||||||
{
|
|
||||||
base (Config.SCHEMA + ".appearance");
|
base (Config.SCHEMA + ".appearance");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned AppearanceSettings get_default ()
|
public static unowned AppearanceSettings get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new AppearanceSettings ();
|
instance = new AppearanceSettings ();
|
||||||
|
|
||||||
@ -92,8 +82,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShadowSettings : Granite.Services.Settings
|
public class ShadowSettings : Granite.Services.Settings {
|
||||||
{
|
|
||||||
public string[] menu { get; set; }
|
public string[] menu { get; set; }
|
||||||
public string[] normal_focused { get; set; }
|
public string[] normal_focused { get; set; }
|
||||||
public string[] normal_unfocused { get; set; }
|
public string[] normal_unfocused { get; set; }
|
||||||
@ -102,21 +91,18 @@ namespace Gala
|
|||||||
|
|
||||||
static ShadowSettings? instance = null;
|
static ShadowSettings? instance = null;
|
||||||
|
|
||||||
private ShadowSettings ()
|
private ShadowSettings () {
|
||||||
{
|
|
||||||
base (Config.SCHEMA + ".shadows");
|
base (Config.SCHEMA + ".shadows");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned ShadowSettings get_default ()
|
public static unowned ShadowSettings get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new ShadowSettings ();
|
instance = new ShadowSettings ();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Meta.ShadowParams get_shadowparams (string class_name)
|
public Meta.ShadowParams get_shadowparams (string class_name) {
|
||||||
{
|
|
||||||
string[] val;
|
string[] val;
|
||||||
get (class_name, out val);
|
get (class_name, out val);
|
||||||
|
|
||||||
@ -128,8 +114,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BackgroundSettings : Granite.Services.Settings
|
public class BackgroundSettings : Granite.Services.Settings {
|
||||||
{
|
|
||||||
public string picture_options { get; set; }
|
public string picture_options { get; set; }
|
||||||
public string picture_uri { get; set; }
|
public string picture_uri { get; set; }
|
||||||
public int picture_opacity { get; set; }
|
public int picture_opacity { get; set; }
|
||||||
@ -139,13 +124,11 @@ namespace Gala
|
|||||||
|
|
||||||
static BackgroundSettings? instance = null;
|
static BackgroundSettings? instance = null;
|
||||||
|
|
||||||
private BackgroundSettings ()
|
private BackgroundSettings () {
|
||||||
{
|
|
||||||
base ("org.gnome.desktop.background");
|
base ("org.gnome.desktop.background");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned BackgroundSettings get_default ()
|
public static unowned BackgroundSettings get_default () {
|
||||||
{
|
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
instance = new BackgroundSettings ();
|
instance = new BackgroundSettings ();
|
||||||
|
|
||||||
|
@ -17,17 +17,13 @@
|
|||||||
|
|
||||||
using Clutter;
|
using Clutter;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class ShadowEffect : Effect {
|
||||||
public class ShadowEffect : Effect
|
private class Shadow {
|
||||||
{
|
|
||||||
private class Shadow
|
|
||||||
{
|
|
||||||
public int users;
|
public int users;
|
||||||
public Cogl.Texture texture;
|
public Cogl.Texture texture;
|
||||||
|
|
||||||
public Shadow (Cogl.Texture _texture)
|
public Shadow (Cogl.Texture _texture) {
|
||||||
{
|
|
||||||
texture = _texture;
|
texture = _texture;
|
||||||
users = 1;
|
users = 1;
|
||||||
}
|
}
|
||||||
@ -38,8 +34,7 @@ namespace Gala
|
|||||||
static Gee.HashMap<string,Shadow> shadow_cache;
|
static Gee.HashMap<string,Shadow> shadow_cache;
|
||||||
static Gtk.StyleContext style_context;
|
static Gtk.StyleContext style_context;
|
||||||
|
|
||||||
class construct
|
class construct {
|
||||||
{
|
|
||||||
shadow_cache = new Gee.HashMap<string,Shadow> ();
|
shadow_cache = new Gee.HashMap<string,Shadow> ();
|
||||||
|
|
||||||
var style_path = new Gtk.WidgetPath ();
|
var style_path = new Gtk.WidgetPath ();
|
||||||
@ -61,24 +56,20 @@ namespace Gala
|
|||||||
Cogl.Material material;
|
Cogl.Material material;
|
||||||
string? current_key = null;
|
string? current_key = null;
|
||||||
|
|
||||||
public ShadowEffect (int shadow_size, int shadow_spread)
|
public ShadowEffect (int shadow_size, int shadow_spread) {
|
||||||
{
|
|
||||||
Object (shadow_size: shadow_size, shadow_spread: shadow_spread);
|
Object (shadow_size: shadow_size, shadow_spread: shadow_spread);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
material = new Cogl.Material ();
|
material = new Cogl.Material ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~ShadowEffect ()
|
~ShadowEffect () {
|
||||||
{
|
|
||||||
if (current_key != null)
|
if (current_key != null)
|
||||||
decrement_shadow_users (current_key);
|
decrement_shadow_users (current_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cogl.Texture? get_shadow (int width, int height, int shadow_size, int shadow_spread)
|
Cogl.Texture? get_shadow (int width, int height, int shadow_size, int shadow_spread) {
|
||||||
{
|
|
||||||
var old_key = current_key;
|
var old_key = current_key;
|
||||||
current_key = "%ix%i:%i:%i".printf (width, height, shadow_size, shadow_spread);
|
current_key = "%ix%i:%i:%i".printf (width, height, shadow_size, shadow_spread);
|
||||||
if (old_key == current_key)
|
if (old_key == current_key)
|
||||||
@ -121,8 +112,7 @@ namespace Gala
|
|||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void decrement_shadow_users (string key)
|
void decrement_shadow_users (string key) {
|
||||||
{
|
|
||||||
var shadow = shadow_cache.@get (key);
|
var shadow = shadow_cache.@get (key);
|
||||||
|
|
||||||
if (shadow == null)
|
if (shadow == null)
|
||||||
@ -132,8 +122,7 @@ namespace Gala
|
|||||||
shadow_cache.unset (key);
|
shadow_cache.unset (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void paint (EffectPaintFlags flags)
|
public override void paint (EffectPaintFlags flags) {
|
||||||
{
|
|
||||||
var bounding_box = get_bounding_box ();
|
var bounding_box = get_bounding_box ();
|
||||||
var width = (int) (bounding_box.x2 - bounding_box.x1);
|
var width = (int) (bounding_box.x2 - bounding_box.x1);
|
||||||
var height = (int) (bounding_box.y2 - bounding_box.y1);
|
var height = (int) (bounding_box.y2 - bounding_box.y1);
|
||||||
@ -154,8 +143,7 @@ namespace Gala
|
|||||||
actor.continue_paint ();
|
actor.continue_paint ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ActorBox get_bounding_box ()
|
public virtual ActorBox get_bounding_box () {
|
||||||
{
|
|
||||||
var size = shadow_size * scale_factor;
|
var size = shadow_size * scale_factor;
|
||||||
var bounding_box = ActorBox ();
|
var bounding_box = ActorBox ();
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class TextShadowEffect : Clutter.Effect {
|
||||||
public class TextShadowEffect : Clutter.Effect
|
|
||||||
{
|
|
||||||
int _offset_y;
|
int _offset_y;
|
||||||
public int offset_y {
|
public int offset_y {
|
||||||
get { return _offset_y; }
|
get { return _offset_y; }
|
||||||
@ -37,23 +35,20 @@ namespace Gala
|
|||||||
set { _opacity = value; update (); }
|
set { _opacity = value; update (); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextShadowEffect (int offset_x, int offset_y, uint8 opacity)
|
public TextShadowEffect (int offset_x, int offset_y, uint8 opacity) {
|
||||||
{
|
|
||||||
_offset_x = offset_x;
|
_offset_x = offset_x;
|
||||||
_offset_y = offset_y;
|
_offset_y = offset_y;
|
||||||
_opacity = opacity;
|
_opacity = opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool pre_paint ()
|
public override bool pre_paint () {
|
||||||
{
|
|
||||||
var layout = ((Clutter.Text)get_actor ()).get_layout ();
|
var layout = ((Clutter.Text)get_actor ()).get_layout ();
|
||||||
Cogl.pango_render_layout (layout, offset_x, offset_y, Cogl.Color.from_4ub (0, 0, 0, opacity), 0);
|
Cogl.pango_render_layout (layout, offset_x, offset_y, Cogl.Color.from_4ub (0, 0, 0, opacity), 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update ()
|
public void update () {
|
||||||
{
|
|
||||||
if (get_actor () != null)
|
if (get_actor () != null)
|
||||||
get_actor ().queue_redraw ();
|
get_actor ().queue_redraw ();
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,13 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Container for WindowIconActors which takes care of the scaling and positioning.
|
* Container for WindowIconActors which takes care of the scaling and positioning.
|
||||||
* It also decides whether to draw the container shape, a plus sign or an ellipsis.
|
* It also decides whether to draw the container shape, a plus sign or an ellipsis.
|
||||||
* Lastly it also includes the drawing code for the active highlight.
|
* Lastly it also includes the drawing code for the active highlight.
|
||||||
*/
|
*/
|
||||||
public class IconGroup : Actor
|
public class IconGroup : Actor {
|
||||||
{
|
|
||||||
public const int SIZE = 64;
|
public const int SIZE = 64;
|
||||||
|
|
||||||
const int PLUS_SIZE = 8;
|
const int PLUS_SIZE = 8;
|
||||||
@ -92,13 +90,11 @@ namespace Gala
|
|||||||
|
|
||||||
uint show_close_button_timeout = 0;
|
uint show_close_button_timeout = 0;
|
||||||
|
|
||||||
public IconGroup (Workspace workspace)
|
public IconGroup (Workspace workspace) {
|
||||||
{
|
|
||||||
Object (workspace: workspace);
|
Object (workspace: workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
var size = SIZE * scale;
|
var size = SIZE * scale;
|
||||||
|
|
||||||
@ -148,19 +144,16 @@ namespace Gala
|
|||||||
icon_container.actor_removed.connect_after (redraw);
|
icon_container.actor_removed.connect_after (redraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
~IconGroup ()
|
~IconGroup () {
|
||||||
{
|
|
||||||
icon_container.actor_removed.disconnect (redraw);
|
icon_container.actor_removed.disconnect (redraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool enter_event (CrossingEvent event)
|
public override bool enter_event (CrossingEvent event) {
|
||||||
{
|
|
||||||
toggle_close_button (true);
|
toggle_close_button (true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool leave_event (CrossingEvent event)
|
public override bool leave_event (CrossingEvent event) {
|
||||||
{
|
|
||||||
if (!contains (event.related))
|
if (!contains (event.related))
|
||||||
toggle_close_button (false);
|
toggle_close_button (false);
|
||||||
|
|
||||||
@ -175,8 +168,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param show Whether to show the close button
|
* @param show Whether to show the close button
|
||||||
*/
|
*/
|
||||||
void toggle_close_button (bool show)
|
void toggle_close_button (bool show) {
|
||||||
{
|
|
||||||
// don't display the close button when we don't have dynamic workspaces
|
// don't display the close button when we don't have dynamic workspaces
|
||||||
// or when there are no windows on us. For one, our method for closing
|
// or when there are no windows on us. For one, our method for closing
|
||||||
// wouldn't work anyway without windows and it's also the last workspace
|
// wouldn't work anyway without windows and it's also the last workspace
|
||||||
@ -212,8 +204,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Override the paint handler to draw our backdrop if necessary
|
* Override the paint handler to draw our backdrop if necessary
|
||||||
*/
|
*/
|
||||||
public override void paint ()
|
public override void paint () {
|
||||||
{
|
|
||||||
if (backdrop_opacity < 1 || drag_action.dragging) {
|
if (backdrop_opacity < 1 || drag_action.dragging) {
|
||||||
base.paint ();
|
base.paint ();
|
||||||
return;
|
return;
|
||||||
@ -247,8 +238,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Remove all currently added WindowIconActors
|
* Remove all currently added WindowIconActors
|
||||||
*/
|
*/
|
||||||
public void clear ()
|
public void clear () {
|
||||||
{
|
|
||||||
icon_container.destroy_all_children ();
|
icon_container.destroy_all_children ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,8 +251,7 @@ namespace Gala
|
|||||||
* @param temporary Mark the WindowIconActor as temporary. Used for windows dragged over
|
* @param temporary Mark the WindowIconActor as temporary. Used for windows dragged over
|
||||||
* the group.
|
* the group.
|
||||||
*/
|
*/
|
||||||
public void add_window (Window window, bool no_redraw = false, bool temporary = false)
|
public void add_window (Window window, bool no_redraw = false, bool temporary = false) {
|
||||||
{
|
|
||||||
var new_window = new WindowIconActor (window);
|
var new_window = new WindowIconActor (window);
|
||||||
|
|
||||||
new_window.save_easing_state ();
|
new_window.save_easing_state ();
|
||||||
@ -282,8 +271,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param animate Whether to fade the icon out before removing it
|
* @param animate Whether to fade the icon out before removing it
|
||||||
*/
|
*/
|
||||||
public void remove_window (Window window, bool animate = true)
|
public void remove_window (Window window, bool animate = true) {
|
||||||
{
|
|
||||||
foreach (var child in icon_container.get_children ()) {
|
foreach (var child in icon_container.get_children ()) {
|
||||||
unowned WindowIconActor w = (WindowIconActor) child;
|
unowned WindowIconActor w = (WindowIconActor) child;
|
||||||
if (w.window == window) {
|
if (w.window == window) {
|
||||||
@ -313,16 +301,14 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Sets a hovered actor for the drag action.
|
* Sets a hovered actor for the drag action.
|
||||||
*/
|
*/
|
||||||
public void set_hovered_actor (Actor actor)
|
public void set_hovered_actor (Actor actor) {
|
||||||
{
|
|
||||||
drag_action.hovered = actor;
|
drag_action.hovered = actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a redraw
|
* Trigger a redraw
|
||||||
*/
|
*/
|
||||||
public void redraw ()
|
public void redraw () {
|
||||||
{
|
|
||||||
content.invalidate ();
|
content.invalidate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,8 +317,7 @@ namespace Gala
|
|||||||
* That way the workspace won't be deleted if windows decide to ignore the
|
* That way the workspace won't be deleted if windows decide to ignore the
|
||||||
* delete signal
|
* delete signal
|
||||||
*/
|
*/
|
||||||
void close ()
|
void close () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var time = workspace.get_display ().get_current_time ();
|
var time = workspace.get_display ().get_current_time ();
|
||||||
#else
|
#else
|
||||||
@ -350,8 +335,7 @@ namespace Gala
|
|||||||
* Draw the background or plus sign and do layouting. We won't lose performance here
|
* Draw the background or plus sign and do layouting. We won't lose performance here
|
||||||
* by relayouting in the same function, as it's only ever called when we invalidate it.
|
* by relayouting in the same function, as it's only ever called when we invalidate it.
|
||||||
*/
|
*/
|
||||||
bool draw (Cairo.Context cr)
|
bool draw (Cairo.Context cr) {
|
||||||
{
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
|
|
||||||
cr.set_operator (Cairo.Operator.CLEAR);
|
cr.set_operator (Cairo.Operator.CLEAR);
|
||||||
@ -526,8 +510,7 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor drag_begin (float click_x, float click_y)
|
Actor drag_begin (float click_x, float click_y) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
||||||
if (icon_container.get_n_children () < 1 &&
|
if (icon_container.get_n_children () < 1 &&
|
||||||
@ -569,11 +552,10 @@ namespace Gala
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drag_end (Actor destination)
|
void drag_end (Actor destination) {
|
||||||
{
|
|
||||||
if (destination is WorkspaceInsertThumb) {
|
if (destination is WorkspaceInsertThumb) {
|
||||||
get_parent ().remove_child (this);
|
get_parent ().remove_child (this);
|
||||||
|
|
||||||
unowned WorkspaceInsertThumb inserter = (WorkspaceInsertThumb) destination;
|
unowned WorkspaceInsertThumb inserter = (WorkspaceInsertThumb) destination;
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
||||||
@ -588,14 +570,12 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drag_canceled ()
|
void drag_canceled () {
|
||||||
{
|
|
||||||
get_parent ().remove_child (this);
|
get_parent ().remove_child (this);
|
||||||
restore_group ();
|
restore_group ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void restore_group ()
|
void restore_group () {
|
||||||
{
|
|
||||||
var container = prev_parent as IconGroupContainer;
|
var container = prev_parent as IconGroupContainer;
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
container.add_group (this);
|
container.add_group (this);
|
||||||
|
@ -18,15 +18,13 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* This class contains the icon groups at the bottom and will take
|
* This class contains the icon groups at the bottom and will take
|
||||||
* care of displaying actors for inserting windows between the groups
|
* care of displaying actors for inserting windows between the groups
|
||||||
* once implemented
|
* once implemented
|
||||||
*/
|
*/
|
||||||
public class IconGroupContainer : Actor
|
public class IconGroupContainer : Actor {
|
||||||
{
|
|
||||||
public const int SPACING = 48;
|
public const int SPACING = 48;
|
||||||
public const int GROUP_WIDTH = 64;
|
public const int GROUP_WIDTH = 64;
|
||||||
|
|
||||||
@ -39,23 +37,20 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public IconGroupContainer (Meta.Display display)
|
public IconGroupContainer (Meta.Display display) {
|
||||||
{
|
|
||||||
Object (display: display);
|
Object (display: display);
|
||||||
|
|
||||||
layout_manager = new BoxLayout ();
|
layout_manager = new BoxLayout ();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public IconGroupContainer (Screen screen)
|
public IconGroupContainer (Screen screen) {
|
||||||
{
|
|
||||||
Object (screen: screen);
|
Object (screen: screen);
|
||||||
|
|
||||||
layout_manager = new BoxLayout ();
|
layout_manager = new BoxLayout ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public void add_group (IconGroup group)
|
public void add_group (IconGroup group) {
|
||||||
{
|
|
||||||
var index = group.workspace.index ();
|
var index = group.workspace.index ();
|
||||||
|
|
||||||
insert_child_at_index (group, index * 2);
|
insert_child_at_index (group, index * 2);
|
||||||
@ -67,8 +62,7 @@ namespace Gala
|
|||||||
update_inserter_indices ();
|
update_inserter_indices ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove_group (IconGroup group)
|
public void remove_group (IconGroup group) {
|
||||||
{
|
|
||||||
var thumb = (WorkspaceInsertThumb) group.get_previous_sibling ();
|
var thumb = (WorkspaceInsertThumb) group.get_previous_sibling ();
|
||||||
thumb.notify["expanded"].disconnect (expanded_changed);
|
thumb.notify["expanded"].disconnect (expanded_changed);
|
||||||
remove_child (thumb);
|
remove_child (thumb);
|
||||||
@ -88,8 +82,7 @@ namespace Gala
|
|||||||
* We don't want that until the IconGroup
|
* We don't want that until the IconGroup
|
||||||
* leaves the expanded WorkspaceInsertThumb.
|
* leaves the expanded WorkspaceInsertThumb.
|
||||||
*/
|
*/
|
||||||
public void remove_group_in_place (IconGroup group)
|
public void remove_group_in_place (IconGroup group) {
|
||||||
{
|
|
||||||
var deleted_thumb = (WorkspaceInsertThumb) group.get_previous_sibling ();
|
var deleted_thumb = (WorkspaceInsertThumb) group.get_previous_sibling ();
|
||||||
var deleted_placeholder_thumb = (WorkspaceInsertThumb) group.get_next_sibling ();
|
var deleted_placeholder_thumb = (WorkspaceInsertThumb) group.get_next_sibling ();
|
||||||
|
|
||||||
@ -108,8 +101,7 @@ namespace Gala
|
|||||||
group.set_hovered_actor (deleted_placeholder_thumb);
|
group.set_hovered_actor (deleted_placeholder_thumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset_thumbs (int delay)
|
public void reset_thumbs (int delay) {
|
||||||
{
|
|
||||||
foreach (var child in get_children ()) {
|
foreach (var child in get_children ()) {
|
||||||
unowned WorkspaceInsertThumb thumb = child as WorkspaceInsertThumb;
|
unowned WorkspaceInsertThumb thumb = child as WorkspaceInsertThumb;
|
||||||
if (thumb != null) {
|
if (thumb != null) {
|
||||||
@ -119,8 +111,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void expanded_changed (ParamSpec param)
|
void expanded_changed (ParamSpec param) {
|
||||||
{
|
|
||||||
request_reposition (true);
|
request_reposition (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,8 +119,7 @@ namespace Gala
|
|||||||
* Calculates the width that will be occupied taking currently running animations
|
* Calculates the width that will be occupied taking currently running animations
|
||||||
* end states into account
|
* end states into account
|
||||||
*/
|
*/
|
||||||
public float calculate_total_width ()
|
public float calculate_total_width () {
|
||||||
{
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
var spacing = SPACING * scale;
|
var spacing = SPACING * scale;
|
||||||
var group_width = GROUP_WIDTH * scale;
|
var group_width = GROUP_WIDTH * scale;
|
||||||
@ -150,8 +140,7 @@ namespace Gala
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_inserter_indices ()
|
void update_inserter_indices () {
|
||||||
{
|
|
||||||
var current_index = 0;
|
var current_index = 0;
|
||||||
|
|
||||||
foreach (var child in get_children ()) {
|
foreach (var child in get_children ()) {
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* More or less utility class to contain a WindowCloneContainer for each
|
* More or less utility class to contain a WindowCloneContainer for each
|
||||||
* non-primary monitor. It's the pendant to the WorkspaceClone which is
|
* non-primary monitor. It's the pendant to the WorkspaceClone which is
|
||||||
@ -27,8 +26,7 @@ namespace Gala
|
|||||||
* as the WindowGroup is hidden while the view is active. Only used when
|
* as the WindowGroup is hidden while the view is active. Only used when
|
||||||
* workspaces-only-on-primary is set to true.
|
* workspaces-only-on-primary is set to true.
|
||||||
*/
|
*/
|
||||||
public class MonitorClone : Actor
|
public class MonitorClone : Actor {
|
||||||
{
|
|
||||||
public signal void window_selected (Window window);
|
public signal void window_selected (Window window);
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -42,19 +40,16 @@ namespace Gala
|
|||||||
BackgroundManager background;
|
BackgroundManager background;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public MonitorClone (Meta.Display display, int monitor)
|
public MonitorClone (Meta.Display display, int monitor) {
|
||||||
{
|
|
||||||
Object (display: display, monitor: monitor);
|
Object (display: display, monitor: monitor);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public MonitorClone (Screen screen, int monitor)
|
public MonitorClone (Screen screen, int monitor) {
|
||||||
{
|
|
||||||
Object (screen: screen, monitor: monitor);
|
Object (screen: screen, monitor: monitor);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
reactive = true;
|
reactive = true;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -102,8 +97,7 @@ namespace Gala
|
|||||||
update_allocation ();
|
update_allocation ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~MonitorClone ()
|
~MonitorClone () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
display.window_entered_monitor.disconnect (window_entered);
|
display.window_entered_monitor.disconnect (window_entered);
|
||||||
display.window_left_monitor.disconnect (window_left);
|
display.window_left_monitor.disconnect (window_left);
|
||||||
@ -118,8 +112,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Make sure the MonitorClone is at the location of the monitor on the stage
|
* Make sure the MonitorClone is at the location of the monitor on the stage
|
||||||
*/
|
*/
|
||||||
public void update_allocation ()
|
public void update_allocation () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var monitor_geometry = display.get_monitor_geometry (monitor);
|
var monitor_geometry = display.get_monitor_geometry (monitor);
|
||||||
#else
|
#else
|
||||||
@ -134,8 +127,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Animate the windows from their old location to a tiled layout
|
* Animate the windows from their old location to a tiled layout
|
||||||
*/
|
*/
|
||||||
public void open ()
|
public void open () {
|
||||||
{
|
|
||||||
window_container.open ();
|
window_container.open ();
|
||||||
// background.opacity = 0; TODO consider this option
|
// background.opacity = 0; TODO consider this option
|
||||||
}
|
}
|
||||||
@ -143,22 +135,19 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Animate the windows back to their old location
|
* Animate the windows back to their old location
|
||||||
*/
|
*/
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
window_container.close ();
|
window_container.close ();
|
||||||
background.opacity = 255;
|
background.opacity = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_left (int window_monitor, Window window)
|
void window_left (int window_monitor, Window window) {
|
||||||
{
|
|
||||||
if (window_monitor != monitor)
|
if (window_monitor != monitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window_container.remove_window (window);
|
window_container.remove_window (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_entered (int window_monitor, Window window)
|
void window_entered (int window_monitor, Window window) {
|
||||||
{
|
|
||||||
if (window_monitor != monitor || window.window_type != WindowType.NORMAL)
|
if (window_monitor != monitor || window.window_type != WindowType.NORMAL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -18,15 +18,13 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* The central class for the MultitaskingView which takes care of
|
* The central class for the MultitaskingView which takes care of
|
||||||
* preparing the wm, opening the components and holds containers for
|
* preparing the wm, opening the components and holds containers for
|
||||||
* the icon groups, the WorkspaceClones and the MonitorClones.
|
* the icon groups, the WorkspaceClones and the MonitorClones.
|
||||||
*/
|
*/
|
||||||
public class MultitaskingView : Actor, ActivatableComponent
|
public class MultitaskingView : Actor, ActivatableComponent {
|
||||||
{
|
|
||||||
public const int ANIMATION_DURATION = 250;
|
public const int ANIMATION_DURATION = 250;
|
||||||
public const AnimationMode ANIMATION_MODE = AnimationMode.EASE_OUT_QUAD;
|
public const AnimationMode ANIMATION_MODE = AnimationMode.EASE_OUT_QUAD;
|
||||||
const int SMOOTH_SCROLL_DELAY = 500;
|
const int SMOOTH_SCROLL_DELAY = 500;
|
||||||
@ -50,13 +48,11 @@ namespace Gala
|
|||||||
Actor workspaces;
|
Actor workspaces;
|
||||||
Actor dock_clones;
|
Actor dock_clones;
|
||||||
|
|
||||||
public MultitaskingView (WindowManager wm)
|
public MultitaskingView (WindowManager wm) {
|
||||||
{
|
|
||||||
Object (wm: wm);
|
Object (wm: wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
visible = false;
|
visible = false;
|
||||||
reactive = true;
|
reactive = true;
|
||||||
clip_to_allocation = true;
|
clip_to_allocation = true;
|
||||||
@ -174,8 +170,7 @@ namespace Gala
|
|||||||
* Places the primary container for the WorkspaceClones and the
|
* Places the primary container for the WorkspaceClones and the
|
||||||
* MonitorClones at the right positions
|
* MonitorClones at the right positions
|
||||||
*/
|
*/
|
||||||
void update_monitors ()
|
void update_monitors () {
|
||||||
{
|
|
||||||
foreach (var monitor_clone in window_containers_monitors)
|
foreach (var monitor_clone in window_containers_monitors)
|
||||||
monitor_clone.destroy ();
|
monitor_clone.destroy ();
|
||||||
|
|
||||||
@ -225,8 +220,7 @@ namespace Gala
|
|||||||
* We generally assume that when the key-focus-out signal is emitted
|
* We generally assume that when the key-focus-out signal is emitted
|
||||||
* a different component was opened, so we close in that case.
|
* a different component was opened, so we close in that case.
|
||||||
*/
|
*/
|
||||||
public override void key_focus_out ()
|
public override void key_focus_out () {
|
||||||
{
|
|
||||||
if (opened && !contains (get_stage ().key_focus))
|
if (opened && !contains (get_stage ().key_focus))
|
||||||
toggle ();
|
toggle ();
|
||||||
}
|
}
|
||||||
@ -234,8 +228,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Scroll through workspaces
|
* Scroll through workspaces
|
||||||
*/
|
*/
|
||||||
public override bool scroll_event (ScrollEvent scroll_event)
|
public override bool scroll_event (ScrollEvent scroll_event) {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -302,8 +295,7 @@ namespace Gala
|
|||||||
* @param animate Whether to animate the movement or have all elements take their
|
* @param animate Whether to animate the movement or have all elements take their
|
||||||
* positions immediately.
|
* positions immediately.
|
||||||
*/
|
*/
|
||||||
void update_positions (bool animate)
|
void update_positions (bool animate) {
|
||||||
{
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
@ -337,8 +329,7 @@ namespace Gala
|
|||||||
reposition_icon_groups (animate);
|
reposition_icon_groups (animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reposition_icon_groups (bool animate)
|
void reposition_icon_groups (bool animate) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
var active_index = manager.get_active_workspace ().index ();
|
var active_index = manager.get_active_workspace ().index ();
|
||||||
@ -365,8 +356,7 @@ namespace Gala
|
|||||||
icon_groups.restore_easing_state ();
|
icon_groups.restore_easing_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_workspace (int num)
|
void add_workspace (int num) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num));
|
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num));
|
||||||
@ -385,8 +375,7 @@ namespace Gala
|
|||||||
workspace.open ();
|
workspace.open ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_workspace (int num)
|
void remove_workspace (int num) {
|
||||||
{
|
|
||||||
WorkspaceClone? workspace = null;
|
WorkspaceClone? workspace = null;
|
||||||
|
|
||||||
// FIXME is there a better way to get the removed workspace?
|
// FIXME is there a better way to get the removed workspace?
|
||||||
@ -431,8 +420,7 @@ namespace Gala
|
|||||||
* Otherwise it will only be made active, but the view won't be
|
* Otherwise it will only be made active, but the view won't be
|
||||||
* closed.
|
* closed.
|
||||||
*/
|
*/
|
||||||
void activate_workspace (WorkspaceClone clone, bool close_view)
|
void activate_workspace (WorkspaceClone clone, bool close_view) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
close_view = close_view && manager.get_active_workspace () == clone.workspace;
|
close_view = close_view && manager.get_active_workspace () == clone.workspace;
|
||||||
@ -452,8 +440,7 @@ namespace Gala
|
|||||||
* Collect key events, mainly for redirecting them to the WindowCloneContainers to
|
* Collect key events, mainly for redirecting them to the WindowCloneContainers to
|
||||||
* select the active window.
|
* select the active window.
|
||||||
*/
|
*/
|
||||||
public override bool key_press_event (Clutter.KeyEvent event)
|
public override bool key_press_event (Clutter.KeyEvent event) {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -491,8 +478,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param direction The direction in which to move the focus to
|
* @param direction The direction in which to move the focus to
|
||||||
*/
|
*/
|
||||||
void select_window (MotionDirection direction)
|
void select_window (MotionDirection direction) {
|
||||||
{
|
|
||||||
get_active_workspace_clone ().window_container.select_next_window (direction);
|
get_active_workspace_clone ().window_container.select_next_window (direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,8 +487,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @return The active WorkspaceClone
|
* @return The active WorkspaceClone
|
||||||
*/
|
*/
|
||||||
WorkspaceClone get_active_workspace_clone ()
|
WorkspaceClone get_active_workspace_clone () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
foreach (var child in workspaces.get_children ()) {
|
foreach (var child in workspaces.get_children ()) {
|
||||||
@ -523,8 +508,7 @@ namespace Gala
|
|||||||
assert_not_reached ();
|
assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_selected (Meta.Window window)
|
void window_selected (Meta.Window window) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var time = display.get_current_time ();
|
var time = display.get_current_time ();
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
@ -552,16 +536,14 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public bool is_opened ()
|
public bool is_opened () {
|
||||||
{
|
|
||||||
return opened;
|
return opened;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void open (HashTable<string,Variant>? hints = null)
|
public void open (HashTable<string,Variant>? hints = null) {
|
||||||
{
|
|
||||||
if (opened)
|
if (opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -571,8 +553,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -584,8 +565,7 @@ namespace Gala
|
|||||||
* starting the modal mode and hiding the WindowGroup. Finally tells all components
|
* starting the modal mode and hiding the WindowGroup. Finally tells all components
|
||||||
* to animate to their positions.
|
* to animate to their positions.
|
||||||
*/
|
*/
|
||||||
void toggle ()
|
void toggle () {
|
||||||
{
|
|
||||||
if (animating)
|
if (animating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -738,8 +718,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keybinding_filter (KeyBinding binding)
|
bool keybinding_filter (KeyBinding binding) {
|
||||||
{
|
|
||||||
var action = Prefs.get_keybinding_action (binding.get_name ());
|
var action = Prefs.get_keybinding_action (binding.get_name ());
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case KeyBindingAction.WORKSPACE_LEFT:
|
case KeyBindingAction.WORKSPACE_LEFT:
|
||||||
|
@ -17,15 +17,13 @@
|
|||||||
|
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* A clone for a MetaWindowActor that will guard against the
|
* A clone for a MetaWindowActor that will guard against the
|
||||||
* meta_window_appears_focused crash by disabling painting the clone
|
* meta_window_appears_focused crash by disabling painting the clone
|
||||||
* as soon as it gets unavailable.
|
* as soon as it gets unavailable.
|
||||||
*/
|
*/
|
||||||
public class SafeWindowClone : Clutter.Clone
|
public class SafeWindowClone : Clutter.Clone {
|
||||||
{
|
|
||||||
public Window window { get; construct; }
|
public Window window { get; construct; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,8 +38,7 @@ namespace Gala
|
|||||||
* @param window The window to clone from
|
* @param window The window to clone from
|
||||||
* @param destroy_on_unmanaged see destroy_on_unmanaged property
|
* @param destroy_on_unmanaged see destroy_on_unmanaged property
|
||||||
*/
|
*/
|
||||||
public SafeWindowClone (Window window, bool destroy_on_unmanaged = false)
|
public SafeWindowClone (Window window, bool destroy_on_unmanaged = false) {
|
||||||
{
|
|
||||||
var actor = (WindowActor) window.get_compositor_private ();
|
var actor = (WindowActor) window.get_compositor_private ();
|
||||||
|
|
||||||
Object (window: window,
|
Object (window: window,
|
||||||
@ -49,19 +46,16 @@ namespace Gala
|
|||||||
destroy_on_unmanaged: destroy_on_unmanaged);
|
destroy_on_unmanaged: destroy_on_unmanaged);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
if (source != null)
|
if (source != null)
|
||||||
window.unmanaged.connect (reset_source);
|
window.unmanaged.connect (reset_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SafeWindowClone ()
|
~SafeWindowClone () {
|
||||||
{
|
|
||||||
window.unmanaged.disconnect (reset_source);
|
window.unmanaged.disconnect (reset_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_source ()
|
void reset_source () {
|
||||||
{
|
|
||||||
// actually destroying the clone will be handled somewhere else (unless we were
|
// actually destroying the clone will be handled somewhere else (unless we were
|
||||||
// requested to destroy it), we just need to make sure the clone doesn't attempt
|
// requested to destroy it), we just need to make sure the clone doesn't attempt
|
||||||
// to draw a clone of a window that has been destroyed
|
// to draw a clone of a window that has been destroyed
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class SelectionArea : Clutter.Actor {
|
||||||
public class SelectionArea : Clutter.Actor
|
|
||||||
{
|
|
||||||
public signal void closed ();
|
public signal void closed ();
|
||||||
|
|
||||||
public WindowManager wm { get; construct; }
|
public WindowManager wm { get; construct; }
|
||||||
@ -31,13 +29,11 @@ namespace Gala
|
|||||||
private bool dragging = false;
|
private bool dragging = false;
|
||||||
private bool clicked = false;
|
private bool clicked = false;
|
||||||
|
|
||||||
public SelectionArea (WindowManager wm)
|
public SelectionArea (WindowManager wm) {
|
||||||
{
|
|
||||||
Object (wm: wm);
|
Object (wm: wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
start_point = { 0, 0 };
|
start_point = { 0, 0 };
|
||||||
end_point = { 0, 0 };
|
end_point = { 0, 0 };
|
||||||
visible = true;
|
visible = true;
|
||||||
@ -60,8 +56,7 @@ namespace Gala
|
|||||||
canvas.invalidate ();
|
canvas.invalidate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool key_press_event (Clutter.KeyEvent e)
|
public override bool key_press_event (Clutter.KeyEvent e) {
|
||||||
{
|
|
||||||
if (e.keyval == Clutter.Key.Escape) {
|
if (e.keyval == Clutter.Key.Escape) {
|
||||||
close ();
|
close ();
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
@ -72,8 +67,7 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool button_press_event (Clutter.ButtonEvent e)
|
public override bool button_press_event (Clutter.ButtonEvent e) {
|
||||||
{
|
|
||||||
if (dragging || e.button != 1) {
|
if (dragging || e.button != 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -86,8 +80,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool button_release_event (Clutter.ButtonEvent e)
|
public override bool button_release_event (Clutter.ButtonEvent e) {
|
||||||
{
|
|
||||||
if (e.button != 1) {
|
if (e.button != 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -110,8 +103,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool motion_event (Clutter.MotionEvent e)
|
public override bool motion_event (Clutter.MotionEvent e) {
|
||||||
{
|
|
||||||
if (!clicked) {
|
if (!clicked) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -127,8 +119,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
|
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
|
||||||
#else
|
#else
|
||||||
@ -140,8 +131,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start_selection ()
|
public void start_selection () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
|
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
|
||||||
#else
|
#else
|
||||||
@ -152,16 +142,14 @@ namespace Gala
|
|||||||
modal_proxy = wm.push_modal ();
|
modal_proxy = wm.push_modal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void get_selection_rectangle (out int x, out int y, out int width, out int height)
|
public void get_selection_rectangle (out int x, out int y, out int width, out int height) {
|
||||||
{
|
|
||||||
x = int.min (start_point.x, end_point.x);
|
x = int.min (start_point.x, end_point.x);
|
||||||
y = int.min (start_point.y, end_point.y);
|
y = int.min (start_point.y, end_point.y);
|
||||||
width = (start_point.x - end_point.x).abs ();
|
width = (start_point.x - end_point.x).abs ();
|
||||||
height = (start_point.y - end_point.y).abs ();
|
height = (start_point.y - end_point.y).abs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool draw_area (Cairo.Context ctx)
|
private bool draw_area (Cairo.Context ctx) {
|
||||||
{
|
|
||||||
Clutter.cairo_clear (ctx);
|
Clutter.cairo_clear (ctx);
|
||||||
|
|
||||||
if (!dragging) {
|
if (!dragging) {
|
||||||
|
@ -18,19 +18,15 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
class WindowShadowEffect : ShadowEffect {
|
||||||
class WindowShadowEffect : ShadowEffect
|
|
||||||
{
|
|
||||||
public unowned Meta.Window window { get; construct; }
|
public unowned Meta.Window window { get; construct; }
|
||||||
|
|
||||||
public WindowShadowEffect (Meta.Window window, int shadow_size, int shadow_spread)
|
public WindowShadowEffect (Meta.Window window, int shadow_size, int shadow_spread) {
|
||||||
{
|
|
||||||
Object (window: window, shadow_size: shadow_size, shadow_spread: shadow_spread, shadow_opacity: 255);
|
Object (window: window, shadow_size: shadow_size, shadow_spread: shadow_spread, shadow_opacity: 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ActorBox get_bounding_box ()
|
public override ActorBox get_bounding_box () {
|
||||||
{
|
|
||||||
var size = shadow_size * scale_factor;
|
var size = shadow_size * scale_factor;
|
||||||
|
|
||||||
var input_rect = window.get_buffer_rect ();
|
var input_rect = window.get_buffer_rect ();
|
||||||
@ -49,8 +45,7 @@ namespace Gala
|
|||||||
* A container for a clone of the texture of a MetaWindow, a WindowIcon,
|
* A container for a clone of the texture of a MetaWindow, a WindowIcon,
|
||||||
* a close button and a shadow. Used together with the WindowCloneContainer.
|
* a close button and a shadow. Used together with the WindowCloneContainer.
|
||||||
*/
|
*/
|
||||||
public class WindowClone : Actor
|
public class WindowClone : Actor {
|
||||||
{
|
|
||||||
const int WINDOW_ICON_SIZE = 64;
|
const int WINDOW_ICON_SIZE = 64;
|
||||||
const int ACTIVE_SHAPE_SIZE = 12;
|
const int ACTIVE_SHAPE_SIZE = 12;
|
||||||
|
|
||||||
@ -125,13 +120,11 @@ namespace Gala
|
|||||||
Actor active_shape;
|
Actor active_shape;
|
||||||
Actor window_icon;
|
Actor window_icon;
|
||||||
|
|
||||||
public WindowClone (Meta.Window window, bool overview_mode = false)
|
public WindowClone (Meta.Window window, bool overview_mode = false) {
|
||||||
{
|
|
||||||
Object (window: window, overview_mode: overview_mode);
|
Object (window: window, overview_mode: overview_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
reactive = true;
|
reactive = true;
|
||||||
|
|
||||||
window.unmanaged.connect (unmanaged);
|
window.unmanaged.connect (unmanaged);
|
||||||
@ -183,8 +176,7 @@ namespace Gala
|
|||||||
load_clone ();
|
load_clone ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~WindowClone ()
|
~WindowClone () {
|
||||||
{
|
|
||||||
window.unmanaged.disconnect (unmanaged);
|
window.unmanaged.disconnect (unmanaged);
|
||||||
window.notify["on-all-workspaces"].disconnect (on_all_workspaces_changed);
|
window.notify["on-all-workspaces"].disconnect (on_all_workspaces_changed);
|
||||||
window.notify["fullscreen"].disconnect (check_shadow_requirements);
|
window.notify["fullscreen"].disconnect (check_shadow_requirements);
|
||||||
@ -205,8 +197,7 @@ namespace Gala
|
|||||||
* @param was_waiting Internal argument used to indicate that we had to
|
* @param was_waiting Internal argument used to indicate that we had to
|
||||||
* wait before the window's texture became available.
|
* wait before the window's texture became available.
|
||||||
*/
|
*/
|
||||||
void load_clone (bool was_waiting = false)
|
void load_clone (bool was_waiting = false) {
|
||||||
{
|
|
||||||
var actor = window.get_compositor_private () as WindowActor;
|
var actor = window.get_compositor_private () as WindowActor;
|
||||||
if (actor == null) {
|
if (actor == null) {
|
||||||
Idle.add (() => {
|
Idle.add (() => {
|
||||||
@ -248,8 +239,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_shadow_requirements ()
|
void check_shadow_requirements () {
|
||||||
{
|
|
||||||
if (window.fullscreen || window.maximized_horizontally && window.maximized_vertically) {
|
if (window.fullscreen || window.maximized_horizontally && window.maximized_vertically) {
|
||||||
if (shadow_effect == null) {
|
if (shadow_effect == null) {
|
||||||
shadow_effect = new WindowShadowEffect (window, 40, 5);
|
shadow_effect = new WindowShadowEffect (window, 40, 5);
|
||||||
@ -267,8 +257,7 @@ namespace Gala
|
|||||||
* If we are in overview mode, we may display windows from workspaces other than
|
* If we are in overview mode, we may display windows from workspaces other than
|
||||||
* the current one. To ease their appearance we have to fade them in.
|
* the current one. To ease their appearance we have to fade them in.
|
||||||
*/
|
*/
|
||||||
bool should_fade ()
|
bool should_fade () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
return (overview_mode
|
return (overview_mode
|
||||||
&& window.get_workspace () != window.get_display ().get_workspace_manager ().get_active_workspace ()) || window.minimized;
|
&& window.get_workspace () != window.get_display ().get_workspace_manager ().get_active_workspace ()) || window.minimized;
|
||||||
@ -278,8 +267,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_all_workspaces_changed ()
|
void on_all_workspaces_changed () {
|
||||||
{
|
|
||||||
// we don't display windows that are on all workspaces
|
// we don't display windows that are on all workspaces
|
||||||
if (window.on_all_workspaces)
|
if (window.on_all_workspaces)
|
||||||
unmanaged ();
|
unmanaged ();
|
||||||
@ -290,8 +278,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param animate Animate the transformation of the placement
|
* @param animate Animate the transformation of the placement
|
||||||
*/
|
*/
|
||||||
public void transition_to_original_state (bool animate)
|
public void transition_to_original_state (bool animate) {
|
||||||
{
|
|
||||||
var outer_rect = window.get_frame_rect ();
|
var outer_rect = window.get_frame_rect ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -324,8 +311,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Animate the window to the given slot
|
* Animate the window to the given slot
|
||||||
*/
|
*/
|
||||||
public void take_slot (Meta.Rectangle rect)
|
public void take_slot (Meta.Rectangle rect) {
|
||||||
{
|
|
||||||
slot = rect;
|
slot = rect;
|
||||||
|
|
||||||
save_easing_state ();
|
save_easing_state ();
|
||||||
@ -355,8 +341,7 @@ namespace Gala
|
|||||||
* according to their given allocations. The first two are placed in a way
|
* according to their given allocations. The first two are placed in a way
|
||||||
* that compensates for invisible borders of the texture.
|
* that compensates for invisible borders of the texture.
|
||||||
*/
|
*/
|
||||||
public override void allocate (ActorBox box, AllocationFlags flags)
|
public override void allocate (ActorBox box, AllocationFlags flags) {
|
||||||
{
|
|
||||||
base.allocate (box, flags);
|
base.allocate (box, flags);
|
||||||
|
|
||||||
foreach (var child in get_children ()) {
|
foreach (var child in get_children ()) {
|
||||||
@ -388,20 +373,17 @@ namespace Gala
|
|||||||
clone.allocate (alloc, flags);
|
clone.allocate (alloc, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool button_press_event (Clutter.ButtonEvent event)
|
public override bool button_press_event (Clutter.ButtonEvent event) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool enter_event (Clutter.CrossingEvent event)
|
public override bool enter_event (Clutter.CrossingEvent event) {
|
||||||
{
|
|
||||||
close_button.opacity = 255;
|
close_button.opacity = 255;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool leave_event (Clutter.CrossingEvent event)
|
public override bool leave_event (Clutter.CrossingEvent event) {
|
||||||
{
|
|
||||||
close_button.opacity = 0;
|
close_button.opacity = 0;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -411,8 +393,7 @@ namespace Gala
|
|||||||
* Place the widgets, that is the close button and the WindowIcon of the window,
|
* Place the widgets, that is the close button and the WindowIcon of the window,
|
||||||
* at their positions inside the actor for a given width and height.
|
* at their positions inside the actor for a given width and height.
|
||||||
*/
|
*/
|
||||||
public void place_widgets (int dest_width, int dest_height)
|
public void place_widgets (int dest_width, int dest_height) {
|
||||||
{
|
|
||||||
Granite.CloseButtonPosition pos;
|
Granite.CloseButtonPosition pos;
|
||||||
Granite.Widgets.Utils.get_default_close_button_position (out pos);
|
Granite.Widgets.Utils.get_default_close_button_position (out pos);
|
||||||
|
|
||||||
@ -441,8 +422,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggle_shadow (bool show)
|
void toggle_shadow (bool show) {
|
||||||
{
|
|
||||||
if (get_transition ("shadow-opacity") != null)
|
if (get_transition ("shadow-opacity") != null)
|
||||||
remove_transition ("shadow-opacity");
|
remove_transition ("shadow-opacity");
|
||||||
|
|
||||||
@ -465,8 +445,7 @@ namespace Gala
|
|||||||
* dialog of the window we were going to delete. If that's the case, we request
|
* dialog of the window we were going to delete. If that's the case, we request
|
||||||
* to select our window.
|
* to select our window.
|
||||||
*/
|
*/
|
||||||
void close_window ()
|
void close_window () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = window.get_display ();
|
unowned Meta.Display display = window.get_display ();
|
||||||
check_confirm_dialog_cb = display.window_entered_monitor.connect (check_confirm_dialog);
|
check_confirm_dialog_cb = display.window_entered_monitor.connect (check_confirm_dialog);
|
||||||
@ -480,8 +459,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_confirm_dialog (int monitor, Meta.Window new_window)
|
void check_confirm_dialog (int monitor, Meta.Window new_window) {
|
||||||
{
|
|
||||||
if (new_window.get_transient_for () == window) {
|
if (new_window.get_transient_for () == window) {
|
||||||
Idle.add (() => {
|
Idle.add (() => {
|
||||||
selected ();
|
selected ();
|
||||||
@ -500,8 +478,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* The window unmanaged by the compositor, so we need to destroy ourselves too.
|
* The window unmanaged by the compositor, so we need to destroy ourselves too.
|
||||||
*/
|
*/
|
||||||
void unmanaged ()
|
void unmanaged () {
|
||||||
{
|
|
||||||
remove_all_transitions ();
|
remove_all_transitions ();
|
||||||
|
|
||||||
if (drag_action != null && drag_action.dragging)
|
if (drag_action != null && drag_action.dragging)
|
||||||
@ -543,8 +520,7 @@ namespace Gala
|
|||||||
* we can move freely, scale ourselves to a smaller scale and request that the
|
* we can move freely, scale ourselves to a smaller scale and request that the
|
||||||
* position we just freed is immediately filled by the WindowCloneContainer.
|
* position we just freed is immediately filled by the WindowCloneContainer.
|
||||||
*/
|
*/
|
||||||
Actor drag_begin (float click_x, float click_y)
|
Actor drag_begin (float click_x, float click_y) {
|
||||||
{
|
|
||||||
float abs_x, abs_y;
|
float abs_x, abs_y;
|
||||||
float prev_parent_x, prev_parent_y;
|
float prev_parent_x, prev_parent_y;
|
||||||
|
|
||||||
@ -596,8 +572,7 @@ namespace Gala
|
|||||||
* less opacity and add ourselves as temporary window to the group. When left,
|
* less opacity and add ourselves as temporary window to the group. When left,
|
||||||
* we reverse those steps.
|
* we reverse those steps.
|
||||||
*/
|
*/
|
||||||
void drag_destination_crossed (Actor destination, bool hovered)
|
void drag_destination_crossed (Actor destination, bool hovered) {
|
||||||
{
|
|
||||||
IconGroup? icon_group = destination as IconGroup;
|
IconGroup? icon_group = destination as IconGroup;
|
||||||
WorkspaceInsertThumb? insert_thumb = destination as WorkspaceInsertThumb;
|
WorkspaceInsertThumb? insert_thumb = destination as WorkspaceInsertThumb;
|
||||||
|
|
||||||
@ -649,8 +624,7 @@ namespace Gala
|
|||||||
* After we found one we destroy ourselves so the dragged clone immediately disappears,
|
* After we found one we destroy ourselves so the dragged clone immediately disappears,
|
||||||
* otherwise we cancel the drag and animate back to our old place.
|
* otherwise we cancel the drag and animate back to our old place.
|
||||||
*/
|
*/
|
||||||
void drag_end (Actor destination)
|
void drag_end (Actor destination) {
|
||||||
{
|
|
||||||
Meta.Workspace workspace = null;
|
Meta.Workspace workspace = null;
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var primary = window.get_display ().get_primary_monitor ();
|
var primary = window.get_display ().get_primary_monitor ();
|
||||||
@ -722,8 +696,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Animate back to our previous position with a bouncing animation.
|
* Animate back to our previous position with a bouncing animation.
|
||||||
*/
|
*/
|
||||||
void drag_canceled ()
|
void drag_canceled () {
|
||||||
{
|
|
||||||
get_parent ().remove_child (this);
|
get_parent ().remove_child (this);
|
||||||
prev_parent.insert_child_at_index (this, prev_index);
|
prev_parent.insert_child_at_index (this, prev_index);
|
||||||
|
|
||||||
|
@ -18,13 +18,11 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Container which controls the layout of a set of WindowClones.
|
* Container which controls the layout of a set of WindowClones.
|
||||||
*/
|
*/
|
||||||
public class WindowCloneContainer : Actor
|
public class WindowCloneContainer : Actor {
|
||||||
{
|
|
||||||
public signal void window_selected (Window window);
|
public signal void window_selected (Window window);
|
||||||
|
|
||||||
public int padding_top { get; set; default = 12; }
|
public int padding_top { get; set; default = 12; }
|
||||||
@ -42,13 +40,11 @@ namespace Gala
|
|||||||
*/
|
*/
|
||||||
WindowClone? current_window;
|
WindowClone? current_window;
|
||||||
|
|
||||||
public WindowCloneContainer (bool overview_mode = false)
|
public WindowCloneContainer (bool overview_mode = false) {
|
||||||
{
|
|
||||||
Object (overview_mode: overview_mode);
|
Object (overview_mode: overview_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
opened = false;
|
opened = false;
|
||||||
current_window = null;
|
current_window = null;
|
||||||
}
|
}
|
||||||
@ -58,11 +54,10 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param window The window for which to create the WindowClone for
|
* @param window The window for which to create the WindowClone for
|
||||||
*/
|
*/
|
||||||
public void add_window (Window window)
|
public void add_window (Window window) {
|
||||||
{
|
|
||||||
unowned Meta.Display display = window.get_display ();
|
unowned Meta.Display display = window.get_display ();
|
||||||
var children = get_children ();
|
var children = get_children ();
|
||||||
|
|
||||||
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
||||||
foreach (unowned Actor child in children) {
|
foreach (unowned Actor child in children) {
|
||||||
unowned WindowClone tw = (WindowClone) child;
|
unowned WindowClone tw = (WindowClone) child;
|
||||||
@ -70,9 +65,9 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
windows.prepend (window);
|
windows.prepend (window);
|
||||||
windows.reverse ();
|
windows.reverse ();
|
||||||
|
|
||||||
var windows_ordered = display.sort_windows_by_stacking (windows);
|
var windows_ordered = display.sort_windows_by_stacking (windows);
|
||||||
|
|
||||||
var new_window = new WindowClone (window, overview_mode);
|
var new_window = new WindowClone (window, overview_mode);
|
||||||
|
|
||||||
new_window.selected.connect (window_selected_cb);
|
new_window.selected.connect (window_selected_cb);
|
||||||
@ -108,8 +103,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Find and remove the WindowClone for a MetaWindow
|
* Find and remove the WindowClone for a MetaWindow
|
||||||
*/
|
*/
|
||||||
public void remove_window (Window window)
|
public void remove_window (Window window) {
|
||||||
{
|
|
||||||
foreach (var child in get_children ()) {
|
foreach (var child in get_children ()) {
|
||||||
if (((WindowClone) child).window == window) {
|
if (((WindowClone) child).window == window) {
|
||||||
remove_child (child);
|
remove_child (child);
|
||||||
@ -120,13 +114,11 @@ namespace Gala
|
|||||||
reflow ();
|
reflow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_selected_cb (WindowClone tiled)
|
void window_selected_cb (WindowClone tiled) {
|
||||||
{
|
|
||||||
window_selected (tiled.window);
|
window_selected (tiled.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_destroyed (Actor actor)
|
void window_destroyed (Actor actor) {
|
||||||
{
|
|
||||||
var window = actor as WindowClone;
|
var window = actor as WindowClone;
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
@ -145,8 +137,7 @@ namespace Gala
|
|||||||
* during animations correct.
|
* during animations correct.
|
||||||
*/
|
*/
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public void restack_windows (Meta.Display display)
|
public void restack_windows (Meta.Display display) {
|
||||||
{
|
|
||||||
var children = get_children ();
|
var children = get_children ();
|
||||||
|
|
||||||
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
||||||
@ -171,8 +162,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public void restack_windows (Screen screen)
|
public void restack_windows (Screen screen) {
|
||||||
{
|
|
||||||
unowned Meta.Display display = screen.get_display ();
|
unowned Meta.Display display = screen.get_display ();
|
||||||
var children = get_children ();
|
var children = get_children ();
|
||||||
|
|
||||||
@ -203,8 +193,7 @@ namespace Gala
|
|||||||
* Recalculate the tiling positions of the windows and animate them to
|
* Recalculate the tiling positions of the windows and animate them to
|
||||||
* the resulting spots.
|
* the resulting spots.
|
||||||
*/
|
*/
|
||||||
public void reflow ()
|
public void reflow () {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -248,8 +237,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param direction The MetaMotionDirection in which to search for windows for.
|
* @param direction The MetaMotionDirection in which to search for windows for.
|
||||||
*/
|
*/
|
||||||
public void select_next_window (MotionDirection direction)
|
public void select_next_window (MotionDirection direction) {
|
||||||
{
|
|
||||||
if (get_n_children () < 1)
|
if (get_n_children () < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -336,8 +324,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Emit the selected signal for the current_window.
|
* Emit the selected signal for the current_window.
|
||||||
*/
|
*/
|
||||||
public bool activate_selected_window ()
|
public bool activate_selected_window () {
|
||||||
{
|
|
||||||
if (current_window != null) {
|
if (current_window != null) {
|
||||||
current_window.selected ();
|
current_window.selected ();
|
||||||
return true;
|
return true;
|
||||||
@ -349,13 +336,12 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* When opened the WindowClones are animated to a tiled layout
|
* When opened the WindowClones are animated to a tiled layout
|
||||||
*/
|
*/
|
||||||
public void open (Window? selected_window = null)
|
public void open (Window? selected_window = null) {
|
||||||
{
|
|
||||||
if (opened)
|
if (opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opened = true;
|
opened = true;
|
||||||
|
|
||||||
// hide the highlight when opened
|
// hide the highlight when opened
|
||||||
if (selected_window != null) {
|
if (selected_window != null) {
|
||||||
foreach (var child in get_children ()) {
|
foreach (var child in get_children ()) {
|
||||||
@ -385,11 +371,10 @@ namespace Gala
|
|||||||
* Calls the transition_to_original_state() function on each child
|
* Calls the transition_to_original_state() function on each child
|
||||||
* to make them take their original locations again.
|
* to make them take their original locations again.
|
||||||
*/
|
*/
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
opened = false;
|
opened = false;
|
||||||
|
|
||||||
foreach (var window in get_children ())
|
foreach (var window in get_children ())
|
||||||
|
@ -18,15 +18,13 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Private class which is basically just a container for the actual
|
* Private class which is basically just a container for the actual
|
||||||
* icon and takes care of blending the same icon in different sizes
|
* icon and takes care of blending the same icon in different sizes
|
||||||
* over each other and various animations related to the icons
|
* over each other and various animations related to the icons
|
||||||
*/
|
*/
|
||||||
public class WindowIconActor : Actor
|
public class WindowIconActor : Actor {
|
||||||
{
|
|
||||||
public Window window { get; construct; }
|
public Window window { get; construct; }
|
||||||
|
|
||||||
int _icon_size;
|
int _icon_size;
|
||||||
@ -102,13 +100,11 @@ namespace Gala
|
|||||||
WindowIcon? icon = null;
|
WindowIcon? icon = null;
|
||||||
WindowIcon? old_icon = null;
|
WindowIcon? old_icon = null;
|
||||||
|
|
||||||
public WindowIconActor (Window window)
|
public WindowIconActor (Window window) {
|
||||||
{
|
|
||||||
Object (window: window);
|
Object (window: window);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
set_pivot_point (0.5f, 0.5f);
|
set_pivot_point (0.5f, 0.5f);
|
||||||
set_easing_mode (AnimationMode.EASE_OUT_ELASTIC);
|
set_easing_mode (AnimationMode.EASE_OUT_ELASTIC);
|
||||||
set_easing_duration (800);
|
set_easing_duration (800);
|
||||||
@ -116,13 +112,11 @@ namespace Gala
|
|||||||
window.notify["on-all-workspaces"].connect (on_all_workspaces_changed);
|
window.notify["on-all-workspaces"].connect (on_all_workspaces_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
~WindowIconActor ()
|
~WindowIconActor () {
|
||||||
{
|
|
||||||
window.notify["on-all-workspaces"].disconnect (on_all_workspaces_changed);
|
window.notify["on-all-workspaces"].disconnect (on_all_workspaces_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_all_workspaces_changed ()
|
void on_all_workspaces_changed () {
|
||||||
{
|
|
||||||
// we don't display windows that are on all workspaces
|
// we don't display windows that are on all workspaces
|
||||||
if (window.on_all_workspaces)
|
if (window.on_all_workspaces)
|
||||||
destroy ();
|
destroy ();
|
||||||
@ -135,8 +129,7 @@ namespace Gala
|
|||||||
* @param y The y coordinate to which to animate to
|
* @param y The y coordinate to which to animate to
|
||||||
* @param size The size to which to animate to and display the icon in
|
* @param size The size to which to animate to and display the icon in
|
||||||
*/
|
*/
|
||||||
public void place (float x, float y, int size)
|
public void place (float x, float y, int size) {
|
||||||
{
|
|
||||||
if (initial) {
|
if (initial) {
|
||||||
save_easing_state ();
|
save_easing_state ();
|
||||||
set_easing_duration (10);
|
set_easing_duration (10);
|
||||||
@ -154,8 +147,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Fades out the old icon and fades in the new icon
|
* Fades out the old icon and fades in the new icon
|
||||||
*/
|
*/
|
||||||
void fade_new_icon ()
|
void fade_new_icon () {
|
||||||
{
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
var new_icon = new WindowIcon (window, icon_size, scale);
|
var new_icon = new WindowIcon (window, icon_size, scale);
|
||||||
new_icon.add_constraint (new BindConstraint (this, BindCoordinate.SIZE, 0));
|
new_icon.add_constraint (new BindConstraint (this, BindCoordinate.SIZE, 0));
|
||||||
|
@ -18,19 +18,16 @@
|
|||||||
using Meta;
|
using Meta;
|
||||||
using Clutter;
|
using Clutter;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
|
|
||||||
public enum WindowOverviewType
|
public enum WindowOverviewType {
|
||||||
{
|
|
||||||
GRID = 0,
|
GRID = 0,
|
||||||
NATURAL
|
NATURAL
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void WindowPlacer (Actor window, Meta.Rectangle rect);
|
public delegate void WindowPlacer (Actor window, Meta.Rectangle rect);
|
||||||
|
|
||||||
public class WindowOverview : Actor, ActivatableComponent
|
public class WindowOverview : Actor, ActivatableComponent {
|
||||||
{
|
|
||||||
const int BORDER = 10;
|
const int BORDER = 10;
|
||||||
const int TOP_GAP = 30;
|
const int TOP_GAP = 30;
|
||||||
const int BOTTOM_GAP = 100;
|
const int BOTTOM_GAP = 100;
|
||||||
@ -49,13 +46,11 @@ namespace Gala
|
|||||||
// the workspaces which we expose right now
|
// the workspaces which we expose right now
|
||||||
List<Workspace> workspaces;
|
List<Workspace> workspaces;
|
||||||
|
|
||||||
public WindowOverview (WindowManager wm)
|
public WindowOverview (WindowManager wm) {
|
||||||
{
|
|
||||||
Object (wm : wm);
|
Object (wm : wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
display = wm.get_display ();
|
display = wm.get_display ();
|
||||||
|
|
||||||
@ -73,8 +68,7 @@ namespace Gala
|
|||||||
reactive = true;
|
reactive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
~WindowOverview ()
|
~WindowOverview () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
display.restacked.disconnect (restack_windows);
|
display.restacked.disconnect (restack_windows);
|
||||||
#else
|
#else
|
||||||
@ -82,8 +76,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool key_press_event (Clutter.KeyEvent event)
|
public override bool key_press_event (Clutter.KeyEvent event) {
|
||||||
{
|
|
||||||
if (event.keyval == Clutter.Key.Escape) {
|
if (event.keyval == Clutter.Key.Escape) {
|
||||||
close ();
|
close ();
|
||||||
|
|
||||||
@ -93,14 +86,12 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void key_focus_out ()
|
public override void key_focus_out () {
|
||||||
{
|
|
||||||
if (!contains (get_stage ().key_focus))
|
if (!contains (get_stage ().key_focus))
|
||||||
close ();
|
close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool button_press_event (Clutter.ButtonEvent event)
|
public override bool button_press_event (Clutter.ButtonEvent event) {
|
||||||
{
|
|
||||||
if (event.button == 1)
|
if (event.button == 1)
|
||||||
close ();
|
close ();
|
||||||
|
|
||||||
@ -110,8 +101,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public bool is_opened ()
|
public bool is_opened () {
|
||||||
{
|
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +109,7 @@ namespace Gala
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
* You may specify 'all-windows' in hints to expose all windows
|
* You may specify 'all-windows' in hints to expose all windows
|
||||||
*/
|
*/
|
||||||
public void open (HashTable<string,Variant>? hints = null)
|
public void open (HashTable<string,Variant>? hints = null) {
|
||||||
{
|
|
||||||
if (!ready)
|
if (!ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -243,28 +232,24 @@ namespace Gala
|
|||||||
ready = true;
|
ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keybinding_filter (KeyBinding binding)
|
bool keybinding_filter (KeyBinding binding) {
|
||||||
{
|
|
||||||
var name = binding.get_name ();
|
var name = binding.get_name ();
|
||||||
return (name != "expose-windows" && name != "expose-all-windows");
|
return (name != "expose-windows" && name != "expose-all-windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void restack_windows (Display display)
|
void restack_windows (Display display) {
|
||||||
{
|
|
||||||
foreach (var child in get_children ())
|
foreach (var child in get_children ())
|
||||||
((WindowCloneContainer) child).restack_windows (display);
|
((WindowCloneContainer) child).restack_windows (display);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void restack_windows (Screen screen)
|
void restack_windows (Screen screen) {
|
||||||
{
|
|
||||||
foreach (var child in get_children ())
|
foreach (var child in get_children ())
|
||||||
((WindowCloneContainer) child).restack_windows (screen);
|
((WindowCloneContainer) child).restack_windows (screen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void window_left_monitor (int num, Window window)
|
void window_left_monitor (int num, Window window) {
|
||||||
{
|
|
||||||
unowned WindowCloneContainer container = get_child_at_index (num) as WindowCloneContainer;
|
unowned WindowCloneContainer container = get_child_at_index (num) as WindowCloneContainer;
|
||||||
if (container == null)
|
if (container == null)
|
||||||
return;
|
return;
|
||||||
@ -277,8 +262,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_window (Window window)
|
void add_window (Window window) {
|
||||||
{
|
|
||||||
if (!visible
|
if (!visible
|
||||||
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
|
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
|
||||||
return;
|
return;
|
||||||
@ -295,8 +279,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_window (Window window)
|
void remove_window (Window window) {
|
||||||
{
|
|
||||||
unowned WindowCloneContainer container = get_child_at_index (window.get_monitor ()) as WindowCloneContainer;
|
unowned WindowCloneContainer container = get_child_at_index (window.get_monitor ()) as WindowCloneContainer;
|
||||||
if (container == null)
|
if (container == null)
|
||||||
return;
|
return;
|
||||||
@ -305,8 +288,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void thumb_selected (Window window)
|
void thumb_selected (Window window) {
|
||||||
{
|
|
||||||
if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) {
|
if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) {
|
||||||
window.activate (display.get_current_time ());
|
window.activate (display.get_current_time ());
|
||||||
close ();
|
close ();
|
||||||
@ -320,8 +302,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void thumb_selected (Window window)
|
void thumb_selected (Window window) {
|
||||||
{
|
|
||||||
if (window.get_workspace () == screen.get_active_workspace ()) {
|
if (window.get_workspace () == screen.get_active_workspace ()) {
|
||||||
window.activate (screen.get_display ().get_current_time ());
|
window.activate (screen.get_display ().get_current_time ());
|
||||||
close ();
|
close ();
|
||||||
@ -339,8 +320,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
if (!visible || !ready)
|
if (!visible || !ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -369,8 +349,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup ()
|
void cleanup () {
|
||||||
{
|
|
||||||
ready = true;
|
ready = true;
|
||||||
visible = false;
|
visible = false;
|
||||||
|
|
||||||
|
@ -18,10 +18,8 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class WindowSwitcher : Clutter.Actor {
|
||||||
public class WindowSwitcher : Clutter.Actor
|
|
||||||
{
|
|
||||||
const int MIN_DELTA = 100;
|
const int MIN_DELTA = 100;
|
||||||
const float BACKGROUND_OPACITY = 155.0f;
|
const float BACKGROUND_OPACITY = 155.0f;
|
||||||
const float DIM_WINDOW_BRIGHTNESS = -BACKGROUND_OPACITY / 255.0f;
|
const float DIM_WINDOW_BRIGHTNESS = -BACKGROUND_OPACITY / 255.0f;
|
||||||
@ -54,13 +52,11 @@ namespace Gala
|
|||||||
float dock_width = 0.0f;
|
float dock_width = 0.0f;
|
||||||
int n_dock_items = 0;
|
int n_dock_items = 0;
|
||||||
|
|
||||||
public WindowSwitcher (WindowManager wm)
|
public WindowSwitcher (WindowManager wm) {
|
||||||
{
|
|
||||||
Object (wm: wm);
|
Object (wm: wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
// pull drawing methods from libplank
|
// pull drawing methods from libplank
|
||||||
dock_settings = new Plank.DockPreferences ("dock1");
|
dock_settings = new Plank.DockPreferences ("dock1");
|
||||||
dock_settings.notify.connect (update_dock);
|
dock_settings.notify.connect (update_dock);
|
||||||
@ -113,8 +109,7 @@ namespace Gala
|
|||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~WindowSwitcher ()
|
~WindowSwitcher () {
|
||||||
{
|
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.cancel ();
|
monitor.cancel ();
|
||||||
|
|
||||||
@ -126,8 +121,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_dock_theme ()
|
void load_dock_theme () {
|
||||||
{
|
|
||||||
if (dock_theme != null)
|
if (dock_theme != null)
|
||||||
dock_theme.notify.disconnect (update_dock);
|
dock_theme.notify.disconnect (update_dock);
|
||||||
|
|
||||||
@ -141,8 +135,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* set the values which don't get set every time and need to be updated when the theme changes
|
* set the values which don't get set every time and need to be updated when the theme changes
|
||||||
*/
|
*/
|
||||||
void update_dock ()
|
void update_dock () {
|
||||||
{
|
|
||||||
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -201,8 +194,7 @@ namespace Gala
|
|||||||
dock_surface = null;
|
dock_surface = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_background ()
|
void update_background () {
|
||||||
{
|
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
wm.get_display ().get_size (out width, out height);
|
wm.get_display ().get_size (out width, out height);
|
||||||
@ -213,14 +205,12 @@ namespace Gala
|
|||||||
background.set_size (width, height);
|
background.set_size (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_actors ()
|
void update_actors () {
|
||||||
{
|
|
||||||
update_dock ();
|
update_dock ();
|
||||||
update_background ();
|
update_background ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool draw_dock_background (Cairo.Context cr)
|
bool draw_dock_background (Cairo.Context cr) {
|
||||||
{
|
|
||||||
cr.set_operator (Cairo.Operator.CLEAR);
|
cr.set_operator (Cairo.Operator.CLEAR);
|
||||||
cr.paint ();
|
cr.paint ();
|
||||||
cr.set_operator (Cairo.Operator.OVER);
|
cr.set_operator (Cairo.Operator.OVER);
|
||||||
@ -276,8 +266,7 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void place_dock ()
|
void place_dock () {
|
||||||
{
|
|
||||||
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
||||||
|
|
||||||
var icon_size = dock_settings.IconSize * ui_scale_factor;
|
var icon_size = dock_settings.IconSize * ui_scale_factor;
|
||||||
@ -307,8 +296,7 @@ namespace Gala
|
|||||||
dock.opacity = 255;
|
dock.opacity = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
void animate_dock_width ()
|
void animate_dock_width () {
|
||||||
{
|
|
||||||
dock.save_easing_state ();
|
dock.save_easing_state ();
|
||||||
dock.set_easing_duration (250);
|
dock.set_easing_duration (250);
|
||||||
dock.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
dock.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||||
@ -327,8 +315,7 @@ namespace Gala
|
|||||||
dock.restore_easing_state ();
|
dock.restore_easing_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_background ()
|
void show_background () {
|
||||||
{
|
|
||||||
background.save_easing_state ();
|
background.save_easing_state ();
|
||||||
background.set_easing_duration (250);
|
background.set_easing_duration (250);
|
||||||
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||||
@ -336,8 +323,7 @@ namespace Gala
|
|||||||
background.restore_easing_state ();
|
background.restore_easing_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide_background ()
|
void hide_background () {
|
||||||
{
|
|
||||||
background.save_easing_state ();
|
background.save_easing_state ();
|
||||||
background.set_easing_duration (250);
|
background.set_easing_duration (250);
|
||||||
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||||
@ -367,13 +353,11 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_removed (Actor actor)
|
void window_removed (Actor actor) {
|
||||||
{
|
|
||||||
clone_sort_order.remove (actor);
|
clone_sort_order.remove (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void icon_removed (Actor actor)
|
void icon_removed (Actor actor) {
|
||||||
{
|
|
||||||
if (dock.get_n_children () == 1) {
|
if (dock.get_n_children () == 1) {
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
close (wm.get_display ().get_current_time ());
|
close (wm.get_display ().get_current_time ());
|
||||||
@ -394,16 +378,14 @@ namespace Gala
|
|||||||
animate_dock_width ();
|
animate_dock_width ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool key_release_event (Clutter.KeyEvent event)
|
public override bool key_release_event (Clutter.KeyEvent event) {
|
||||||
{
|
|
||||||
if ((get_current_modifiers () & modifier_mask) == 0)
|
if ((get_current_modifiers () & modifier_mask) == 0)
|
||||||
close (event.time);
|
close (event.time);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void key_focus_out ()
|
public override void key_focus_out () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
close (wm.get_display ().get_current_time ());
|
close (wm.get_display ().get_current_time ());
|
||||||
#else
|
#else
|
||||||
@ -414,12 +396,11 @@ namespace Gala
|
|||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public void handle_switch_windows (Display display, Window? window, Clutter.KeyEvent event,
|
public void handle_switch_windows (Display display, Window? window, Clutter.KeyEvent event,
|
||||||
KeyBinding binding)
|
KeyBinding binding) {
|
||||||
#else
|
#else
|
||||||
public void handle_switch_windows (Display display, Screen screen, Window? window,
|
public void handle_switch_windows (Display display, Screen screen, Window? window,
|
||||||
Clutter.KeyEvent event, KeyBinding binding)
|
Clutter.KeyEvent event, KeyBinding binding) {
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
var now = get_monotonic_time () / 1000;
|
var now = get_monotonic_time () / 1000;
|
||||||
if (now - last_switch < MIN_DELTA)
|
if (now - last_switch < MIN_DELTA)
|
||||||
return;
|
return;
|
||||||
@ -490,8 +471,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_cleanup ()
|
void close_cleanup () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var display = wm.get_display ();
|
var display = wm.get_display ();
|
||||||
var workspace = display.get_workspace_manager ().get_active_workspace ();
|
var workspace = display.get_workspace_manager ().get_active_workspace ();
|
||||||
@ -525,8 +505,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void close (uint time)
|
void close (uint time) {
|
||||||
{
|
|
||||||
if (closing)
|
if (closing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -602,8 +581,7 @@ namespace Gala
|
|||||||
close_cleanup ();
|
close_cleanup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowIcon? add_window (Window window)
|
WindowIcon? add_window (Window window) {
|
||||||
{
|
|
||||||
var actor = window.get_compositor_private () as WindowActor;
|
var actor = window.get_compositor_private () as WindowActor;
|
||||||
if (actor == null)
|
if (actor == null)
|
||||||
return null;
|
return null;
|
||||||
@ -630,8 +608,7 @@ namespace Gala
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dim_windows ()
|
void dim_windows () {
|
||||||
{
|
|
||||||
foreach (var actor in window_clones.get_children ()) {
|
foreach (var actor in window_clones.get_children ()) {
|
||||||
unowned SafeWindowClone clone = (SafeWindowClone) actor;
|
unowned SafeWindowClone clone = (SafeWindowClone) actor;
|
||||||
|
|
||||||
@ -677,8 +654,7 @@ namespace Gala
|
|||||||
* @return whether the switcher should actually be started or if there are
|
* @return whether the switcher should actually be started or if there are
|
||||||
* not enough windows
|
* not enough windows
|
||||||
*/
|
*/
|
||||||
bool collect_windows (Workspace workspace)
|
bool collect_windows (Workspace workspace) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var display = workspace.get_display ();
|
var display = workspace.get_display ();
|
||||||
#else
|
#else
|
||||||
@ -747,8 +723,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowIcon next_window (Workspace workspace, bool backward)
|
WindowIcon next_window (Workspace workspace, bool backward) {
|
||||||
{
|
|
||||||
Actor actor;
|
Actor actor;
|
||||||
if (!backward) {
|
if (!backward) {
|
||||||
actor = current_window.get_next_sibling ();
|
actor = current_window.get_next_sibling ();
|
||||||
@ -769,8 +744,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param mask The modifier mask to extract the primary one from
|
* @param mask The modifier mask to extract the primary one from
|
||||||
*/
|
*/
|
||||||
void set_primary_modifier (uint mask)
|
void set_primary_modifier (uint mask) {
|
||||||
{
|
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
modifier_mask = 0;
|
modifier_mask = 0;
|
||||||
else {
|
else {
|
||||||
@ -785,8 +759,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Counts the launcher items to get an estimate of the window size
|
* Counts the launcher items to get an estimate of the window size
|
||||||
*/
|
*/
|
||||||
void update_n_dock_items (File folder, File? other_file, FileMonitorEvent event)
|
void update_n_dock_items (File folder, File? other_file, FileMonitorEvent event) {
|
||||||
{
|
|
||||||
if (event != FileMonitorEvent.CREATED && event != FileMonitorEvent.DELETED)
|
if (event != FileMonitorEvent.CREATED && event != FileMonitorEvent.DELETED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -802,8 +775,7 @@ namespace Gala
|
|||||||
n_dock_items = count;
|
n_dock_items = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk.ModifierType get_current_modifiers ()
|
Gdk.ModifierType get_current_modifiers () {
|
||||||
{
|
|
||||||
Gdk.ModifierType modifiers;
|
Gdk.ModifierType modifiers;
|
||||||
double[] axes = {};
|
double[] axes = {};
|
||||||
Gdk.Display.get_default ().get_device_manager ().get_client_pointer ()
|
Gdk.Display.get_default ().get_device_manager ().get_client_pointer ()
|
||||||
|
@ -18,28 +18,23 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Utility class which adds a border and a shadow to a Background
|
* Utility class which adds a border and a shadow to a Background
|
||||||
*/
|
*/
|
||||||
class FramedBackground : BackgroundManager
|
class FramedBackground : BackgroundManager {
|
||||||
{
|
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public FramedBackground (Display display)
|
public FramedBackground (Display display) {
|
||||||
{
|
|
||||||
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
|
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public FramedBackground (Screen screen)
|
public FramedBackground (Screen screen) {
|
||||||
{
|
|
||||||
Object (screen: screen, monitor_index: screen.get_primary_monitor (), control_position: false);
|
Object (screen: screen, monitor_index: screen.get_primary_monitor (), control_position: false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
var primary = display.get_primary_monitor ();
|
var primary = display.get_primary_monitor ();
|
||||||
var monitor_geom = display.get_monitor_geometry (primary);
|
var monitor_geom = display.get_monitor_geometry (primary);
|
||||||
@ -53,8 +48,7 @@ namespace Gala
|
|||||||
add_effect (effect);
|
add_effect (effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void paint ()
|
public override void paint () {
|
||||||
{
|
|
||||||
base.paint ();
|
base.paint ();
|
||||||
|
|
||||||
Cogl.set_source_color4ub (0, 0, 0, 100);
|
Cogl.set_source_color4ub (0, 0, 0, 100);
|
||||||
@ -75,8 +69,7 @@ namespace Gala
|
|||||||
* The latter is not added to the WorkspaceClone itself though but to a container
|
* The latter is not added to the WorkspaceClone itself though but to a container
|
||||||
* of the MultitaskingView.
|
* of the MultitaskingView.
|
||||||
*/
|
*/
|
||||||
public class WorkspaceClone : Actor
|
public class WorkspaceClone : Actor {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* The offset of the scaled background to the bottom of the monitor bounds
|
* The offset of the scaled background to the bottom of the monitor bounds
|
||||||
*/
|
*/
|
||||||
@ -131,13 +124,11 @@ namespace Gala
|
|||||||
|
|
||||||
uint hover_activate_timeout = 0;
|
uint hover_activate_timeout = 0;
|
||||||
|
|
||||||
public WorkspaceClone (Workspace workspace)
|
public WorkspaceClone (Workspace workspace) {
|
||||||
{
|
|
||||||
Object (workspace: workspace);
|
Object (workspace: workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
opened = false;
|
opened = false;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -241,8 +232,7 @@ namespace Gala
|
|||||||
listener.window_no_longer_on_all_workspaces.connect (add_window);
|
listener.window_no_longer_on_all_workspaces.connect (add_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
~WorkspaceClone ()
|
~WorkspaceClone () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = workspace.get_display ();
|
unowned Meta.Display display = workspace.get_display ();
|
||||||
|
|
||||||
@ -271,8 +261,7 @@ namespace Gala
|
|||||||
* Add a window to the WindowCloneContainer and the IconGroup if it really
|
* Add a window to the WindowCloneContainer and the IconGroup if it really
|
||||||
* belongs to this workspace and this monitor.
|
* belongs to this workspace and this monitor.
|
||||||
*/
|
*/
|
||||||
void add_window (Window window)
|
void add_window (Window window) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
if (window.window_type != WindowType.NORMAL
|
if (window.window_type != WindowType.NORMAL
|
||||||
|| window.get_workspace () != workspace
|
|| window.get_workspace () != workspace
|
||||||
@ -298,38 +287,32 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Remove a window from the WindowCloneContainer and the IconGroup
|
* Remove a window from the WindowCloneContainer and the IconGroup
|
||||||
*/
|
*/
|
||||||
void remove_window (Window window)
|
void remove_window (Window window) {
|
||||||
{
|
|
||||||
window_container.remove_window (window);
|
window_container.remove_window (window);
|
||||||
icon_group.remove_window (window, opened);
|
icon_group.remove_window (window, opened);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void window_entered_monitor (Display display, int monitor, Window window)
|
void window_entered_monitor (Display display, int monitor, Window window) {
|
||||||
{
|
|
||||||
add_window (window);
|
add_window (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_left_monitor (Display display, int monitor, Window window)
|
void window_left_monitor (Display display, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (monitor == display.get_primary_monitor ())
|
if (monitor == display.get_primary_monitor ())
|
||||||
remove_window (window);
|
remove_window (window);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void window_entered_monitor (Screen screen, int monitor, Window window)
|
void window_entered_monitor (Screen screen, int monitor, Window window) {
|
||||||
{
|
|
||||||
add_window (window);
|
add_window (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_left_monitor (Screen screen, int monitor, Window window)
|
void window_left_monitor (Screen screen, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (monitor == screen.get_primary_monitor ())
|
if (monitor == screen.get_primary_monitor ())
|
||||||
remove_window (window);
|
remove_window (window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void update_size (Meta.Rectangle monitor_geometry)
|
void update_size (Meta.Rectangle monitor_geometry) {
|
||||||
{
|
|
||||||
if (window_container.width != monitor_geometry.width || window_container.height != monitor_geometry.height) {
|
if (window_container.width != monitor_geometry.width || window_container.height != monitor_geometry.height) {
|
||||||
window_container.set_size (monitor_geometry.width, monitor_geometry.height);
|
window_container.set_size (monitor_geometry.width, monitor_geometry.height);
|
||||||
background.set_size (window_container.width, window_container.height);
|
background.set_size (window_container.width, window_container.height);
|
||||||
@ -342,8 +325,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param amount The amount in px to shrink.
|
* @param amount The amount in px to shrink.
|
||||||
*/
|
*/
|
||||||
static inline void shrink_rectangle (ref Meta.Rectangle rect, int amount)
|
static inline void shrink_rectangle (ref Meta.Rectangle rect, int amount) {
|
||||||
{
|
|
||||||
rect.x += amount;
|
rect.x += amount;
|
||||||
rect.y += amount;
|
rect.y += amount;
|
||||||
rect.width -= amount * 2;
|
rect.width -= amount * 2;
|
||||||
@ -356,8 +338,7 @@ namespace Gala
|
|||||||
* Also sets the current_window of the WindowCloneContainer to the active window
|
* Also sets the current_window of the WindowCloneContainer to the active window
|
||||||
* if it belongs to this workspace.
|
* if it belongs to this workspace.
|
||||||
*/
|
*/
|
||||||
public void open ()
|
public void open () {
|
||||||
{
|
|
||||||
if (opened)
|
if (opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -413,8 +394,7 @@ namespace Gala
|
|||||||
* Close the view again by animating the background back to its scale and
|
* Close the view again by animating the background back to its scale and
|
||||||
* the windows back to their old locations.
|
* the windows back to their old locations.
|
||||||
*/
|
*/
|
||||||
public void close ()
|
public void close () {
|
||||||
{
|
|
||||||
if (!opened)
|
if (!opened)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -18,10 +18,8 @@
|
|||||||
using Clutter;
|
using Clutter;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class WorkspaceInsertThumb : Actor {
|
||||||
public class WorkspaceInsertThumb : Actor
|
|
||||||
{
|
|
||||||
public const int EXPAND_DELAY = 300;
|
public const int EXPAND_DELAY = 300;
|
||||||
|
|
||||||
public int workspace_index { get; construct set; }
|
public int workspace_index { get; construct set; }
|
||||||
@ -30,8 +28,7 @@ namespace Gala
|
|||||||
|
|
||||||
uint expand_timeout = 0;
|
uint expand_timeout = 0;
|
||||||
|
|
||||||
public WorkspaceInsertThumb (int workspace_index)
|
public WorkspaceInsertThumb (int workspace_index) {
|
||||||
{
|
|
||||||
Object (workspace_index: workspace_index);
|
Object (workspace_index: workspace_index);
|
||||||
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
@ -62,8 +59,7 @@ namespace Gala
|
|||||||
add_action (drop);
|
add_action (drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set_window_thumb (Window window)
|
public void set_window_thumb (Window window) {
|
||||||
{
|
|
||||||
destroy_all_children ();
|
destroy_all_children ();
|
||||||
|
|
||||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||||
@ -73,8 +69,7 @@ namespace Gala
|
|||||||
add_child (icon);
|
add_child (icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool expand ()
|
bool expand () {
|
||||||
{
|
|
||||||
expand_timeout = 0;
|
expand_timeout = 0;
|
||||||
|
|
||||||
transform (true);
|
transform (true);
|
||||||
@ -82,8 +77,7 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void transform (bool expand)
|
void transform (bool expand) {
|
||||||
{
|
|
||||||
save_easing_state ();
|
save_easing_state ();
|
||||||
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
|
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
|
||||||
set_easing_duration (200);
|
set_easing_duration (200);
|
||||||
@ -104,8 +98,7 @@ namespace Gala
|
|||||||
restore_easing_state ();
|
restore_easing_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_pulse_animation ()
|
void add_pulse_animation () {
|
||||||
{
|
|
||||||
var transition = new TransitionGroup ();
|
var transition = new TransitionGroup ();
|
||||||
transition.duration = 800;
|
transition.duration = 800;
|
||||||
transition.auto_reverse = true;
|
transition.auto_reverse = true;
|
||||||
|
@ -18,20 +18,17 @@
|
|||||||
using Gala;
|
using Gala;
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
public struct WindowGeometry {
|
public struct WindowGeometry {
|
||||||
Meta.Rectangle inner;
|
Meta.Rectangle inner;
|
||||||
Meta.Rectangle outer;
|
Meta.Rectangle outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WindowListener : Object
|
public class WindowListener : Object {
|
||||||
{
|
|
||||||
static WindowListener? instance = null;
|
static WindowListener? instance = null;
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
public static void init (Meta.Display display)
|
public static void init (Meta.Display display) {
|
||||||
{
|
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -52,8 +49,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public static void init (Screen screen)
|
public static void init (Screen screen) {
|
||||||
{
|
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -75,9 +71,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static unowned WindowListener get_default ()
|
public static unowned WindowListener get_default () requires (instance != null) {
|
||||||
requires (instance != null)
|
|
||||||
{
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,21 +79,18 @@ namespace Gala
|
|||||||
|
|
||||||
Gee.HashMap<Meta.Window, WindowGeometry?> unmaximized_state_geometry;
|
Gee.HashMap<Meta.Window, WindowGeometry?> unmaximized_state_geometry;
|
||||||
|
|
||||||
WindowListener ()
|
WindowListener () {
|
||||||
{
|
|
||||||
unmaximized_state_geometry = new Gee.HashMap<Meta.Window, WindowGeometry?> ();
|
unmaximized_state_geometry = new Gee.HashMap<Meta.Window, WindowGeometry?> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void monitor_window (Window window)
|
void monitor_window (Window window) {
|
||||||
{
|
|
||||||
window.notify.connect (window_notify);
|
window.notify.connect (window_notify);
|
||||||
window.unmanaged.connect (window_removed);
|
window.unmanaged.connect (window_removed);
|
||||||
|
|
||||||
window_maximized_changed (window);
|
window_maximized_changed (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_notify (Object object, ParamSpec pspec)
|
void window_notify (Object object, ParamSpec pspec) {
|
||||||
{
|
|
||||||
var window = (Window) object;
|
var window = (Window) object;
|
||||||
|
|
||||||
switch (pspec.name) {
|
switch (pspec.name) {
|
||||||
@ -113,16 +104,14 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_on_all_workspaces_changed (Window window)
|
void window_on_all_workspaces_changed (Window window) {
|
||||||
{
|
|
||||||
if (window.on_all_workspaces)
|
if (window.on_all_workspaces)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window_no_longer_on_all_workspaces (window);
|
window_no_longer_on_all_workspaces (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_maximized_changed (Window window)
|
void window_maximized_changed (Window window) {
|
||||||
{
|
|
||||||
WindowGeometry window_geometry = {};
|
WindowGeometry window_geometry = {};
|
||||||
window_geometry.inner = window.get_frame_rect ();
|
window_geometry.inner = window.get_frame_rect ();
|
||||||
window_geometry.outer = window.get_buffer_rect ();
|
window_geometry.outer = window.get_buffer_rect ();
|
||||||
@ -130,13 +119,11 @@ namespace Gala
|
|||||||
unmaximized_state_geometry.@set (window, window_geometry);
|
unmaximized_state_geometry.@set (window, window_geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowGeometry? get_unmaximized_state_geometry (Window window)
|
public WindowGeometry? get_unmaximized_state_geometry (Window window) {
|
||||||
{
|
|
||||||
return unmaximized_state_geometry.@get (window);
|
return unmaximized_state_geometry.@get (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_removed (Window window)
|
void window_removed (Window window) {
|
||||||
{
|
|
||||||
window.notify.disconnect (window_notify);
|
window.notify.disconnect (window_notify);
|
||||||
window.unmanaged.disconnect (window_removed);
|
window.unmanaged.disconnect (window_removed);
|
||||||
}
|
}
|
||||||
|
@ -17,19 +17,16 @@
|
|||||||
|
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
|
||||||
const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
|
const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
|
||||||
const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";
|
const string DAEMON_DBUS_OBJECT_PATH = "/org/pantheon/gala/daemon";
|
||||||
|
|
||||||
[DBus (name = "org.pantheon.gala.daemon")]
|
[DBus (name = "org.pantheon.gala.daemon")]
|
||||||
public interface Daemon: GLib.Object
|
public interface Daemon: GLib.Object {
|
||||||
{
|
|
||||||
public abstract async void show_window_menu (WindowFlags flags, int x, int y) throws Error;
|
public abstract async void show_window_menu (WindowFlags flags, int x, int y) throws Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WindowManagerGala : Meta.Plugin, WindowManager
|
public class WindowManagerGala : Meta.Plugin, WindowManager {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@ -90,8 +87,7 @@ namespace Gala
|
|||||||
|
|
||||||
GLib.Settings animations_settings;
|
GLib.Settings animations_settings;
|
||||||
|
|
||||||
public WindowManagerGala ()
|
public WindowManagerGala () {
|
||||||
{
|
|
||||||
info = Meta.PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",
|
info = Meta.PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",
|
||||||
license = "GPLv3", description = "A nice elementary window manager"};
|
license = "GPLv3", description = "A nice elementary window manager"};
|
||||||
|
|
||||||
@ -113,8 +109,7 @@ namespace Gala
|
|||||||
enable_animations = animations_settings.get_boolean ("enable-animations");
|
enable_animations = animations_settings.get_boolean ("enable-animations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void start ()
|
public override void start () {
|
||||||
{
|
|
||||||
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
||||||
|
|
||||||
Bus.watch_name (BusType.SESSION, DAEMON_DBUS_NAME, BusNameWatcherFlags.NONE, daemon_appeared, lost_daemon);
|
Bus.watch_name (BusType.SESSION, DAEMON_DBUS_NAME, BusNameWatcherFlags.NONE, daemon_appeared, lost_daemon);
|
||||||
@ -130,8 +125,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_menu_get (GLib.Object? o, GLib.AsyncResult? res)
|
void on_menu_get (GLib.Object? o, GLib.AsyncResult? res) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
daemon_proxy = Bus.get_proxy.end (res);
|
daemon_proxy = Bus.get_proxy.end (res);
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
@ -139,20 +133,17 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lost_daemon ()
|
void lost_daemon () {
|
||||||
{
|
|
||||||
daemon_proxy = null;
|
daemon_proxy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void daemon_appeared ()
|
void daemon_appeared () {
|
||||||
{
|
|
||||||
if (daemon_proxy == null) {
|
if (daemon_proxy == null) {
|
||||||
Bus.get_proxy.begin<Daemon> (BusType.SESSION, DAEMON_DBUS_NAME, DAEMON_DBUS_OBJECT_PATH, 0, null, on_menu_get);
|
Bus.get_proxy.begin<Daemon> (BusType.SESSION, DAEMON_DBUS_NAME, DAEMON_DBUS_OBJECT_PATH, 0, null, on_menu_get);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_stage ()
|
bool show_stage () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
#else
|
#else
|
||||||
@ -371,8 +362,7 @@ namespace Gala
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure_hotcorners ()
|
void configure_hotcorners () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
|
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
|
||||||
@ -388,8 +378,7 @@ namespace Gala
|
|||||||
update_input_area ();
|
update_input_area ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_hotcorner (float x, float y, string key)
|
void add_hotcorner (float x, float y, string key) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Clutter.Actor? stage = get_display ().get_stage ();
|
unowned Clutter.Actor? stage = get_display ().get_stage ();
|
||||||
#else
|
#else
|
||||||
@ -431,8 +420,7 @@ namespace Gala
|
|||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
|
void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event,
|
||||||
Meta.KeyBinding binding)
|
Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1);
|
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1);
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
var index = manager.get_active_workspace_index () + direction;
|
var index = manager.get_active_workspace_index () + direction;
|
||||||
@ -449,8 +437,7 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_move_to_workspace (Meta.Display display, Meta.Window? window,
|
void handle_move_to_workspace (Meta.Display display, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -460,8 +447,7 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_move_to_workspace_end (Meta.Display display, Meta.Window? window,
|
void handle_move_to_workspace_end (Meta.Display display, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -474,16 +460,14 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_switch_to_workspace (Meta.Display display, Meta.Window? window,
|
void handle_switch_to_workspace (Meta.Display display, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
|
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
|
||||||
switch_to_next_workspace (direction);
|
switch_to_next_workspace (direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_switch_to_workspace_end (Meta.Display display, Meta.Window? window,
|
void handle_switch_to_workspace_end (Meta.Display display, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : manager.n_workspaces - 1);
|
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : manager.n_workspaces - 1);
|
||||||
manager.get_workspace_by_index (index).activate (display.get_current_time ());
|
manager.get_workspace_by_index (index).activate (display.get_current_time ());
|
||||||
@ -491,8 +475,7 @@ namespace Gala
|
|||||||
#else
|
#else
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_cycle_workspaces (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
void handle_cycle_workspaces (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1);
|
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1);
|
||||||
var index = screen.get_active_workspace_index () + direction;
|
var index = screen.get_active_workspace_index () + direction;
|
||||||
|
|
||||||
@ -508,8 +491,7 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_move_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
void handle_move_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -519,8 +501,7 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_move_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
void handle_move_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -532,16 +513,14 @@ namespace Gala
|
|||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
|
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT);
|
||||||
switch_to_next_workspace (direction);
|
switch_to_next_workspace (direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
void handle_switch_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
void handle_switch_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window,
|
||||||
Clutter.KeyEvent event, Meta.KeyBinding binding)
|
Clutter.KeyEvent event, Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : screen.n_workspaces - 1);
|
var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : screen.n_workspaces - 1);
|
||||||
screen.get_workspace_by_index (index).activate (display.get_current_time ());
|
screen.get_workspace_by_index (index).activate (display.get_current_time ());
|
||||||
}
|
}
|
||||||
@ -550,8 +529,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void switch_to_next_workspace (MotionDirection direction)
|
public void switch_to_next_workspace (MotionDirection direction) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
var active_workspace = display.get_workspace_manager ().get_active_workspace ();
|
var active_workspace = display.get_workspace_manager ().get_active_workspace ();
|
||||||
@ -589,8 +567,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void update_input_area ()
|
void update_input_area () {
|
||||||
{
|
|
||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
|
|
||||||
if (screensaver != null) {
|
if (screensaver != null) {
|
||||||
@ -613,8 +590,7 @@ namespace Gala
|
|||||||
InternalUtils.set_input_area (display, InputArea.DEFAULT);
|
InternalUtils.set_input_area (display, InputArea.DEFAULT);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void update_input_area ()
|
void update_input_area () {
|
||||||
{
|
|
||||||
var screen = get_screen ();
|
var screen = get_screen ();
|
||||||
|
|
||||||
if (screensaver != null) {
|
if (screensaver != null) {
|
||||||
@ -638,8 +614,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void show_bottom_stack_window (Meta.Window bottom_window)
|
void show_bottom_stack_window (Meta.Window bottom_window) {
|
||||||
{
|
|
||||||
unowned Meta.Workspace workspace = bottom_window.get_workspace ();
|
unowned Meta.Workspace workspace = bottom_window.get_workspace ();
|
||||||
if (Utils.get_n_windows (workspace) == 0) {
|
if (Utils.get_n_windows (workspace) == 0) {
|
||||||
return;
|
return;
|
||||||
@ -688,8 +663,7 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void animate_bottom_window_scale (Meta.WindowActor actor)
|
void animate_bottom_window_scale (Meta.WindowActor actor) {
|
||||||
{
|
|
||||||
const string[] props = { "scale-x", "scale-y" };
|
const string[] props = { "scale-x", "scale-y" };
|
||||||
|
|
||||||
foreach (string prop in props) {
|
foreach (string prop in props) {
|
||||||
@ -709,8 +683,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint32[] get_all_xids ()
|
public uint32[] get_all_xids () {
|
||||||
{
|
|
||||||
var list = new Gee.ArrayList<uint32> ();
|
var list = new Gee.ArrayList<uint32> ();
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -734,8 +707,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void move_window (Window? window, MotionDirection direction)
|
public void move_window (Window? window, MotionDirection direction) {
|
||||||
{
|
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -777,8 +749,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public ModalProxy push_modal ()
|
public ModalProxy push_modal () {
|
||||||
{
|
|
||||||
var proxy = new ModalProxy ();
|
var proxy = new ModalProxy ();
|
||||||
|
|
||||||
modal_stack.offer_head (proxy);
|
modal_stack.offer_head (proxy);
|
||||||
@ -810,8 +781,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void pop_modal (ModalProxy proxy)
|
public void pop_modal (ModalProxy proxy) {
|
||||||
{
|
|
||||||
if (!modal_stack.remove (proxy)) {
|
if (!modal_stack.remove (proxy)) {
|
||||||
warning ("Attempted to remove a modal proxy that was not in the stack");
|
warning ("Attempted to remove a modal proxy that was not in the stack");
|
||||||
return;
|
return;
|
||||||
@ -838,27 +808,23 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public bool is_modal ()
|
public bool is_modal () {
|
||||||
{
|
|
||||||
return (modal_stack.size > 0);
|
return (modal_stack.size > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public bool modal_proxy_valid (ModalProxy proxy)
|
public bool modal_proxy_valid (ModalProxy proxy) {
|
||||||
{
|
|
||||||
return (proxy in modal_stack);
|
return (proxy in modal_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void get_current_cursor_position (out int x, out int y)
|
public void get_current_cursor_position (out int x, out int y) {
|
||||||
{
|
|
||||||
Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().get_position (null,
|
Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().get_position (null,
|
||||||
out x, out y);
|
out x, out y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dim_window (Window window, bool dim)
|
public void dim_window (Window window, bool dim) {
|
||||||
{
|
|
||||||
/*FIXME we need a super awesome blureffect here, the one from clutter is just... bah!
|
/*FIXME we need a super awesome blureffect here, the one from clutter is just... bah!
|
||||||
var win = window.get_compositor_private () as WindowActor;
|
var win = window.get_compositor_private () as WindowActor;
|
||||||
if (dim) {
|
if (dim) {
|
||||||
@ -872,8 +838,7 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public void perform_action (ActionType type)
|
public void perform_action (ActionType type) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = get_display ();
|
unowned Meta.Display display = get_display ();
|
||||||
var current = display.get_focus_window ();
|
var current = display.get_focus_window ();
|
||||||
@ -1021,8 +986,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void show_window_menu (Meta.Window window, Meta.WindowMenuType menu, int x, int y)
|
public override void show_window_menu (Meta.Window window, Meta.WindowMenuType menu, int x, int y) {
|
||||||
{
|
|
||||||
switch (menu) {
|
switch (menu) {
|
||||||
case WindowMenuType.WM:
|
case WindowMenuType.WM:
|
||||||
if (daemon_proxy == null) {
|
if (daemon_proxy == null) {
|
||||||
@ -1066,8 +1030,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void show_tile_preview (Meta.Window window, Meta.Rectangle tile_rect, int tile_monitor_number)
|
public override void show_tile_preview (Meta.Window window, Meta.Rectangle tile_rect, int tile_monitor_number) {
|
||||||
{
|
|
||||||
if (tile_preview == null) {
|
if (tile_preview == null) {
|
||||||
tile_preview = new Clutter.Actor ();
|
tile_preview = new Clutter.Actor ();
|
||||||
tile_preview.background_color = { 100, 186, 255, 100 };
|
tile_preview.background_color = { 100, 186, 255, 100 };
|
||||||
@ -1108,8 +1071,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void hide_tile_preview ()
|
public override void hide_tile_preview () {
|
||||||
{
|
|
||||||
if (tile_preview != null) {
|
if (tile_preview != null) {
|
||||||
tile_preview.remove_all_transitions ();
|
tile_preview.remove_all_transitions ();
|
||||||
tile_preview.opacity = 0U;
|
tile_preview.opacity = 0U;
|
||||||
@ -1117,8 +1079,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void show_window_menu_for_rect (Meta.Window window, Meta.WindowMenuType menu, Meta.Rectangle rect)
|
public override void show_window_menu_for_rect (Meta.Window window, Meta.WindowMenuType menu, Meta.Rectangle rect) {
|
||||||
{
|
|
||||||
show_window_menu (window, menu, rect.x, rect.y);
|
show_window_menu (window, menu, rect.x, rect.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1126,8 +1087,7 @@ namespace Gala
|
|||||||
* effects
|
* effects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void handle_fullscreen_window (Meta.Window window, Meta.SizeChange which_change)
|
void handle_fullscreen_window (Meta.Window window, Meta.SizeChange which_change) {
|
||||||
{
|
|
||||||
// Only handle windows which are located on the primary monitor
|
// Only handle windows which are located on the primary monitor
|
||||||
if (!window.is_on_primary_monitor ())
|
if (!window.is_on_primary_monitor ())
|
||||||
return;
|
return;
|
||||||
@ -1197,8 +1157,7 @@ namespace Gala
|
|||||||
|
|
||||||
// must wait for size_changed to get updated frame_rect
|
// must wait for size_changed to get updated frame_rect
|
||||||
// as which_change is not passed to size_changed, save it as instance variable
|
// as which_change is not passed to size_changed, save it as instance variable
|
||||||
public override void size_change (Meta.WindowActor actor, Meta.SizeChange which_change_local, Meta.Rectangle old_frame_rect, Meta.Rectangle old_buffer_rect)
|
public override void size_change (Meta.WindowActor actor, Meta.SizeChange which_change_local, Meta.Rectangle old_frame_rect, Meta.Rectangle old_buffer_rect) {
|
||||||
{
|
|
||||||
which_change = which_change_local;
|
which_change = which_change_local;
|
||||||
old_rect_size_change = old_frame_rect;
|
old_rect_size_change = old_frame_rect;
|
||||||
}
|
}
|
||||||
@ -1242,8 +1201,7 @@ namespace Gala
|
|||||||
size_change_completed (actor);
|
size_change_completed (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void minimize (WindowActor actor)
|
public override void minimize (WindowActor actor) {
|
||||||
{
|
|
||||||
const int duration = AnimationDuration.MINIMIZE;
|
const int duration = AnimationDuration.MINIMIZE;
|
||||||
|
|
||||||
if (!enable_animations
|
if (!enable_animations
|
||||||
@ -1317,8 +1275,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void maximize (WindowActor actor, int ex, int ey, int ew, int eh)
|
void maximize (WindowActor actor, int ex, int ey, int ew, int eh) {
|
||||||
{
|
|
||||||
const int duration = AnimationDuration.SNAP;
|
const int duration = AnimationDuration.SNAP;
|
||||||
|
|
||||||
if (!enable_animations
|
if (!enable_animations
|
||||||
@ -1412,8 +1369,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void unminimize (WindowActor actor)
|
public override void unminimize (WindowActor actor) {
|
||||||
{
|
|
||||||
if (!enable_animations) {
|
if (!enable_animations) {
|
||||||
actor.show ();
|
actor.show ();
|
||||||
unminimize_completed (actor);
|
unminimize_completed (actor);
|
||||||
@ -1460,8 +1416,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void map (WindowActor actor)
|
public override void map (WindowActor actor) {
|
||||||
{
|
|
||||||
var window = actor.get_meta_window ();
|
var window = actor.get_meta_window ();
|
||||||
if (!enable_animations) {
|
if (!enable_animations) {
|
||||||
actor.show ();
|
actor.show ();
|
||||||
@ -1583,8 +1538,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void destroy (WindowActor actor)
|
public override void destroy (WindowActor actor) {
|
||||||
{
|
|
||||||
var window = actor.get_meta_window ();
|
var window = actor.get_meta_window ();
|
||||||
|
|
||||||
ws_assoc.remove (window);
|
ws_assoc.remove (window);
|
||||||
@ -1681,8 +1635,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmaximize (Meta.WindowActor actor, int ex, int ey, int ew, int eh)
|
void unmaximize (Meta.WindowActor actor, int ex, int ey, int ew, int eh) {
|
||||||
{
|
|
||||||
const int duration = AnimationDuration.SNAP;
|
const int duration = AnimationDuration.SNAP;
|
||||||
if (!enable_animations
|
if (!enable_animations
|
||||||
|| duration == 0) {
|
|| duration == 0) {
|
||||||
@ -1764,8 +1717,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_window_to_next_ws (Window window)
|
void move_window_to_next_ws (Window window) {
|
||||||
{
|
|
||||||
unowned Workspace win_ws = window.get_workspace ();
|
unowned Workspace win_ws = window.get_workspace ();
|
||||||
|
|
||||||
// Do nothing if the current workspace would be empty
|
// Do nothing if the current workspace would be empty
|
||||||
@ -1792,8 +1744,7 @@ namespace Gala
|
|||||||
ws_assoc.insert (window, old_ws_index);
|
ws_assoc.insert (window, old_ws_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_window_to_old_ws (Window window)
|
void move_window_to_old_ws (Window window) {
|
||||||
{
|
|
||||||
unowned Workspace win_ws = window.get_workspace ();
|
unowned Workspace win_ws = window.get_workspace ();
|
||||||
|
|
||||||
// Do nothing if the current workspace is populated with other windows
|
// Do nothing if the current workspace is populated with other windows
|
||||||
@ -1804,7 +1755,7 @@ namespace Gala
|
|||||||
if (!ws_assoc.contains (window)) {
|
if (!ws_assoc.contains (window)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var old_ws_index = ws_assoc.get (window);
|
var old_ws_index = ws_assoc.get (window);
|
||||||
var new_ws_index = win_ws.index ();
|
var new_ws_index = win_ws.index ();
|
||||||
|
|
||||||
@ -1828,8 +1779,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cancel attached animation of an actor and reset it
|
// Cancel attached animation of an actor and reset it
|
||||||
bool end_animation (ref Gee.HashSet<Meta.WindowActor> list, WindowActor actor)
|
bool end_animation (ref Gee.HashSet<Meta.WindowActor> list, WindowActor actor) {
|
||||||
{
|
|
||||||
if (!list.contains (actor))
|
if (!list.contains (actor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1848,8 +1798,7 @@ namespace Gala
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void kill_window_effects (WindowActor actor)
|
public override void kill_window_effects (WindowActor actor) {
|
||||||
{
|
|
||||||
if (end_animation (ref mapping, actor))
|
if (end_animation (ref mapping, actor))
|
||||||
map_completed (actor);
|
map_completed (actor);
|
||||||
if (end_animation (ref unminimizing, actor))
|
if (end_animation (ref unminimizing, actor))
|
||||||
@ -1868,8 +1817,7 @@ namespace Gala
|
|||||||
List<Clutter.Actor>? parents;
|
List<Clutter.Actor>? parents;
|
||||||
List<Clutter.Actor>? tmp_actors;
|
List<Clutter.Actor>? tmp_actors;
|
||||||
|
|
||||||
public override void switch_workspace (int from, int to, MotionDirection direction)
|
public override void switch_workspace (int from, int to, MotionDirection direction) {
|
||||||
{
|
|
||||||
const int animation_duration = AnimationDuration.WORKSPACE_SWITCH;
|
const int animation_duration = AnimationDuration.WORKSPACE_SWITCH;
|
||||||
|
|
||||||
if (!enable_animations
|
if (!enable_animations
|
||||||
@ -2093,8 +2041,7 @@ namespace Gala
|
|||||||
end_switch_workspace ();
|
end_switch_workspace ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void end_switch_workspace ()
|
void end_switch_workspace () {
|
||||||
{
|
|
||||||
if (windows == null || parents == null)
|
if (windows == null || parents == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2165,13 +2112,11 @@ namespace Gala
|
|||||||
switch_workspace_completed ();
|
switch_workspace_completed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void kill_switch_workspace ()
|
public override void kill_switch_workspace () {
|
||||||
{
|
|
||||||
end_switch_workspace ();
|
end_switch_workspace ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool keybinding_filter (Meta.KeyBinding binding)
|
public override bool keybinding_filter (Meta.KeyBinding binding) {
|
||||||
{
|
|
||||||
if (!is_modal ())
|
if (!is_modal ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2182,8 +2127,7 @@ namespace Gala
|
|||||||
&& modal_proxy.keybinding_filter (binding));
|
&& modal_proxy.keybinding_filter (binding));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void confirm_display_change ()
|
public override void confirm_display_change () {
|
||||||
{
|
|
||||||
var pid = Util.show_dialog ("--question",
|
var pid = Util.show_dialog ("--question",
|
||||||
_("Does the display look OK?"),
|
_("Does the display look OK?"),
|
||||||
"30",
|
"30",
|
||||||
@ -2204,13 +2148,11 @@ namespace Gala
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override unowned Meta.PluginInfo? plugin_info ()
|
public override unowned Meta.PluginInfo? plugin_info () {
|
||||||
{
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent)
|
static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent) {
|
||||||
{
|
|
||||||
if (actor == new_parent)
|
if (actor == new_parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -17,19 +17,13 @@
|
|||||||
|
|
||||||
using Meta;
|
using Meta;
|
||||||
|
|
||||||
namespace Gala
|
namespace Gala {
|
||||||
{
|
public class WorkspaceManager : Object {
|
||||||
public class WorkspaceManager : Object
|
public static void init (WindowManager wm) requires (instance == null) {
|
||||||
{
|
|
||||||
public static void init (WindowManager wm)
|
|
||||||
requires (instance == null)
|
|
||||||
{
|
|
||||||
instance = new WorkspaceManager (wm);
|
instance = new WorkspaceManager (wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unowned WorkspaceManager get_default ()
|
public static unowned WorkspaceManager get_default () requires (instance != null) {
|
||||||
requires (instance != null)
|
|
||||||
{
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +34,11 @@ namespace Gala
|
|||||||
Gee.LinkedList<Workspace> workspaces_marked_removed;
|
Gee.LinkedList<Workspace> workspaces_marked_removed;
|
||||||
int remove_freeze_count = 0;
|
int remove_freeze_count = 0;
|
||||||
|
|
||||||
WorkspaceManager (WindowManager wm)
|
WorkspaceManager (WindowManager wm) {
|
||||||
{
|
|
||||||
Object (wm: wm);
|
Object (wm: wm);
|
||||||
}
|
}
|
||||||
|
|
||||||
construct
|
construct {
|
||||||
{
|
|
||||||
workspaces_marked_removed = new Gee.LinkedList<Workspace> ();
|
workspaces_marked_removed = new Gee.LinkedList<Workspace> ();
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = wm.get_display ();
|
unowned Meta.Display display = wm.get_display ();
|
||||||
@ -97,8 +89,7 @@ namespace Gala
|
|||||||
cleanup ();
|
cleanup ();
|
||||||
}
|
}
|
||||||
|
|
||||||
~WorkspaceManager ()
|
~WorkspaceManager () {
|
||||||
{
|
|
||||||
Prefs.remove_listener (prefs_listener);
|
Prefs.remove_listener (prefs_listener);
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
@ -120,8 +111,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void workspace_added (Meta.WorkspaceManager manager, int index)
|
void workspace_added (Meta.WorkspaceManager manager, int index) {
|
||||||
{
|
|
||||||
var workspace = manager.get_workspace_by_index (index);
|
var workspace = manager.get_workspace_by_index (index);
|
||||||
if (workspace == null)
|
if (workspace == null)
|
||||||
return;
|
return;
|
||||||
@ -130,8 +120,7 @@ namespace Gala
|
|||||||
workspace.window_removed.connect (window_removed);
|
workspace.window_removed.connect (window_removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void workspace_removed (Meta.WorkspaceManager manager, int index)
|
void workspace_removed (Meta.WorkspaceManager manager, int index) {
|
||||||
{
|
|
||||||
List<Workspace> existing_workspaces = null;
|
List<Workspace> existing_workspaces = null;
|
||||||
for (int i = 0; i < manager.get_n_workspaces (); i++) {
|
for (int i = 0; i < manager.get_n_workspaces (); i++) {
|
||||||
existing_workspaces.append (manager.get_workspace_by_index (i));
|
existing_workspaces.append (manager.get_workspace_by_index (i));
|
||||||
@ -146,8 +135,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void workspace_switched (Meta.WorkspaceManager manager, int from, int to, MotionDirection direction)
|
void workspace_switched (Meta.WorkspaceManager manager, int from, int to, MotionDirection direction) {
|
||||||
{
|
|
||||||
if (!Prefs.get_dynamic_workspaces ())
|
if (!Prefs.get_dynamic_workspaces ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -159,8 +147,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void workspace_added (Screen screen, int index)
|
void workspace_added (Screen screen, int index) {
|
||||||
{
|
|
||||||
var workspace = screen.get_workspace_by_index (index);
|
var workspace = screen.get_workspace_by_index (index);
|
||||||
if (workspace == null)
|
if (workspace == null)
|
||||||
return;
|
return;
|
||||||
@ -169,8 +156,7 @@ namespace Gala
|
|||||||
workspace.window_removed.connect (window_removed);
|
workspace.window_removed.connect (window_removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void workspace_removed (Screen screen, int index)
|
void workspace_removed (Screen screen, int index) {
|
||||||
{
|
|
||||||
unowned List<Workspace> existing_workspaces = screen.get_workspaces ();
|
unowned List<Workspace> existing_workspaces = screen.get_workspaces ();
|
||||||
|
|
||||||
var it = workspaces_marked_removed.iterator ();
|
var it = workspaces_marked_removed.iterator ();
|
||||||
@ -180,8 +166,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void workspace_switched (Screen screen, int from, int to, MotionDirection direction)
|
void workspace_switched (Screen screen, int from, int to, MotionDirection direction) {
|
||||||
{
|
|
||||||
if (!Prefs.get_dynamic_workspaces ())
|
if (!Prefs.get_dynamic_workspaces ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -194,8 +179,7 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void window_added (Workspace? workspace, Window window)
|
void window_added (Workspace? workspace, Window window) {
|
||||||
{
|
|
||||||
if (workspace == null || !Prefs.get_dynamic_workspaces ()
|
if (workspace == null || !Prefs.get_dynamic_workspaces ()
|
||||||
|| window.on_all_workspaces)
|
|| window.on_all_workspaces)
|
||||||
return;
|
return;
|
||||||
@ -215,8 +199,7 @@ namespace Gala
|
|||||||
append_workspace ();
|
append_workspace ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_removed (Workspace? workspace, Window window)
|
void window_removed (Workspace? workspace, Window window) {
|
||||||
{
|
|
||||||
if (workspace == null || !Prefs.get_dynamic_workspaces () || window.on_all_workspaces)
|
if (workspace == null || !Prefs.get_dynamic_workspaces () || window.on_all_workspaces)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -252,37 +235,32 @@ namespace Gala
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
void window_entered_monitor (Meta.Display display, int monitor, Window window)
|
void window_entered_monitor (Meta.Display display, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (InternalUtils.workspaces_only_on_primary ()
|
if (InternalUtils.workspaces_only_on_primary ()
|
||||||
&& monitor == display.get_primary_monitor ())
|
&& monitor == display.get_primary_monitor ())
|
||||||
window_added (window.get_workspace (), window);
|
window_added (window.get_workspace (), window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_left_monitor (Meta.Display display, int monitor, Window window)
|
void window_left_monitor (Meta.Display display, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (InternalUtils.workspaces_only_on_primary ()
|
if (InternalUtils.workspaces_only_on_primary ()
|
||||||
&& monitor == display.get_primary_monitor ())
|
&& monitor == display.get_primary_monitor ())
|
||||||
window_removed (window.get_workspace (), window);
|
window_removed (window.get_workspace (), window);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void window_entered_monitor (Screen screen, int monitor, Window window)
|
void window_entered_monitor (Screen screen, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (InternalUtils.workspaces_only_on_primary ()
|
if (InternalUtils.workspaces_only_on_primary ()
|
||||||
&& monitor == screen.get_primary_monitor ())
|
&& monitor == screen.get_primary_monitor ())
|
||||||
window_added (window.get_workspace (), window);
|
window_added (window.get_workspace (), window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_left_monitor (Screen screen, int monitor, Window window)
|
void window_left_monitor (Screen screen, int monitor, Window window) {
|
||||||
{
|
|
||||||
if (InternalUtils.workspaces_only_on_primary ()
|
if (InternalUtils.workspaces_only_on_primary ()
|
||||||
&& monitor == screen.get_primary_monitor ())
|
&& monitor == screen.get_primary_monitor ())
|
||||||
window_removed (window.get_workspace (), window);
|
window_removed (window.get_workspace (), window);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void prefs_listener (Meta.Preference pref)
|
void prefs_listener (Meta.Preference pref) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
|
||||||
|
|
||||||
@ -302,8 +280,7 @@ namespace Gala
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void append_workspace ()
|
void append_workspace () {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = wm.get_display ();
|
unowned Meta.Display display = wm.get_display ();
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
@ -321,8 +298,7 @@ namespace Gala
|
|||||||
*
|
*
|
||||||
* @param workspace The workspace to remove
|
* @param workspace The workspace to remove
|
||||||
*/
|
*/
|
||||||
void remove_workspace (Workspace workspace)
|
void remove_workspace (Workspace workspace) {
|
||||||
{
|
|
||||||
#if HAS_MUTTER330
|
#if HAS_MUTTER330
|
||||||
unowned Meta.Display display = workspace.get_display ();
|
unowned Meta.Display display = workspace.get_display ();
|
||||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||||
@ -367,16 +343,14 @@ namespace Gala
|
|||||||
/**
|
/**
|
||||||
* Temporarily disables removing workspaces when they are empty
|
* Temporarily disables removing workspaces when they are empty
|
||||||
*/
|
*/
|
||||||
public void freeze_remove ()
|
public void freeze_remove () {
|
||||||
{
|
|
||||||
remove_freeze_count++;
|
remove_freeze_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undo the effect of freeze_remove()
|
* Undo the effect of freeze_remove()
|
||||||
*/
|
*/
|
||||||
public void thaw_remove ()
|
public void thaw_remove () {
|
||||||
{
|
|
||||||
remove_freeze_count--;
|
remove_freeze_count--;
|
||||||
|
|
||||||
assert (remove_freeze_count >= 0);
|
assert (remove_freeze_count >= 0);
|
||||||
@ -387,8 +361,7 @@ namespace Gala
|
|||||||
* be removed. Particularily useful in conjunction with freeze/thaw_remove to
|
* be removed. Particularily useful in conjunction with freeze/thaw_remove to
|
||||||
* cleanup after an operation that required stable workspace/window indices
|
* cleanup after an operation that required stable workspace/window indices
|
||||||
*/
|
*/
|
||||||
public void cleanup ()
|
public void cleanup () {
|
||||||
{
|
|
||||||
if (!Prefs.get_dynamic_workspaces ())
|
if (!Prefs.get_dynamic_workspaces ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user