mirror of
https://github.com/elementary/gala.git
synced 2024-08-15 10:00:45 +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
|
||||
*/
|
||||
public static void bell (Meta.Display display)
|
||||
{
|
||||
public static void bell (Meta.Display display) {
|
||||
if (Meta.Prefs.bell_is_audible ())
|
||||
Gdk.beep ();
|
||||
else
|
||||
|
@ -15,10 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class Animation : Object
|
||||
{
|
||||
namespace Gala {
|
||||
public class Animation : Object {
|
||||
public string filename { get; construct; }
|
||||
public string[] key_frame_files { get; private set; default = {}; }
|
||||
public double transition_progress { get; private set; default = 0.0; }
|
||||
@ -27,13 +25,11 @@ namespace Gala
|
||||
|
||||
Gnome.BGSlideShow? show = null;
|
||||
|
||||
public Animation (string filename)
|
||||
{
|
||||
public Animation (string filename) {
|
||||
Object (filename: filename);
|
||||
}
|
||||
|
||||
public async void load ()
|
||||
{
|
||||
public async void load () {
|
||||
show = new Gnome.BGSlideShow (filename);
|
||||
|
||||
show.load_async (null, (obj, res) => {
|
||||
@ -45,8 +41,7 @@ namespace Gala
|
||||
yield;
|
||||
}
|
||||
|
||||
public void update (Meta.Rectangle monitor)
|
||||
{
|
||||
public void update (Meta.Rectangle monitor) {
|
||||
string[] key_frame_files = {};
|
||||
|
||||
if (show == null)
|
||||
|
@ -15,10 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class Background : Object
|
||||
{
|
||||
namespace Gala {
|
||||
public class Background : Object {
|
||||
const double ANIMATION_OPACITY_STEP_INCREMENT = 4.0;
|
||||
const double ANIMATION_MIN_WAKEUP_INTERVAL = 1.0;
|
||||
|
||||
@ -44,8 +42,7 @@ namespace Gala
|
||||
|
||||
#if HAS_MUTTER330
|
||||
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,
|
||||
monitor_index: monitor_index,
|
||||
background_source: background_source,
|
||||
@ -54,8 +51,7 @@ namespace Gala
|
||||
}
|
||||
#else
|
||||
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,
|
||||
monitor_index: monitor_index,
|
||||
background_source: background_source,
|
||||
@ -64,8 +60,7 @@ namespace Gala
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
#if HAS_MUTTER330
|
||||
background = new Meta.Background (display);
|
||||
#else
|
||||
@ -81,8 +76,7 @@ namespace Gala
|
||||
load ();
|
||||
}
|
||||
|
||||
public void destroy ()
|
||||
{
|
||||
public void destroy () {
|
||||
cancellable.cancel ();
|
||||
remove_animation_timeout ();
|
||||
|
||||
@ -95,16 +89,14 @@ namespace Gala
|
||||
background_source.changed.disconnect (settings_changed);
|
||||
}
|
||||
|
||||
public void update_resolution ()
|
||||
{
|
||||
public void update_resolution () {
|
||||
if (animation != null) {
|
||||
remove_animation_timeout ();
|
||||
update_animation ();
|
||||
}
|
||||
}
|
||||
|
||||
void set_loaded ()
|
||||
{
|
||||
void set_loaded () {
|
||||
if (is_loaded)
|
||||
return;
|
||||
|
||||
@ -116,8 +108,7 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
|
||||
void load_pattern ()
|
||||
{
|
||||
void load_pattern () {
|
||||
string color_string;
|
||||
var settings = background_source.settings;
|
||||
|
||||
@ -135,8 +126,7 @@ namespace Gala
|
||||
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))
|
||||
return;
|
||||
|
||||
@ -153,16 +143,14 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
|
||||
void remove_animation_timeout ()
|
||||
{
|
||||
void remove_animation_timeout () {
|
||||
if (update_animation_timeout_id != 0) {
|
||||
Source.remove (update_animation_timeout_id);
|
||||
update_animation_timeout_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void update_animation ()
|
||||
{
|
||||
void update_animation () {
|
||||
update_animation_timeout_id = 0;
|
||||
|
||||
#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);
|
||||
|
||||
if (animation == null || cancellable.is_cancelled ()) {
|
||||
@ -245,8 +232,7 @@ namespace Gala
|
||||
watch_file (filename);
|
||||
}
|
||||
|
||||
void load_image (string filename)
|
||||
{
|
||||
void load_image (string filename) {
|
||||
background.set_file (File.new_for_path (filename), style);
|
||||
watch_file (filename);
|
||||
|
||||
@ -263,16 +249,14 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void load_file (string filename)
|
||||
{
|
||||
void load_file (string filename) {
|
||||
if (filename.has_suffix (".xml"))
|
||||
load_animation.begin (filename);
|
||||
else
|
||||
load_image (filename);
|
||||
}
|
||||
|
||||
void load ()
|
||||
{
|
||||
void load () {
|
||||
load_pattern ();
|
||||
|
||||
if (filename == null)
|
||||
@ -281,8 +265,7 @@ namespace Gala
|
||||
load_file (filename);
|
||||
}
|
||||
|
||||
void settings_changed ()
|
||||
{
|
||||
void settings_changed () {
|
||||
changed ();
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,11 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class BackgroundCache : Object
|
||||
{
|
||||
namespace Gala {
|
||||
public class BackgroundCache : Object {
|
||||
static BackgroundCache? instance = null;
|
||||
|
||||
public static unowned BackgroundCache get_default ()
|
||||
{
|
||||
public static unowned BackgroundCache get_default () {
|
||||
if (instance == null)
|
||||
instance = new BackgroundCache ();
|
||||
|
||||
@ -37,19 +34,16 @@ namespace Gala
|
||||
Animation animation;
|
||||
string animation_filename;
|
||||
|
||||
public BackgroundCache ()
|
||||
{
|
||||
public BackgroundCache () {
|
||||
Object ();
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
file_monitors = new Gee.HashMap<string,FileMonitor> ();
|
||||
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))
|
||||
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) {
|
||||
Idle.add (() => {
|
||||
get_animation.callback ();
|
||||
@ -92,11 +85,10 @@ namespace Gala
|
||||
}
|
||||
|
||||
#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
|
||||
public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema)
|
||||
public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema) {
|
||||
#endif
|
||||
{
|
||||
var background_source = background_sources[settings_schema];
|
||||
if (background_source == null) {
|
||||
#if HAS_MUTTER330
|
||||
@ -112,8 +104,7 @@ namespace Gala
|
||||
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)) {
|
||||
var source = background_sources[settings_schema];
|
||||
if (--source.use_count == 0) {
|
||||
|
@ -15,54 +15,45 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class BackgroundContainer : Meta.BackgroundGroup
|
||||
{
|
||||
namespace Gala {
|
||||
public class BackgroundContainer : Meta.BackgroundGroup {
|
||||
public signal void changed ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public Meta.Display display { get; construct; }
|
||||
|
||||
public BackgroundContainer (Meta.Display display)
|
||||
{
|
||||
public BackgroundContainer (Meta.Display display) {
|
||||
Object (display: display);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
Meta.MonitorManager.@get ().monitors_changed.connect (update);
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
~BackgroundContainer ()
|
||||
{
|
||||
~BackgroundContainer () {
|
||||
Meta.MonitorManager.@get ().monitors_changed.disconnect (update);
|
||||
}
|
||||
#else
|
||||
public Meta.Screen screen { get; construct; }
|
||||
|
||||
public BackgroundContainer (Meta.Screen screen)
|
||||
{
|
||||
public BackgroundContainer (Meta.Screen screen) {
|
||||
Object (screen: screen);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
screen.monitors_changed.connect (update);
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
~BackgroundContainer ()
|
||||
{
|
||||
~BackgroundContainer () {
|
||||
screen.monitors_changed.disconnect (update);
|
||||
}
|
||||
#endif
|
||||
|
||||
void update ()
|
||||
{
|
||||
void update () {
|
||||
var reference_child = (get_child_at_index (0) as BackgroundManager);
|
||||
if (reference_child != null)
|
||||
reference_child.changed.disconnect (background_changed);
|
||||
@ -84,8 +75,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void background_changed ()
|
||||
{
|
||||
void background_changed () {
|
||||
changed ();
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class BackgroundManager : Meta.BackgroundGroup
|
||||
{
|
||||
namespace Gala {
|
||||
public class BackgroundManager : Meta.BackgroundGroup {
|
||||
const string BACKGROUND_SCHEMA = "org.gnome.desktop.background";
|
||||
const int FADE_ANIMATION_TIME = 1000;
|
||||
|
||||
@ -37,19 +35,16 @@ namespace Gala
|
||||
Meta.BackgroundActor? new_background_actor = null;
|
||||
|
||||
#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);
|
||||
}
|
||||
#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);
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
#if HAS_MUTTER330
|
||||
background_source = BackgroundCache.get_default ().get_background_source (display, BACKGROUND_SCHEMA);
|
||||
#else
|
||||
@ -61,8 +56,7 @@ namespace Gala
|
||||
destroy.connect (on_destroy);
|
||||
}
|
||||
|
||||
void on_destroy ()
|
||||
{
|
||||
void on_destroy () {
|
||||
BackgroundCache.get_default ().release_background_source (BACKGROUND_SCHEMA);
|
||||
background_source = null;
|
||||
|
||||
@ -77,8 +71,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void swap_background_actor ()
|
||||
{
|
||||
void swap_background_actor () {
|
||||
return_if_fail (new_background_actor != null);
|
||||
|
||||
var old_background_actor = background_actor;
|
||||
@ -103,8 +96,7 @@ namespace Gala
|
||||
old_background_actor.add_transition ("fade-out", transition);
|
||||
}
|
||||
|
||||
void update_background_actor ()
|
||||
{
|
||||
void update_background_actor () {
|
||||
if (new_background_actor != null) {
|
||||
// Skip displaying existing background queued for load
|
||||
new_background_actor.destroy ();
|
||||
@ -137,8 +129,7 @@ namespace Gala
|
||||
background_actor.set_size (width, height);
|
||||
}
|
||||
|
||||
Meta.BackgroundActor create_background_actor ()
|
||||
{
|
||||
Meta.BackgroundActor create_background_actor () {
|
||||
var background = background_source.get_background (monitor_index);
|
||||
#if HAS_MUTTER330
|
||||
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/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class BackgroundSource : Object
|
||||
{
|
||||
namespace Gala {
|
||||
public class BackgroundSource : Object {
|
||||
public signal void changed ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -33,19 +31,16 @@ namespace Gala
|
||||
Gee.HashMap<int,Background> backgrounds;
|
||||
|
||||
#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));
|
||||
}
|
||||
#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));
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
backgrounds = new Gee.HashMap<int,Background> ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -58,8 +53,7 @@ namespace Gala
|
||||
settings.changed.connect (settings_changed);
|
||||
}
|
||||
|
||||
void monitors_changed ()
|
||||
{
|
||||
void monitors_changed () {
|
||||
#if HAS_MUTTER330
|
||||
var n = display.get_n_monitors ();
|
||||
#else
|
||||
@ -80,8 +74,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
public Background get_background (int monitor_index)
|
||||
{
|
||||
public Background get_background (int monitor_index) {
|
||||
string? filename = null;
|
||||
|
||||
var style = settings.get_enum ("picture-options");
|
||||
@ -113,15 +106,13 @@ namespace Gala
|
||||
return backgrounds[monitor_index];
|
||||
}
|
||||
|
||||
void background_changed (Background background)
|
||||
{
|
||||
void background_changed (Background background) {
|
||||
background.changed.disconnect (background_changed);
|
||||
background.destroy ();
|
||||
backgrounds.unset (background.monitor_index);
|
||||
}
|
||||
|
||||
public void destroy ()
|
||||
{
|
||||
public void destroy () {
|
||||
#if HAS_MUTTER330
|
||||
Meta.MonitorManager.@get ().monitors_changed.disconnect (monitors_changed);
|
||||
#else
|
||||
@ -139,8 +130,7 @@ namespace Gala
|
||||
// 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
|
||||
struct SettingsHashCache
|
||||
{
|
||||
struct SettingsHashCache {
|
||||
uint color_shading_type;
|
||||
uint picture_opacity;
|
||||
uint picture_options;
|
||||
@ -155,8 +145,7 @@ namespace Gala
|
||||
const string[] options = { "color-shading-type", "picture-opacity",
|
||||
"picture-options", "picture-uri", "primary-color", "secondary-color" };
|
||||
|
||||
void settings_changed (string key)
|
||||
{
|
||||
void settings_changed (string key) {
|
||||
if (!(key in options))
|
||||
return;
|
||||
|
||||
@ -171,8 +160,7 @@ namespace Gala
|
||||
changed ();
|
||||
}
|
||||
|
||||
SettingsHashCache get_current_settings_hash_cache ()
|
||||
{
|
||||
SettingsHashCache get_current_settings_hash_cache () {
|
||||
return {
|
||||
settings.get_value ("color-shading-type").hash (),
|
||||
settings.get_value ("picture-opacity").hash (),
|
||||
|
@ -15,14 +15,12 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
#if HAS_MUTTER332
|
||||
public class SystemBackground : GLib.Object
|
||||
public class SystemBackground : GLib.Object {
|
||||
#else
|
||||
public class SystemBackground : Meta.BackgroundActor
|
||||
public class SystemBackground : Meta.BackgroundActor {
|
||||
#endif
|
||||
{
|
||||
const Clutter.Color DEFAULT_BACKGROUND_COLOR = { 0x2e, 0x34, 0x36, 0xff };
|
||||
|
||||
static Meta.Background? system_background = null;
|
||||
@ -33,8 +31,7 @@ namespace Gala
|
||||
public signal void loaded ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public SystemBackground (Meta.Display display)
|
||||
{
|
||||
public SystemBackground (Meta.Display display) {
|
||||
#if HAS_MUTTER332
|
||||
Object (background_actor: new Meta.BackgroundActor (display, 0));
|
||||
#else
|
||||
@ -42,14 +39,12 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
public SystemBackground (Meta.Screen screen)
|
||||
{
|
||||
public SystemBackground (Meta.Screen screen) {
|
||||
Object (meta_screen: screen, monitor: 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
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;
|
||||
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.
|
||||
// (Last tested with mutter 3.28)
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
[DBus (name="org.pantheon.gala")]
|
||||
public class DBus
|
||||
{
|
||||
public class DBus {
|
||||
static DBus? instance;
|
||||
static WindowManager wm;
|
||||
|
||||
[DBus (visible = false)]
|
||||
public static void init (WindowManager _wm)
|
||||
{
|
||||
public static void init (WindowManager _wm) {
|
||||
wm = _wm;
|
||||
|
||||
Bus.own_name (BusType.SESSION, "org.pantheon.gala", BusNameOwnerFlags.NONE,
|
||||
@ -65,16 +62,14 @@ namespace Gala
|
||||
() => critical ("Could not acquire name") );
|
||||
}
|
||||
|
||||
private DBus ()
|
||||
{
|
||||
private DBus () {
|
||||
if (wm.background_group != null)
|
||||
(wm.background_group as BackgroundContainer).changed.connect (() => background_changed ());
|
||||
else
|
||||
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);
|
||||
}
|
||||
|
||||
@ -83,15 +78,13 @@ namespace Gala
|
||||
|
||||
class DummyOffscreenEffect : Clutter.OffscreenEffect {
|
||||
public signal void done_painting ();
|
||||
public override void post_paint ()
|
||||
{
|
||||
public override void post_paint () {
|
||||
base.post_paint ();
|
||||
done_painting ();
|
||||
}
|
||||
}
|
||||
|
||||
public struct ColorInformation
|
||||
{
|
||||
public struct ColorInformation {
|
||||
double average_red;
|
||||
double average_green;
|
||||
double average_blue;
|
||||
@ -123,8 +116,7 @@ namespace Gala
|
||||
*/
|
||||
public async ColorInformation get_background_color_information (int monitor,
|
||||
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);
|
||||
if (background == null)
|
||||
throw new DBusError.INVALID_ARGS ("Invalid monitor requested");
|
||||
|
@ -15,22 +15,18 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public struct Accelerator
|
||||
{
|
||||
namespace Gala {
|
||||
public struct Accelerator {
|
||||
public string name;
|
||||
public Meta.KeyBindingFlags flags;
|
||||
}
|
||||
|
||||
[DBus (name="org.gnome.Shell")]
|
||||
public class DBusAccelerator
|
||||
{
|
||||
public class DBusAccelerator {
|
||||
static DBusAccelerator? instance;
|
||||
|
||||
|
||||
[DBus (visible = false)]
|
||||
public static unowned DBusAccelerator init (WindowManager wm)
|
||||
{
|
||||
public static unowned DBusAccelerator init (WindowManager wm) {
|
||||
if (instance == null)
|
||||
instance = new DBusAccelerator (wm);
|
||||
|
||||
@ -42,8 +38,7 @@ namespace Gala
|
||||
WindowManager wm;
|
||||
HashTable<string, uint?> grabbed_accelerators;
|
||||
|
||||
DBusAccelerator (WindowManager _wm)
|
||||
{
|
||||
DBusAccelerator (WindowManager _wm) {
|
||||
wm = _wm;
|
||||
grabbed_accelerators = new HashTable<string, uint?> (str_hash, str_equal);
|
||||
|
||||
@ -55,11 +50,10 @@ namespace Gala
|
||||
}
|
||||
|
||||
#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
|
||||
void on_accelerator_activated (uint action, uint device_id, uint timestamp)
|
||||
void on_accelerator_activated (uint action, uint device_id, uint timestamp) {
|
||||
#endif
|
||||
{
|
||||
foreach (string accelerator in grabbed_accelerators.get_keys ()) {
|
||||
if (grabbed_accelerators[accelerator] == action) {
|
||||
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];
|
||||
|
||||
if (action == null) {
|
||||
@ -95,8 +88,7 @@ namespace Gala
|
||||
return action;
|
||||
}
|
||||
|
||||
public uint[] grab_accelerators (Accelerator[] accelerators) throws DBusError, IOError
|
||||
{
|
||||
public uint[] grab_accelerators (Accelerator[] accelerators) throws DBusError, IOError {
|
||||
uint[] actions = {};
|
||||
|
||||
foreach (unowned Accelerator? accelerator in accelerators) {
|
||||
@ -106,8 +98,7 @@ namespace Gala
|
||||
return actions;
|
||||
}
|
||||
|
||||
public bool ungrab_accelerator (uint action) throws DBusError, IOError
|
||||
{
|
||||
public bool ungrab_accelerator (uint action) throws DBusError, IOError {
|
||||
bool ret = false;
|
||||
|
||||
foreach (unowned string accelerator in grabbed_accelerators.get_keys ()) {
|
||||
@ -126,8 +117,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
[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;
|
||||
if (parameters.contains ("monitor"))
|
||||
monitor_index = parameters["monitor"].get_int32 ();
|
||||
@ -140,10 +130,10 @@ namespace Gala
|
||||
int32 level = 0;
|
||||
if (parameters.contains ("level"))
|
||||
level = parameters["level"].get_int32 ();
|
||||
|
||||
|
||||
//if (monitor_index > -1)
|
||||
// message ("MediaFeedback requested for specific monitor %i which is not supported", monitor_index);
|
||||
|
||||
|
||||
MediaFeedback.send (icon, level);
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,14 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* Provides access to a PlankDrawingDockTheme and PlankDockPrefereces
|
||||
*/
|
||||
public class DockThemeManager : Object
|
||||
{
|
||||
public class DockThemeManager : Object {
|
||||
static DockThemeManager? instance = null;
|
||||
|
||||
public static unowned DockThemeManager get_default ()
|
||||
{
|
||||
public static unowned DockThemeManager get_default () {
|
||||
if (instance == null)
|
||||
instance = new DockThemeManager ();
|
||||
|
||||
@ -38,27 +35,23 @@ namespace Gala
|
||||
public signal void dock_theme_changed (Plank.DockTheme? old_theme,
|
||||
Plank.DockTheme new_theme);
|
||||
|
||||
DockThemeManager ()
|
||||
{
|
||||
DockThemeManager () {
|
||||
dock_settings = new Plank.DockPreferences ("dock1");
|
||||
dock_settings.notify["Theme"].connect (load_dock_theme);
|
||||
}
|
||||
|
||||
public Plank.DockTheme get_dock_theme ()
|
||||
{
|
||||
public Plank.DockTheme get_dock_theme () {
|
||||
if (dock_theme == null)
|
||||
load_dock_theme ();
|
||||
|
||||
return dock_theme;
|
||||
}
|
||||
|
||||
public Plank.DockPreferences get_dock_settings ()
|
||||
{
|
||||
public Plank.DockPreferences get_dock_settings () {
|
||||
return dock_settings;
|
||||
}
|
||||
|
||||
void load_dock_theme ()
|
||||
{
|
||||
void load_dock_theme () {
|
||||
var new_theme = new Plank.DockTheme (dock_settings.Theme);
|
||||
new_theme.load ("dock");
|
||||
dock_theme_changed (dock_theme, new_theme);
|
||||
|
@ -17,17 +17,14 @@
|
||||
|
||||
using Clutter;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
[Flags]
|
||||
public enum DragDropActionType
|
||||
{
|
||||
public enum DragDropActionType {
|
||||
SOURCE,
|
||||
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>>? destinations = null;
|
||||
|
||||
@ -101,7 +98,7 @@ namespace Gala
|
||||
public bool allow_bubbling { get; set; default = true; }
|
||||
|
||||
public Actor? hovered { private get; set; default = null; }
|
||||
|
||||
|
||||
bool clicked = false;
|
||||
float last_x;
|
||||
float last_y;
|
||||
@ -114,8 +111,7 @@ namespace Gala
|
||||
* which destinations. It has to be the same for all actors that
|
||||
* 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);
|
||||
|
||||
if (sources == null)
|
||||
@ -126,14 +122,12 @@ namespace Gala
|
||||
|
||||
}
|
||||
|
||||
~DragDropAction ()
|
||||
{
|
||||
~DragDropAction () {
|
||||
if (actor != null)
|
||||
release_actor (actor);
|
||||
}
|
||||
|
||||
public override void set_actor (Actor? new_actor)
|
||||
{
|
||||
public override void set_actor (Actor? new_actor) {
|
||||
if (actor != null) {
|
||||
release_actor (actor);
|
||||
}
|
||||
@ -145,23 +139,21 @@ namespace Gala
|
||||
base.set_actor (new_actor);
|
||||
}
|
||||
|
||||
void release_actor (Actor actor)
|
||||
{
|
||||
void release_actor (Actor actor) {
|
||||
if (DragDropActionType.SOURCE in drag_type) {
|
||||
actor.button_press_event.disconnect (source_clicked);
|
||||
|
||||
var source_list = sources.@get (drag_id);
|
||||
source_list.remove (actor);
|
||||
}
|
||||
|
||||
|
||||
if (DragDropActionType.DESTINATION in drag_type) {
|
||||
var dest_list = destinations[drag_id];
|
||||
dest_list.remove (actor);
|
||||
}
|
||||
}
|
||||
|
||||
void connect_actor (Actor actor)
|
||||
{
|
||||
void connect_actor (Actor actor) {
|
||||
if (DragDropActionType.SOURCE in drag_type) {
|
||||
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);
|
||||
destination_crossed (destination, is_hovered);
|
||||
}
|
||||
|
||||
bool source_clicked (ButtonEvent event)
|
||||
{
|
||||
bool source_clicked (ButtonEvent event) {
|
||||
if (event.button != 1) {
|
||||
actor_clicked (event.button);
|
||||
return false;
|
||||
@ -206,8 +196,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
bool follow_move (Event event)
|
||||
{
|
||||
bool follow_move (Event event) {
|
||||
// still determining if we actually want to start a drag action
|
||||
if (!dragging) {
|
||||
switch (event.get_type ()) {
|
||||
@ -332,8 +321,7 @@ namespace Gala
|
||||
*
|
||||
* @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;
|
||||
|
||||
foreach (var action in actor.get_actions ()) {
|
||||
@ -352,8 +340,7 @@ namespace Gala
|
||||
/**
|
||||
* Abort the drag
|
||||
*/
|
||||
public void cancel ()
|
||||
{
|
||||
public void cancel () {
|
||||
cleanup ();
|
||||
|
||||
drag_canceled ();
|
||||
@ -362,8 +349,7 @@ namespace Gala
|
||||
/**
|
||||
* 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);
|
||||
if (actors == null)
|
||||
return;
|
||||
@ -379,8 +365,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void finish ()
|
||||
{
|
||||
void finish () {
|
||||
// make sure they reset the style or whatever they changed when hovered
|
||||
emit_crossed (hovered, false);
|
||||
|
||||
@ -389,8 +374,7 @@ namespace Gala
|
||||
drag_end (hovered);
|
||||
}
|
||||
|
||||
void cleanup ()
|
||||
{
|
||||
void cleanup () {
|
||||
var source_list = sources.@get (drag_id);
|
||||
if (source_list != null) {
|
||||
foreach (var actor in source_list) {
|
||||
|
@ -17,19 +17,15 @@
|
||||
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public enum InputArea
|
||||
{
|
||||
namespace Gala {
|
||||
public enum InputArea {
|
||||
NONE,
|
||||
FULLSCREEN,
|
||||
DEFAULT
|
||||
}
|
||||
|
||||
public class InternalUtils
|
||||
{
|
||||
public static bool workspaces_only_on_primary ()
|
||||
{
|
||||
public class InternalUtils {
|
||||
public static bool workspaces_only_on_primary () {
|
||||
return Prefs.get_dynamic_workspaces ()
|
||||
&& Prefs.get_workspaces_only_on_primary ();
|
||||
}
|
||||
@ -37,8 +33,7 @@ namespace Gala
|
||||
/*
|
||||
* Reload shadow settings
|
||||
*/
|
||||
public static void reload_shadow ()
|
||||
{
|
||||
public static void reload_shadow () {
|
||||
var factory = ShadowFactory.get_default ();
|
||||
var settings = ShadowSettings.get_default ();
|
||||
Meta.ShadowParams shadow;
|
||||
@ -72,8 +67,7 @@ namespace Gala
|
||||
* set the area where clutter can receive events
|
||||
**/
|
||||
#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 = {};
|
||||
int width, height;
|
||||
display.get_size (out width, out height);
|
||||
@ -128,8 +122,7 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
#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 ();
|
||||
|
||||
X.Xrectangle[] rects = {};
|
||||
@ -183,8 +176,7 @@ namespace Gala
|
||||
* @param index The index at which to insert the 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 ();
|
||||
workspace_manager.freeze_remove ();
|
||||
|
||||
@ -223,33 +215,27 @@ namespace Gala
|
||||
const int ACCURACY = 20;
|
||||
|
||||
// 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 k2 = b.y - a.y;
|
||||
|
||||
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)};
|
||||
}
|
||||
|
||||
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};
|
||||
}
|
||||
|
||||
public struct TilableWindow
|
||||
{
|
||||
public struct TilableWindow {
|
||||
Meta.Rectangle rect;
|
||||
void *id;
|
||||
}
|
||||
|
||||
public static List<TilableWindow?> calculate_grid_placement (Meta.Rectangle area,
|
||||
List<TilableWindow?> windows)
|
||||
{
|
||||
public static List<TilableWindow?> calculate_grid_placement (Meta.Rectangle area, List<TilableWindow?> windows) {
|
||||
uint window_count = windows.length ();
|
||||
int columns = (int)Math.ceil (Math.sqrt (window_count));
|
||||
int rows = (int)Math.ceil (window_count / (double)columns);
|
||||
@ -366,8 +352,7 @@ namespace Gala
|
||||
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 ()) {
|
||||
case Meta.WindowType.NORMAL:
|
||||
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 ();
|
||||
}
|
||||
}
|
||||
|
@ -15,15 +15,12 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class KeyboardManager : Object
|
||||
{
|
||||
namespace Gala {
|
||||
public class KeyboardManager : Object {
|
||||
static KeyboardManager? instance;
|
||||
static VariantType sources_variant_type;
|
||||
|
||||
public static void init (Meta.Display display)
|
||||
{
|
||||
public static void init (Meta.Display display) {
|
||||
if (instance != null)
|
||||
return;
|
||||
|
||||
@ -32,20 +29,17 @@ namespace Gala
|
||||
display.modifiers_accelerator_activated.connect (instance.handle_modifiers_accelerator_activated);
|
||||
}
|
||||
|
||||
static construct
|
||||
{
|
||||
static construct {
|
||||
sources_variant_type = new VariantType ("a(ss)");
|
||||
}
|
||||
|
||||
GLib.Settings settings;
|
||||
|
||||
KeyboardManager ()
|
||||
{
|
||||
KeyboardManager () {
|
||||
Object ();
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
|
||||
construct {
|
||||
var schema = GLib.SettingsSchemaSource.get_default ().lookup ("org.gnome.desktop.input-sources", true);
|
||||
if (schema == null)
|
||||
return;
|
||||
@ -57,8 +51,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
[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 ());
|
||||
|
||||
var sources = settings.get_value ("sources");
|
||||
@ -76,8 +69,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
[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"))
|
||||
return;
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
const OptionEntry[] OPTIONS = {
|
||||
{ "version", 0, OptionFlags.NO_ARG, OptionArg.CALLBACK, (void*) print_version, "Print version", null },
|
||||
{ null }
|
||||
@ -27,8 +26,7 @@ namespace Gala
|
||||
Meta.exit (Meta.ExitCode.SUCCESS);
|
||||
}
|
||||
|
||||
public static int main (string[] args)
|
||||
{
|
||||
public static int main (string[] args) {
|
||||
unowned OptionContext ctx = Meta.get_option_context ();
|
||||
ctx.add_main_entries (Gala.OPTIONS, null);
|
||||
try {
|
||||
|
@ -15,25 +15,20 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
[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,
|
||||
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]
|
||||
class Feedback
|
||||
{
|
||||
class Feedback {
|
||||
public string icon;
|
||||
public int32 level;
|
||||
|
||||
public Feedback (string _icon, int32 _level)
|
||||
{
|
||||
public Feedback (string _icon, int32 _level) {
|
||||
icon = _icon;
|
||||
level = _level;
|
||||
}
|
||||
@ -42,15 +37,13 @@ namespace Gala
|
||||
static MediaFeedback? instance = null;
|
||||
static ThreadPool<Feedback>? pool = null;
|
||||
|
||||
public static void init ()
|
||||
{
|
||||
public static void init () {
|
||||
if (instance == null)
|
||||
instance = new MediaFeedback ();
|
||||
}
|
||||
|
||||
public static void send (string icon, int val)
|
||||
requires (instance != null && pool != null)
|
||||
{
|
||||
requires (instance != null && pool != null) {
|
||||
try {
|
||||
pool.add (new Feedback (icon, val));
|
||||
} catch (ThreadError e) {
|
||||
@ -62,13 +55,11 @@ namespace Gala
|
||||
uint dbus_name_owner_changed_signal_id = 0;
|
||||
uint32 notification_id = 0;
|
||||
|
||||
MediaFeedback ()
|
||||
{
|
||||
MediaFeedback () {
|
||||
Object ();
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
try {
|
||||
pool = new ThreadPool<Feedback>.with_owned_data ((ThreadPoolFunc<Feedback>) send_feedback, 1, false);
|
||||
} catch (ThreadError e) {
|
||||
@ -86,8 +77,7 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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;
|
||||
parameters.get ("(sss)", out name, out before, out after);
|
||||
|
||||
@ -113,8 +103,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
[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);
|
||||
hints.set ("x-canonical-private-synchronous", new Variant.string ("gala-feedback"));
|
||||
hints.set ("value", new Variant.int32 (feedback.level));
|
||||
|
@ -15,15 +15,12 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
delegate PluginInfo RegisterPluginFunction ();
|
||||
|
||||
public class PluginManager : Object
|
||||
{
|
||||
public class PluginManager : Object {
|
||||
static PluginManager? instance = null;
|
||||
public static unowned PluginManager get_default ()
|
||||
{
|
||||
public static unowned PluginManager get_default () {
|
||||
if (instance == null)
|
||||
instance = new PluginManager ();
|
||||
|
||||
@ -48,8 +45,7 @@ namespace Gala
|
||||
|
||||
Gee.LinkedList<PluginInfo?> load_later_plugins;
|
||||
|
||||
PluginManager ()
|
||||
{
|
||||
PluginManager () {
|
||||
plugins = new HashTable<string,Plugin> (str_hash, str_equal);
|
||||
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 module = Module.open (path, ModuleFlags.BIND_LOCAL);
|
||||
if (module == null) {
|
||||
@ -124,8 +119,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
void load_plugin_class (PluginInfo info)
|
||||
{
|
||||
void load_plugin_class (PluginInfo info) {
|
||||
var plugin = (Plugin)Object.@new (info.plugin_type);
|
||||
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.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";
|
||||
switch (provides) {
|
||||
case PluginFunction.WORKSPACE_VIEW:
|
||||
@ -180,8 +172,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public void initialize (WindowManager _wm)
|
||||
{
|
||||
public void initialize (WindowManager _wm) {
|
||||
wm = _wm;
|
||||
|
||||
plugins.@foreach (initialize_plugin);
|
||||
@ -190,8 +181,7 @@ namespace Gala
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
public void load_waiting_plugins ()
|
||||
{
|
||||
public void load_waiting_plugins () {
|
||||
foreach (var info in load_later_plugins) {
|
||||
load_plugin_class (info);
|
||||
}
|
||||
@ -199,8 +189,7 @@ namespace Gala
|
||||
load_later_plugins.clear ();
|
||||
}
|
||||
|
||||
public Plugin? get_plugin (string id)
|
||||
{
|
||||
public Plugin? get_plugin (string id) {
|
||||
return plugins.lookup (id);
|
||||
}
|
||||
|
||||
@ -208,8 +197,7 @@ namespace Gala
|
||||
* Iterate over all plugins and grab their regions, update the regions
|
||||
* array accordingly and emit the regions_changed signal.
|
||||
*/
|
||||
void recalculate_regions ()
|
||||
{
|
||||
void recalculate_regions () {
|
||||
X.Xrectangle[] regions = {};
|
||||
|
||||
plugins.@foreach ((name, plugin) => {
|
||||
|
@ -15,13 +15,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
[DBus (name = "org.gnome.ScreenSaver")]
|
||||
public interface ScreenSaver : GLib.Object
|
||||
{
|
||||
public interface ScreenSaver : GLib.Object {
|
||||
public abstract bool get_active () throws DBusError, IOError;
|
||||
public signal void active_changed (bool active);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,19 +15,16 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
const string EXTENSION = ".png";
|
||||
const int UNCONCEAL_TEXT_TIMEOUT = 2000;
|
||||
|
||||
[DBus (name="org.gnome.Shell.Screenshot")]
|
||||
public class ScreenshotManager : Object
|
||||
{
|
||||
public class ScreenshotManager : Object {
|
||||
static ScreenshotManager? instance;
|
||||
|
||||
[DBus (visible = false)]
|
||||
public static unowned ScreenshotManager init (WindowManager wm)
|
||||
{
|
||||
public static unowned ScreenshotManager init (WindowManager wm) {
|
||||
if (instance == null)
|
||||
instance = new ScreenshotManager (wm);
|
||||
|
||||
@ -46,13 +43,11 @@ namespace Gala
|
||||
desktop_settings = new Settings ("org.gnome.desktop.interface");
|
||||
}
|
||||
|
||||
ScreenshotManager (WindowManager _wm)
|
||||
{
|
||||
ScreenshotManager (WindowManager _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");
|
||||
|
||||
double[] keyframes = { 0.3f, 0.8f };
|
||||
@ -80,8 +75,7 @@ namespace Gala
|
||||
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");
|
||||
|
||||
int width, height;
|
||||
@ -101,13 +95,11 @@ namespace Gala
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
yield wait_stage_repaint ();
|
||||
@ -124,8 +116,7 @@ namespace Gala
|
||||
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");
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -165,8 +156,7 @@ namespace Gala
|
||||
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);
|
||||
selection_area.closed.connect (() => Idle.add (select_area.callback));
|
||||
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);
|
||||
}
|
||||
|
||||
private void unconceal_text ()
|
||||
{
|
||||
private void unconceal_text () {
|
||||
if (conceal_timeout == 0) {
|
||||
return;
|
||||
}
|
||||
@ -197,8 +186,7 @@ namespace Gala
|
||||
conceal_timeout = 0;
|
||||
}
|
||||
|
||||
public async void conceal_text () throws DBusError, IOError
|
||||
{
|
||||
public async void conceal_text () throws DBusError, IOError {
|
||||
if (conceal_timeout > 0) {
|
||||
Source.remove (conceal_timeout);
|
||||
} 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
|
||||
unowned string? base_path = Environment.get_user_special_dir (UserDirectory.PICTURES);
|
||||
if (base_path != null && FileUtils.test (base_path, FileTest.EXISTS)) {
|
||||
@ -235,8 +222,7 @@ namespace Gala
|
||||
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;
|
||||
|
||||
// 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;
|
||||
Clutter.Capture[] captures;
|
||||
wm.stage.capture (false, {x, y, width, height}, out captures);
|
||||
@ -294,8 +279,7 @@ namespace Gala
|
||||
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 cr = new Cairo.Context (image);
|
||||
|
||||
@ -316,8 +300,7 @@ namespace Gala
|
||||
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
|
||||
unowned Meta.CursorTracker cursor_tracker = wm.get_display ().get_cursor_tracker ();
|
||||
#else
|
||||
@ -358,8 +341,7 @@ namespace Gala
|
||||
return (Cairo.ImageSurface)cr.get_target ();
|
||||
}
|
||||
|
||||
async void wait_stage_repaint ()
|
||||
{
|
||||
async void wait_stage_repaint () {
|
||||
ulong signal_id = 0UL;
|
||||
signal_id = wm.stage.paint.connect_after (() => {
|
||||
wm.stage.disconnect (signal_id);
|
||||
|
@ -18,11 +18,9 @@
|
||||
// Reference code by the Solus Project:
|
||||
// https://github.com/solus-project/budgie-desktop/blob/master/src/wm/shim.vala
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
[DBus (name = "io.elementary.wingpanel.session.EndSessionDialog")]
|
||||
public interface WingpanelEndSessionDialog : Object
|
||||
{
|
||||
public interface WingpanelEndSessionDialog : Object {
|
||||
public signal void confirmed_logout ();
|
||||
public signal void confirmed_reboot ();
|
||||
public signal void confirmed_shutdown ();
|
||||
@ -33,13 +31,11 @@ namespace Gala
|
||||
}
|
||||
|
||||
[DBus (name = "org.gnome.SessionManager.EndSessionDialog")]
|
||||
public class SessionManager : Object
|
||||
{
|
||||
public class SessionManager : Object {
|
||||
static SessionManager? instance;
|
||||
|
||||
[DBus (visible = false)]
|
||||
public static unowned SessionManager init ()
|
||||
{
|
||||
public static unowned SessionManager init () {
|
||||
if (instance == null) {
|
||||
instance = new SessionManager ();
|
||||
}
|
||||
@ -55,14 +51,12 @@ namespace Gala
|
||||
|
||||
WingpanelEndSessionDialog? proxy = null;
|
||||
|
||||
SessionManager ()
|
||||
{
|
||||
SessionManager () {
|
||||
Bus.watch_name (BusType.SESSION, "io.elementary.wingpanel.session.EndSessionDialog",
|
||||
BusNameWatcherFlags.NONE, proxy_appeared, proxy_vanished);
|
||||
}
|
||||
|
||||
void get_proxy_cb (Object? o, AsyncResult? res)
|
||||
{
|
||||
void get_proxy_cb (Object? o, AsyncResult? res) {
|
||||
try {
|
||||
proxy = Bus.get_proxy.end (res);
|
||||
} catch (Error e) {
|
||||
@ -77,20 +71,17 @@ namespace Gala
|
||||
proxy.closed.connect (() => closed ());
|
||||
}
|
||||
|
||||
void proxy_appeared ()
|
||||
{
|
||||
void proxy_appeared () {
|
||||
Bus.get_proxy.begin<WingpanelEndSessionDialog> (BusType.SESSION,
|
||||
"io.elementary.wingpanel.session.EndSessionDialog", "/io/elementary/wingpanel/session/EndSessionDialog",
|
||||
0, null, get_proxy_cb);
|
||||
}
|
||||
|
||||
void proxy_vanished ()
|
||||
{
|
||||
void proxy_vanished () {
|
||||
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) {
|
||||
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/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class BehaviorSettings : Granite.Services.Settings
|
||||
{
|
||||
namespace Gala {
|
||||
public class BehaviorSettings : Granite.Services.Settings {
|
||||
public bool dynamic_workspaces { get; set; }
|
||||
public bool edge_tiling { get; set; }
|
||||
public string panel_main_menu_action { get; set; }
|
||||
@ -37,13 +35,11 @@ namespace Gala
|
||||
|
||||
static BehaviorSettings? instance = null;
|
||||
|
||||
private BehaviorSettings ()
|
||||
{
|
||||
private BehaviorSettings () {
|
||||
base (Config.SCHEMA + ".behavior");
|
||||
}
|
||||
|
||||
public static unowned BehaviorSettings get_default ()
|
||||
{
|
||||
public static unowned BehaviorSettings get_default () {
|
||||
if (instance == null)
|
||||
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;
|
||||
|
||||
private KeybindingSettings ()
|
||||
{
|
||||
private KeybindingSettings () {
|
||||
base (Config.SCHEMA + ".keybindings");
|
||||
}
|
||||
|
||||
public static unowned KeybindingSettings get_default ()
|
||||
{
|
||||
public static unowned KeybindingSettings get_default () {
|
||||
if (instance == null)
|
||||
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 bool attach_modal_dialogs { get; set; }
|
||||
public bool dim_parents { get; set; }
|
||||
@ -78,13 +70,11 @@ namespace Gala
|
||||
|
||||
static AppearanceSettings? instance = null;
|
||||
|
||||
private AppearanceSettings ()
|
||||
{
|
||||
private AppearanceSettings () {
|
||||
base (Config.SCHEMA + ".appearance");
|
||||
}
|
||||
|
||||
public static unowned AppearanceSettings get_default ()
|
||||
{
|
||||
public static unowned AppearanceSettings get_default () {
|
||||
if (instance == null)
|
||||
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[] normal_focused { get; set; }
|
||||
public string[] normal_unfocused { get; set; }
|
||||
@ -102,21 +91,18 @@ namespace Gala
|
||||
|
||||
static ShadowSettings? instance = null;
|
||||
|
||||
private ShadowSettings ()
|
||||
{
|
||||
private ShadowSettings () {
|
||||
base (Config.SCHEMA + ".shadows");
|
||||
}
|
||||
|
||||
public static unowned ShadowSettings get_default ()
|
||||
{
|
||||
public static unowned ShadowSettings get_default () {
|
||||
if (instance == null)
|
||||
instance = new ShadowSettings ();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Meta.ShadowParams get_shadowparams (string class_name)
|
||||
{
|
||||
public Meta.ShadowParams get_shadowparams (string class_name) {
|
||||
string[] 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_uri { get; set; }
|
||||
public int picture_opacity { get; set; }
|
||||
@ -139,13 +124,11 @@ namespace Gala
|
||||
|
||||
static BackgroundSettings? instance = null;
|
||||
|
||||
private BackgroundSettings ()
|
||||
{
|
||||
private BackgroundSettings () {
|
||||
base ("org.gnome.desktop.background");
|
||||
}
|
||||
|
||||
public static unowned BackgroundSettings get_default ()
|
||||
{
|
||||
public static unowned BackgroundSettings get_default () {
|
||||
if (instance == null)
|
||||
instance = new BackgroundSettings ();
|
||||
|
||||
|
@ -17,17 +17,13 @@
|
||||
|
||||
using Clutter;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class ShadowEffect : Effect
|
||||
{
|
||||
private class Shadow
|
||||
{
|
||||
namespace Gala {
|
||||
public class ShadowEffect : Effect {
|
||||
private class Shadow {
|
||||
public int users;
|
||||
public Cogl.Texture texture;
|
||||
|
||||
public Shadow (Cogl.Texture _texture)
|
||||
{
|
||||
public Shadow (Cogl.Texture _texture) {
|
||||
texture = _texture;
|
||||
users = 1;
|
||||
}
|
||||
@ -38,8 +34,7 @@ namespace Gala
|
||||
static Gee.HashMap<string,Shadow> shadow_cache;
|
||||
static Gtk.StyleContext style_context;
|
||||
|
||||
class construct
|
||||
{
|
||||
class construct {
|
||||
shadow_cache = new Gee.HashMap<string,Shadow> ();
|
||||
|
||||
var style_path = new Gtk.WidgetPath ();
|
||||
@ -61,24 +56,20 @@ namespace Gala
|
||||
Cogl.Material material;
|
||||
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);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
material = new Cogl.Material ();
|
||||
}
|
||||
|
||||
~ShadowEffect ()
|
||||
{
|
||||
~ShadowEffect () {
|
||||
if (current_key != null)
|
||||
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;
|
||||
current_key = "%ix%i:%i:%i".printf (width, height, shadow_size, shadow_spread);
|
||||
if (old_key == current_key)
|
||||
@ -121,8 +112,7 @@ namespace Gala
|
||||
return texture;
|
||||
}
|
||||
|
||||
void decrement_shadow_users (string key)
|
||||
{
|
||||
void decrement_shadow_users (string key) {
|
||||
var shadow = shadow_cache.@get (key);
|
||||
|
||||
if (shadow == null)
|
||||
@ -132,8 +122,7 @@ namespace Gala
|
||||
shadow_cache.unset (key);
|
||||
}
|
||||
|
||||
public override void paint (EffectPaintFlags flags)
|
||||
{
|
||||
public override void paint (EffectPaintFlags flags) {
|
||||
var bounding_box = get_bounding_box ();
|
||||
var width = (int) (bounding_box.x2 - bounding_box.x1);
|
||||
var height = (int) (bounding_box.y2 - bounding_box.y1);
|
||||
@ -154,8 +143,7 @@ namespace Gala
|
||||
actor.continue_paint ();
|
||||
}
|
||||
|
||||
public virtual ActorBox get_bounding_box ()
|
||||
{
|
||||
public virtual ActorBox get_bounding_box () {
|
||||
var size = shadow_size * scale_factor;
|
||||
var bounding_box = ActorBox ();
|
||||
|
||||
|
@ -15,10 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class TextShadowEffect : Clutter.Effect
|
||||
{
|
||||
namespace Gala {
|
||||
public class TextShadowEffect : Clutter.Effect {
|
||||
int _offset_y;
|
||||
public int offset_y {
|
||||
get { return _offset_y; }
|
||||
@ -37,23 +35,20 @@ namespace Gala
|
||||
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_y = offset_y;
|
||||
_opacity = opacity;
|
||||
}
|
||||
|
||||
public override bool pre_paint ()
|
||||
{
|
||||
public override bool pre_paint () {
|
||||
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);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void update ()
|
||||
{
|
||||
public void update () {
|
||||
if (get_actor () != null)
|
||||
get_actor ().queue_redraw ();
|
||||
}
|
||||
|
@ -18,15 +18,13 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* 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.
|
||||
* Lastly it also includes the drawing code for the active highlight.
|
||||
*/
|
||||
public class IconGroup : Actor
|
||||
{
|
||||
public class IconGroup : Actor {
|
||||
public const int SIZE = 64;
|
||||
|
||||
const int PLUS_SIZE = 8;
|
||||
@ -92,13 +90,11 @@ namespace Gala
|
||||
|
||||
uint show_close_button_timeout = 0;
|
||||
|
||||
public IconGroup (Workspace workspace)
|
||||
{
|
||||
public IconGroup (Workspace workspace) {
|
||||
Object (workspace: workspace);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
var size = SIZE * scale;
|
||||
|
||||
@ -148,19 +144,16 @@ namespace Gala
|
||||
icon_container.actor_removed.connect_after (redraw);
|
||||
}
|
||||
|
||||
~IconGroup ()
|
||||
{
|
||||
~IconGroup () {
|
||||
icon_container.actor_removed.disconnect (redraw);
|
||||
}
|
||||
|
||||
public override bool enter_event (CrossingEvent event)
|
||||
{
|
||||
public override bool enter_event (CrossingEvent event) {
|
||||
toggle_close_button (true);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool leave_event (CrossingEvent event)
|
||||
{
|
||||
public override bool leave_event (CrossingEvent event) {
|
||||
if (!contains (event.related))
|
||||
toggle_close_button (false);
|
||||
|
||||
@ -175,8 +168,7 @@ namespace Gala
|
||||
*
|
||||
* @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
|
||||
// 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
|
||||
@ -212,8 +204,7 @@ namespace Gala
|
||||
/**
|
||||
* 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) {
|
||||
base.paint ();
|
||||
return;
|
||||
@ -247,8 +238,7 @@ namespace Gala
|
||||
/**
|
||||
* Remove all currently added WindowIconActors
|
||||
*/
|
||||
public void clear ()
|
||||
{
|
||||
public void clear () {
|
||||
icon_container.destroy_all_children ();
|
||||
}
|
||||
|
||||
@ -261,8 +251,7 @@ namespace Gala
|
||||
* @param temporary Mark the WindowIconActor as temporary. Used for windows dragged over
|
||||
* 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);
|
||||
|
||||
new_window.save_easing_state ();
|
||||
@ -282,8 +271,7 @@ namespace Gala
|
||||
*
|
||||
* @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 ()) {
|
||||
unowned WindowIconActor w = (WindowIconActor) child;
|
||||
if (w.window == window) {
|
||||
@ -313,16 +301,14 @@ namespace Gala
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a redraw
|
||||
*/
|
||||
public void redraw ()
|
||||
{
|
||||
public void redraw () {
|
||||
content.invalidate ();
|
||||
}
|
||||
|
||||
@ -331,8 +317,7 @@ namespace Gala
|
||||
* That way the workspace won't be deleted if windows decide to ignore the
|
||||
* delete signal
|
||||
*/
|
||||
void close ()
|
||||
{
|
||||
void close () {
|
||||
#if HAS_MUTTER330
|
||||
var time = workspace.get_display ().get_current_time ();
|
||||
#else
|
||||
@ -350,8 +335,7 @@ namespace Gala
|
||||
* 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.
|
||||
*/
|
||||
bool draw (Cairo.Context cr)
|
||||
{
|
||||
bool draw (Cairo.Context cr) {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
|
||||
cr.set_operator (Cairo.Operator.CLEAR);
|
||||
@ -526,8 +510,7 @@ namespace Gala
|
||||
return false;
|
||||
}
|
||||
|
||||
Actor drag_begin (float click_x, float click_y)
|
||||
{
|
||||
Actor drag_begin (float click_x, float click_y) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
|
||||
if (icon_container.get_n_children () < 1 &&
|
||||
@ -569,11 +552,10 @@ namespace Gala
|
||||
return this;
|
||||
}
|
||||
|
||||
void drag_end (Actor destination)
|
||||
{
|
||||
void drag_end (Actor destination) {
|
||||
if (destination is WorkspaceInsertThumb) {
|
||||
get_parent ().remove_child (this);
|
||||
|
||||
|
||||
unowned WorkspaceInsertThumb inserter = (WorkspaceInsertThumb) destination;
|
||||
#if HAS_MUTTER330
|
||||
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);
|
||||
restore_group ();
|
||||
}
|
||||
|
||||
void restore_group ()
|
||||
{
|
||||
void restore_group () {
|
||||
var container = prev_parent as IconGroupContainer;
|
||||
if (container != null) {
|
||||
container.add_group (this);
|
||||
|
@ -18,15 +18,13 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* This class contains the icon groups at the bottom and will take
|
||||
* care of displaying actors for inserting windows between the groups
|
||||
* once implemented
|
||||
*/
|
||||
public class IconGroupContainer : Actor
|
||||
{
|
||||
public class IconGroupContainer : Actor {
|
||||
public const int SPACING = 48;
|
||||
public const int GROUP_WIDTH = 64;
|
||||
|
||||
@ -39,23 +37,20 @@ namespace Gala
|
||||
#endif
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public IconGroupContainer (Meta.Display display)
|
||||
{
|
||||
public IconGroupContainer (Meta.Display display) {
|
||||
Object (display: display);
|
||||
|
||||
layout_manager = new BoxLayout ();
|
||||
}
|
||||
#else
|
||||
public IconGroupContainer (Screen screen)
|
||||
{
|
||||
public IconGroupContainer (Screen screen) {
|
||||
Object (screen: screen);
|
||||
|
||||
layout_manager = new BoxLayout ();
|
||||
}
|
||||
#endif
|
||||
|
||||
public void add_group (IconGroup group)
|
||||
{
|
||||
public void add_group (IconGroup group) {
|
||||
var index = group.workspace.index ();
|
||||
|
||||
insert_child_at_index (group, index * 2);
|
||||
@ -67,8 +62,7 @@ namespace Gala
|
||||
update_inserter_indices ();
|
||||
}
|
||||
|
||||
public void remove_group (IconGroup group)
|
||||
{
|
||||
public void remove_group (IconGroup group) {
|
||||
var thumb = (WorkspaceInsertThumb) group.get_previous_sibling ();
|
||||
thumb.notify["expanded"].disconnect (expanded_changed);
|
||||
remove_child (thumb);
|
||||
@ -88,8 +82,7 @@ namespace Gala
|
||||
* We don't want that until the IconGroup
|
||||
* 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_placeholder_thumb = (WorkspaceInsertThumb) group.get_next_sibling ();
|
||||
|
||||
@ -108,8 +101,7 @@ namespace Gala
|
||||
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 ()) {
|
||||
unowned WorkspaceInsertThumb thumb = child as WorkspaceInsertThumb;
|
||||
if (thumb != null) {
|
||||
@ -119,8 +111,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void expanded_changed (ParamSpec param)
|
||||
{
|
||||
void expanded_changed (ParamSpec param) {
|
||||
request_reposition (true);
|
||||
}
|
||||
|
||||
@ -128,8 +119,7 @@ namespace Gala
|
||||
* Calculates the width that will be occupied taking currently running animations
|
||||
* end states into account
|
||||
*/
|
||||
public float calculate_total_width ()
|
||||
{
|
||||
public float calculate_total_width () {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
var spacing = SPACING * scale;
|
||||
var group_width = GROUP_WIDTH * scale;
|
||||
@ -150,8 +140,7 @@ namespace Gala
|
||||
return width;
|
||||
}
|
||||
|
||||
void update_inserter_indices ()
|
||||
{
|
||||
void update_inserter_indices () {
|
||||
var current_index = 0;
|
||||
|
||||
foreach (var child in get_children ()) {
|
||||
|
@ -18,8 +18,7 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* More or less utility class to contain a WindowCloneContainer for each
|
||||
* 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
|
||||
* workspaces-only-on-primary is set to true.
|
||||
*/
|
||||
public class MonitorClone : Actor
|
||||
{
|
||||
public class MonitorClone : Actor {
|
||||
public signal void window_selected (Window window);
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -42,19 +40,16 @@ namespace Gala
|
||||
BackgroundManager background;
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public MonitorClone (Meta.Display display, int monitor)
|
||||
{
|
||||
public MonitorClone (Meta.Display display, int monitor) {
|
||||
Object (display: display, monitor: monitor);
|
||||
}
|
||||
#else
|
||||
public MonitorClone (Screen screen, int monitor)
|
||||
{
|
||||
public MonitorClone (Screen screen, int monitor) {
|
||||
Object (screen: screen, monitor: monitor);
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
reactive = true;
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -102,8 +97,7 @@ namespace Gala
|
||||
update_allocation ();
|
||||
}
|
||||
|
||||
~MonitorClone ()
|
||||
{
|
||||
~MonitorClone () {
|
||||
#if HAS_MUTTER330
|
||||
display.window_entered_monitor.disconnect (window_entered);
|
||||
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
|
||||
*/
|
||||
public void update_allocation ()
|
||||
{
|
||||
public void update_allocation () {
|
||||
#if HAS_MUTTER330
|
||||
var monitor_geometry = display.get_monitor_geometry (monitor);
|
||||
#else
|
||||
@ -134,8 +127,7 @@ namespace Gala
|
||||
/**
|
||||
* Animate the windows from their old location to a tiled layout
|
||||
*/
|
||||
public void open ()
|
||||
{
|
||||
public void open () {
|
||||
window_container.open ();
|
||||
// background.opacity = 0; TODO consider this option
|
||||
}
|
||||
@ -143,22 +135,19 @@ namespace Gala
|
||||
/**
|
||||
* Animate the windows back to their old location
|
||||
*/
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
window_container.close ();
|
||||
background.opacity = 255;
|
||||
}
|
||||
|
||||
void window_left (int window_monitor, Window window)
|
||||
{
|
||||
void window_left (int window_monitor, Window window) {
|
||||
if (window_monitor != monitor)
|
||||
return;
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
|
@ -18,15 +18,13 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* The central class for the MultitaskingView which takes care of
|
||||
* preparing the wm, opening the components and holds containers for
|
||||
* 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 AnimationMode ANIMATION_MODE = AnimationMode.EASE_OUT_QUAD;
|
||||
const int SMOOTH_SCROLL_DELAY = 500;
|
||||
@ -50,13 +48,11 @@ namespace Gala
|
||||
Actor workspaces;
|
||||
Actor dock_clones;
|
||||
|
||||
public MultitaskingView (WindowManager wm)
|
||||
{
|
||||
public MultitaskingView (WindowManager wm) {
|
||||
Object (wm: wm);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
visible = false;
|
||||
reactive = true;
|
||||
clip_to_allocation = true;
|
||||
@ -174,8 +170,7 @@ namespace Gala
|
||||
* Places the primary container for the WorkspaceClones and the
|
||||
* MonitorClones at the right positions
|
||||
*/
|
||||
void update_monitors ()
|
||||
{
|
||||
void update_monitors () {
|
||||
foreach (var monitor_clone in window_containers_monitors)
|
||||
monitor_clone.destroy ();
|
||||
|
||||
@ -225,8 +220,7 @@ namespace Gala
|
||||
* We generally assume that when the key-focus-out signal is emitted
|
||||
* 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))
|
||||
toggle ();
|
||||
}
|
||||
@ -234,8 +228,7 @@ namespace Gala
|
||||
/**
|
||||
* Scroll through workspaces
|
||||
*/
|
||||
public override bool scroll_event (ScrollEvent scroll_event)
|
||||
{
|
||||
public override bool scroll_event (ScrollEvent scroll_event) {
|
||||
if (!opened)
|
||||
return true;
|
||||
|
||||
@ -302,8 +295,7 @@ namespace Gala
|
||||
* @param animate Whether to animate the movement or have all elements take their
|
||||
* positions immediately.
|
||||
*/
|
||||
void update_positions (bool animate)
|
||||
{
|
||||
void update_positions (bool animate) {
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
@ -337,8 +329,7 @@ namespace Gala
|
||||
reposition_icon_groups (animate);
|
||||
}
|
||||
|
||||
void reposition_icon_groups (bool animate)
|
||||
{
|
||||
void reposition_icon_groups (bool animate) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
var active_index = manager.get_active_workspace ().index ();
|
||||
@ -365,8 +356,7 @@ namespace Gala
|
||||
icon_groups.restore_easing_state ();
|
||||
}
|
||||
|
||||
void add_workspace (int num)
|
||||
{
|
||||
void add_workspace (int num) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
var workspace = new WorkspaceClone (manager.get_workspace_by_index (num));
|
||||
@ -385,8 +375,7 @@ namespace Gala
|
||||
workspace.open ();
|
||||
}
|
||||
|
||||
void remove_workspace (int num)
|
||||
{
|
||||
void remove_workspace (int num) {
|
||||
WorkspaceClone? workspace = null;
|
||||
|
||||
// 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
|
||||
* closed.
|
||||
*/
|
||||
void activate_workspace (WorkspaceClone clone, bool close_view)
|
||||
{
|
||||
void activate_workspace (WorkspaceClone clone, bool close_view) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
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
|
||||
* select the active window.
|
||||
*/
|
||||
public override bool key_press_event (Clutter.KeyEvent event)
|
||||
{
|
||||
public override bool key_press_event (Clutter.KeyEvent event) {
|
||||
if (!opened)
|
||||
return true;
|
||||
|
||||
@ -491,8 +478,7 @@ namespace Gala
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
@ -501,8 +487,7 @@ namespace Gala
|
||||
*
|
||||
* @return The active WorkspaceClone
|
||||
*/
|
||||
WorkspaceClone get_active_workspace_clone ()
|
||||
{
|
||||
WorkspaceClone get_active_workspace_clone () {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
foreach (var child in workspaces.get_children ()) {
|
||||
@ -523,8 +508,7 @@ namespace Gala
|
||||
assert_not_reached ();
|
||||
}
|
||||
|
||||
void window_selected (Meta.Window window)
|
||||
{
|
||||
void window_selected (Meta.Window window) {
|
||||
#if HAS_MUTTER330
|
||||
var time = display.get_current_time ();
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
@ -552,16 +536,14 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public bool is_opened ()
|
||||
{
|
||||
public bool is_opened () {
|
||||
return opened;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void open (HashTable<string,Variant>? hints = null)
|
||||
{
|
||||
public void open (HashTable<string,Variant>? hints = null) {
|
||||
if (opened)
|
||||
return;
|
||||
|
||||
@ -571,8 +553,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
if (!opened)
|
||||
return;
|
||||
|
||||
@ -584,8 +565,7 @@ namespace Gala
|
||||
* starting the modal mode and hiding the WindowGroup. Finally tells all components
|
||||
* to animate to their positions.
|
||||
*/
|
||||
void toggle ()
|
||||
{
|
||||
void toggle () {
|
||||
if (animating)
|
||||
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 ());
|
||||
switch (action) {
|
||||
case KeyBindingAction.WORKSPACE_LEFT:
|
||||
|
@ -17,15 +17,13 @@
|
||||
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* A clone for a MetaWindowActor that will guard against the
|
||||
* meta_window_appears_focused crash by disabling painting the clone
|
||||
* as soon as it gets unavailable.
|
||||
*/
|
||||
public class SafeWindowClone : Clutter.Clone
|
||||
{
|
||||
public class SafeWindowClone : Clutter.Clone {
|
||||
public Window window { get; construct; }
|
||||
|
||||
/**
|
||||
@ -40,8 +38,7 @@ namespace Gala
|
||||
* @param window The window to clone from
|
||||
* @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 ();
|
||||
|
||||
Object (window: window,
|
||||
@ -49,19 +46,16 @@ namespace Gala
|
||||
destroy_on_unmanaged: destroy_on_unmanaged);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
if (source != null)
|
||||
window.unmanaged.connect (reset_source);
|
||||
}
|
||||
|
||||
~SafeWindowClone ()
|
||||
{
|
||||
~SafeWindowClone () {
|
||||
window.unmanaged.disconnect (reset_source);
|
||||
}
|
||||
|
||||
void reset_source ()
|
||||
{
|
||||
void reset_source () {
|
||||
// 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
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class SelectionArea : Clutter.Actor
|
||||
{
|
||||
namespace Gala {
|
||||
public class SelectionArea : Clutter.Actor {
|
||||
public signal void closed ();
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
@ -31,13 +29,11 @@ namespace Gala
|
||||
private bool dragging = false;
|
||||
private bool clicked = false;
|
||||
|
||||
public SelectionArea (WindowManager wm)
|
||||
{
|
||||
public SelectionArea (WindowManager wm) {
|
||||
Object (wm: wm);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
start_point = { 0, 0 };
|
||||
end_point = { 0, 0 };
|
||||
visible = true;
|
||||
@ -60,8 +56,7 @@ namespace Gala
|
||||
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) {
|
||||
close ();
|
||||
cancelled = true;
|
||||
@ -72,8 +67,7 @@ namespace Gala
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
@ -86,8 +80,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool button_release_event (Clutter.ButtonEvent e)
|
||||
{
|
||||
public override bool button_release_event (Clutter.ButtonEvent e) {
|
||||
if (e.button != 1) {
|
||||
return true;
|
||||
}
|
||||
@ -110,8 +103,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool motion_event (Clutter.MotionEvent e)
|
||||
{
|
||||
public override bool motion_event (Clutter.MotionEvent e) {
|
||||
if (!clicked) {
|
||||
return true;
|
||||
}
|
||||
@ -127,8 +119,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
#if HAS_MUTTER330
|
||||
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
|
||||
#else
|
||||
@ -140,8 +131,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
public void start_selection ()
|
||||
{
|
||||
public void start_selection () {
|
||||
#if HAS_MUTTER330
|
||||
wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR);
|
||||
#else
|
||||
@ -152,16 +142,14 @@ namespace Gala
|
||||
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);
|
||||
y = int.min (start_point.y, end_point.y);
|
||||
width = (start_point.x - end_point.x).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);
|
||||
|
||||
if (!dragging) {
|
||||
|
@ -18,19 +18,15 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
class WindowShadowEffect : ShadowEffect
|
||||
{
|
||||
namespace Gala {
|
||||
class WindowShadowEffect : ShadowEffect {
|
||||
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);
|
||||
}
|
||||
|
||||
public override ActorBox get_bounding_box ()
|
||||
{
|
||||
public override ActorBox get_bounding_box () {
|
||||
var size = shadow_size * scale_factor;
|
||||
|
||||
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 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 ACTIVE_SHAPE_SIZE = 12;
|
||||
|
||||
@ -125,13 +120,11 @@ namespace Gala
|
||||
Actor active_shape;
|
||||
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);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
reactive = true;
|
||||
|
||||
window.unmanaged.connect (unmanaged);
|
||||
@ -183,8 +176,7 @@ namespace Gala
|
||||
load_clone ();
|
||||
}
|
||||
|
||||
~WindowClone ()
|
||||
{
|
||||
~WindowClone () {
|
||||
window.unmanaged.disconnect (unmanaged);
|
||||
window.notify["on-all-workspaces"].disconnect (on_all_workspaces_changed);
|
||||
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
|
||||
* 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;
|
||||
if (actor == null) {
|
||||
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 (shadow_effect == null) {
|
||||
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
|
||||
* the current one. To ease their appearance we have to fade them in.
|
||||
*/
|
||||
bool should_fade ()
|
||||
{
|
||||
bool should_fade () {
|
||||
#if HAS_MUTTER330
|
||||
return (overview_mode
|
||||
&& window.get_workspace () != window.get_display ().get_workspace_manager ().get_active_workspace ()) || window.minimized;
|
||||
@ -278,8 +267,7 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
|
||||
void on_all_workspaces_changed ()
|
||||
{
|
||||
void on_all_workspaces_changed () {
|
||||
// we don't display windows that are on all workspaces
|
||||
if (window.on_all_workspaces)
|
||||
unmanaged ();
|
||||
@ -290,8 +278,7 @@ namespace Gala
|
||||
*
|
||||
* @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 ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -324,8 +311,7 @@ namespace Gala
|
||||
/**
|
||||
* Animate the window to the given slot
|
||||
*/
|
||||
public void take_slot (Meta.Rectangle rect)
|
||||
{
|
||||
public void take_slot (Meta.Rectangle rect) {
|
||||
slot = rect;
|
||||
|
||||
save_easing_state ();
|
||||
@ -355,8 +341,7 @@ namespace Gala
|
||||
* according to their given allocations. The first two are placed in a way
|
||||
* 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);
|
||||
|
||||
foreach (var child in get_children ()) {
|
||||
@ -388,20 +373,17 @@ namespace Gala
|
||||
clone.allocate (alloc, flags);
|
||||
}
|
||||
|
||||
public override bool button_press_event (Clutter.ButtonEvent event)
|
||||
{
|
||||
public override bool button_press_event (Clutter.ButtonEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool enter_event (Clutter.CrossingEvent event)
|
||||
{
|
||||
public override bool enter_event (Clutter.CrossingEvent event) {
|
||||
close_button.opacity = 255;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool leave_event (Clutter.CrossingEvent event)
|
||||
{
|
||||
|
||||
public override bool leave_event (Clutter.CrossingEvent event) {
|
||||
close_button.opacity = 0;
|
||||
|
||||
return false;
|
||||
@ -411,8 +393,7 @@ namespace Gala
|
||||
* 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.
|
||||
*/
|
||||
public void place_widgets (int dest_width, int dest_height)
|
||||
{
|
||||
public void place_widgets (int dest_width, int dest_height) {
|
||||
Granite.CloseButtonPosition 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)
|
||||
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
|
||||
* to select our window.
|
||||
*/
|
||||
void close_window ()
|
||||
{
|
||||
void close_window () {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = window.get_display ();
|
||||
check_confirm_dialog_cb = display.window_entered_monitor.connect (check_confirm_dialog);
|
||||
@ -480,8 +459,7 @@ namespace Gala
|
||||
#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) {
|
||||
Idle.add (() => {
|
||||
selected ();
|
||||
@ -500,8 +478,7 @@ namespace Gala
|
||||
/**
|
||||
* The window unmanaged by the compositor, so we need to destroy ourselves too.
|
||||
*/
|
||||
void unmanaged ()
|
||||
{
|
||||
void unmanaged () {
|
||||
remove_all_transitions ();
|
||||
|
||||
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
|
||||
* 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 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,
|
||||
* 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;
|
||||
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,
|
||||
* 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;
|
||||
#if HAS_MUTTER330
|
||||
var primary = window.get_display ().get_primary_monitor ();
|
||||
@ -722,8 +696,7 @@ namespace Gala
|
||||
/**
|
||||
* Animate back to our previous position with a bouncing animation.
|
||||
*/
|
||||
void drag_canceled ()
|
||||
{
|
||||
void drag_canceled () {
|
||||
get_parent ().remove_child (this);
|
||||
prev_parent.insert_child_at_index (this, prev_index);
|
||||
|
||||
|
@ -18,13 +18,11 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* 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 int padding_top { get; set; default = 12; }
|
||||
@ -42,13 +40,11 @@ namespace Gala
|
||||
*/
|
||||
WindowClone? current_window;
|
||||
|
||||
public WindowCloneContainer (bool overview_mode = false)
|
||||
{
|
||||
public WindowCloneContainer (bool overview_mode = false) {
|
||||
Object (overview_mode: overview_mode);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
opened = false;
|
||||
current_window = null;
|
||||
}
|
||||
@ -58,11 +54,10 @@ namespace Gala
|
||||
*
|
||||
* @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 ();
|
||||
var children = get_children ();
|
||||
|
||||
|
||||
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
||||
foreach (unowned Actor child in children) {
|
||||
unowned WindowClone tw = (WindowClone) child;
|
||||
@ -70,9 +65,9 @@ namespace Gala
|
||||
}
|
||||
windows.prepend (window);
|
||||
windows.reverse ();
|
||||
|
||||
|
||||
var windows_ordered = display.sort_windows_by_stacking (windows);
|
||||
|
||||
|
||||
var new_window = new WindowClone (window, overview_mode);
|
||||
|
||||
new_window.selected.connect (window_selected_cb);
|
||||
@ -108,8 +103,7 @@ namespace Gala
|
||||
/**
|
||||
* 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 ()) {
|
||||
if (((WindowClone) child).window == window) {
|
||||
remove_child (child);
|
||||
@ -120,13 +114,11 @@ namespace Gala
|
||||
reflow ();
|
||||
}
|
||||
|
||||
void window_selected_cb (WindowClone tiled)
|
||||
{
|
||||
void window_selected_cb (WindowClone tiled) {
|
||||
window_selected (tiled.window);
|
||||
}
|
||||
|
||||
void window_destroyed (Actor actor)
|
||||
{
|
||||
void window_destroyed (Actor actor) {
|
||||
var window = actor as WindowClone;
|
||||
if (window == null)
|
||||
return;
|
||||
@ -145,8 +137,7 @@ namespace Gala
|
||||
* during animations correct.
|
||||
*/
|
||||
#if HAS_MUTTER330
|
||||
public void restack_windows (Meta.Display display)
|
||||
{
|
||||
public void restack_windows (Meta.Display display) {
|
||||
var children = get_children ();
|
||||
|
||||
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> ();
|
||||
@ -171,8 +162,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
#else
|
||||
public void restack_windows (Screen screen)
|
||||
{
|
||||
public void restack_windows (Screen screen) {
|
||||
unowned Meta.Display display = screen.get_display ();
|
||||
var children = get_children ();
|
||||
|
||||
@ -203,8 +193,7 @@ namespace Gala
|
||||
* Recalculate the tiling positions of the windows and animate them to
|
||||
* the resulting spots.
|
||||
*/
|
||||
public void reflow ()
|
||||
{
|
||||
public void reflow () {
|
||||
if (!opened)
|
||||
return;
|
||||
|
||||
@ -248,8 +237,7 @@ namespace Gala
|
||||
*
|
||||
* @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)
|
||||
return;
|
||||
|
||||
@ -336,8 +324,7 @@ namespace Gala
|
||||
/**
|
||||
* Emit the selected signal for the current_window.
|
||||
*/
|
||||
public bool activate_selected_window ()
|
||||
{
|
||||
public bool activate_selected_window () {
|
||||
if (current_window != null) {
|
||||
current_window.selected ();
|
||||
return true;
|
||||
@ -349,13 +336,12 @@ namespace Gala
|
||||
/**
|
||||
* 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)
|
||||
return;
|
||||
|
||||
|
||||
opened = true;
|
||||
|
||||
|
||||
// hide the highlight when opened
|
||||
if (selected_window != null) {
|
||||
foreach (var child in get_children ()) {
|
||||
@ -385,11 +371,10 @@ namespace Gala
|
||||
* Calls the transition_to_original_state() function on each child
|
||||
* to make them take their original locations again.
|
||||
*/
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
if (!opened)
|
||||
return;
|
||||
|
||||
|
||||
opened = false;
|
||||
|
||||
foreach (var window in get_children ())
|
||||
|
@ -18,15 +18,13 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* Private class which is basically just a container for the actual
|
||||
* icon and takes care of blending the same icon in different sizes
|
||||
* over each other and various animations related to the icons
|
||||
*/
|
||||
public class WindowIconActor : Actor
|
||||
{
|
||||
public class WindowIconActor : Actor {
|
||||
public Window window { get; construct; }
|
||||
|
||||
int _icon_size;
|
||||
@ -102,13 +100,11 @@ namespace Gala
|
||||
WindowIcon? icon = null;
|
||||
WindowIcon? old_icon = null;
|
||||
|
||||
public WindowIconActor (Window window)
|
||||
{
|
||||
public WindowIconActor (Window window) {
|
||||
Object (window: window);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
set_pivot_point (0.5f, 0.5f);
|
||||
set_easing_mode (AnimationMode.EASE_OUT_ELASTIC);
|
||||
set_easing_duration (800);
|
||||
@ -116,13 +112,11 @@ namespace Gala
|
||||
window.notify["on-all-workspaces"].connect (on_all_workspaces_changed);
|
||||
}
|
||||
|
||||
~WindowIconActor ()
|
||||
{
|
||||
~WindowIconActor () {
|
||||
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
|
||||
if (window.on_all_workspaces)
|
||||
destroy ();
|
||||
@ -135,8 +129,7 @@ namespace Gala
|
||||
* @param y The y coordinate to which to animate to
|
||||
* @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) {
|
||||
save_easing_state ();
|
||||
set_easing_duration (10);
|
||||
@ -154,8 +147,7 @@ namespace Gala
|
||||
/**
|
||||
* 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 new_icon = new WindowIcon (window, icon_size, scale);
|
||||
new_icon.add_constraint (new BindConstraint (this, BindCoordinate.SIZE, 0));
|
||||
|
@ -18,19 +18,16 @@
|
||||
using Meta;
|
||||
using Clutter;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
|
||||
public enum WindowOverviewType
|
||||
{
|
||||
public enum WindowOverviewType {
|
||||
GRID = 0,
|
||||
NATURAL
|
||||
}
|
||||
|
||||
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 TOP_GAP = 30;
|
||||
const int BOTTOM_GAP = 100;
|
||||
@ -49,13 +46,11 @@ namespace Gala
|
||||
// the workspaces which we expose right now
|
||||
List<Workspace> workspaces;
|
||||
|
||||
public WindowOverview (WindowManager wm)
|
||||
{
|
||||
public WindowOverview (WindowManager wm) {
|
||||
Object (wm : wm);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
#if HAS_MUTTER330
|
||||
display = wm.get_display ();
|
||||
|
||||
@ -73,8 +68,7 @@ namespace Gala
|
||||
reactive = true;
|
||||
}
|
||||
|
||||
~WindowOverview ()
|
||||
{
|
||||
~WindowOverview () {
|
||||
#if HAS_MUTTER330
|
||||
display.restacked.disconnect (restack_windows);
|
||||
#else
|
||||
@ -82,8 +76,7 @@ namespace Gala
|
||||
#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) {
|
||||
close ();
|
||||
|
||||
@ -93,14 +86,12 @@ namespace Gala
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void key_focus_out ()
|
||||
{
|
||||
public override void key_focus_out () {
|
||||
if (!contains (get_stage ().key_focus))
|
||||
close ();
|
||||
}
|
||||
|
||||
public override bool button_press_event (Clutter.ButtonEvent event)
|
||||
{
|
||||
public override bool button_press_event (Clutter.ButtonEvent event) {
|
||||
if (event.button == 1)
|
||||
close ();
|
||||
|
||||
@ -110,8 +101,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public bool is_opened ()
|
||||
{
|
||||
public bool is_opened () {
|
||||
return visible;
|
||||
}
|
||||
|
||||
@ -119,8 +109,7 @@ namespace Gala
|
||||
* {@inheritDoc}
|
||||
* 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)
|
||||
return;
|
||||
|
||||
@ -243,28 +232,24 @@ namespace Gala
|
||||
ready = true;
|
||||
}
|
||||
|
||||
bool keybinding_filter (KeyBinding binding)
|
||||
{
|
||||
bool keybinding_filter (KeyBinding binding) {
|
||||
var name = binding.get_name ();
|
||||
return (name != "expose-windows" && name != "expose-all-windows");
|
||||
}
|
||||
|
||||
#if HAS_MUTTER330
|
||||
void restack_windows (Display display)
|
||||
{
|
||||
void restack_windows (Display display) {
|
||||
foreach (var child in get_children ())
|
||||
((WindowCloneContainer) child).restack_windows (display);
|
||||
}
|
||||
#else
|
||||
void restack_windows (Screen screen)
|
||||
{
|
||||
void restack_windows (Screen screen) {
|
||||
foreach (var child in get_children ())
|
||||
((WindowCloneContainer) child).restack_windows (screen);
|
||||
}
|
||||
#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;
|
||||
if (container == null)
|
||||
return;
|
||||
@ -277,8 +262,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void add_window (Window window)
|
||||
{
|
||||
void add_window (Window window) {
|
||||
if (!visible
|
||||
|| (window.window_type != WindowType.NORMAL && window.window_type != WindowType.DIALOG))
|
||||
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;
|
||||
if (container == null)
|
||||
return;
|
||||
@ -305,8 +288,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
#if HAS_MUTTER330
|
||||
void thumb_selected (Window window)
|
||||
{
|
||||
void thumb_selected (Window window) {
|
||||
if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) {
|
||||
window.activate (display.get_current_time ());
|
||||
close ();
|
||||
@ -320,8 +302,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
#else
|
||||
void thumb_selected (Window window)
|
||||
{
|
||||
void thumb_selected (Window window) {
|
||||
if (window.get_workspace () == screen.get_active_workspace ()) {
|
||||
window.activate (screen.get_display ().get_current_time ());
|
||||
close ();
|
||||
@ -339,8 +320,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
if (!visible || !ready)
|
||||
return;
|
||||
|
||||
@ -369,8 +349,7 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
|
||||
void cleanup ()
|
||||
{
|
||||
void cleanup () {
|
||||
ready = true;
|
||||
visible = false;
|
||||
|
||||
|
@ -18,10 +18,8 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class WindowSwitcher : Clutter.Actor
|
||||
{
|
||||
namespace Gala {
|
||||
public class WindowSwitcher : Clutter.Actor {
|
||||
const int MIN_DELTA = 100;
|
||||
const float BACKGROUND_OPACITY = 155.0f;
|
||||
const float DIM_WINDOW_BRIGHTNESS = -BACKGROUND_OPACITY / 255.0f;
|
||||
@ -54,13 +52,11 @@ namespace Gala
|
||||
float dock_width = 0.0f;
|
||||
int n_dock_items = 0;
|
||||
|
||||
public WindowSwitcher (WindowManager wm)
|
||||
{
|
||||
public WindowSwitcher (WindowManager wm) {
|
||||
Object (wm: wm);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
// pull drawing methods from libplank
|
||||
dock_settings = new Plank.DockPreferences ("dock1");
|
||||
dock_settings.notify.connect (update_dock);
|
||||
@ -113,8 +109,7 @@ namespace Gala
|
||||
visible = false;
|
||||
}
|
||||
|
||||
~WindowSwitcher ()
|
||||
{
|
||||
~WindowSwitcher () {
|
||||
if (monitor != null)
|
||||
monitor.cancel ();
|
||||
|
||||
@ -126,8 +121,7 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
|
||||
void load_dock_theme ()
|
||||
{
|
||||
void load_dock_theme () {
|
||||
if (dock_theme != null)
|
||||
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
|
||||
*/
|
||||
void update_dock ()
|
||||
{
|
||||
void update_dock () {
|
||||
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -201,8 +194,7 @@ namespace Gala
|
||||
dock_surface = null;
|
||||
}
|
||||
|
||||
void update_background ()
|
||||
{
|
||||
void update_background () {
|
||||
int width = 0, height = 0;
|
||||
#if HAS_MUTTER330
|
||||
wm.get_display ().get_size (out width, out height);
|
||||
@ -213,14 +205,12 @@ namespace Gala
|
||||
background.set_size (width, height);
|
||||
}
|
||||
|
||||
void update_actors ()
|
||||
{
|
||||
void update_actors () {
|
||||
update_dock ();
|
||||
update_background ();
|
||||
}
|
||||
|
||||
bool draw_dock_background (Cairo.Context cr)
|
||||
{
|
||||
bool draw_dock_background (Cairo.Context cr) {
|
||||
cr.set_operator (Cairo.Operator.CLEAR);
|
||||
cr.paint ();
|
||||
cr.set_operator (Cairo.Operator.OVER);
|
||||
@ -276,8 +266,7 @@ namespace Gala
|
||||
return false;
|
||||
}
|
||||
|
||||
void place_dock ()
|
||||
{
|
||||
void place_dock () {
|
||||
ui_scale_factor = InternalUtils.get_ui_scaling_factor ();
|
||||
|
||||
var icon_size = dock_settings.IconSize * ui_scale_factor;
|
||||
@ -307,8 +296,7 @@ namespace Gala
|
||||
dock.opacity = 255;
|
||||
}
|
||||
|
||||
void animate_dock_width ()
|
||||
{
|
||||
void animate_dock_width () {
|
||||
dock.save_easing_state ();
|
||||
dock.set_easing_duration (250);
|
||||
dock.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||
@ -327,8 +315,7 @@ namespace Gala
|
||||
dock.restore_easing_state ();
|
||||
}
|
||||
|
||||
void show_background ()
|
||||
{
|
||||
void show_background () {
|
||||
background.save_easing_state ();
|
||||
background.set_easing_duration (250);
|
||||
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||
@ -336,8 +323,7 @@ namespace Gala
|
||||
background.restore_easing_state ();
|
||||
}
|
||||
|
||||
void hide_background ()
|
||||
{
|
||||
void hide_background () {
|
||||
background.save_easing_state ();
|
||||
background.set_easing_duration (250);
|
||||
background.set_easing_mode (AnimationMode.EASE_OUT_CUBIC);
|
||||
@ -367,13 +353,11 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
void window_removed (Actor actor)
|
||||
{
|
||||
void window_removed (Actor actor) {
|
||||
clone_sort_order.remove (actor);
|
||||
}
|
||||
|
||||
void icon_removed (Actor actor)
|
||||
{
|
||||
void icon_removed (Actor actor) {
|
||||
if (dock.get_n_children () == 1) {
|
||||
#if HAS_MUTTER330
|
||||
close (wm.get_display ().get_current_time ());
|
||||
@ -394,16 +378,14 @@ namespace Gala
|
||||
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)
|
||||
close (event.time);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void key_focus_out ()
|
||||
{
|
||||
public override void key_focus_out () {
|
||||
#if HAS_MUTTER330
|
||||
close (wm.get_display ().get_current_time ());
|
||||
#else
|
||||
@ -414,12 +396,11 @@ namespace Gala
|
||||
[CCode (instance_pos = -1)]
|
||||
#if HAS_MUTTER330
|
||||
public void handle_switch_windows (Display display, Window? window, Clutter.KeyEvent event,
|
||||
KeyBinding binding)
|
||||
KeyBinding binding) {
|
||||
#else
|
||||
public void handle_switch_windows (Display display, Screen screen, Window? window,
|
||||
Clutter.KeyEvent event, KeyBinding binding)
|
||||
Clutter.KeyEvent event, KeyBinding binding) {
|
||||
#endif
|
||||
{
|
||||
var now = get_monotonic_time () / 1000;
|
||||
if (now - last_switch < MIN_DELTA)
|
||||
return;
|
||||
@ -490,8 +471,7 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
|
||||
void close_cleanup ()
|
||||
{
|
||||
void close_cleanup () {
|
||||
#if HAS_MUTTER330
|
||||
var display = wm.get_display ();
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -602,8 +581,7 @@ namespace Gala
|
||||
close_cleanup ();
|
||||
}
|
||||
|
||||
WindowIcon? add_window (Window window)
|
||||
{
|
||||
WindowIcon? add_window (Window window) {
|
||||
var actor = window.get_compositor_private () as WindowActor;
|
||||
if (actor == null)
|
||||
return null;
|
||||
@ -630,8 +608,7 @@ namespace Gala
|
||||
return icon;
|
||||
}
|
||||
|
||||
void dim_windows ()
|
||||
{
|
||||
void dim_windows () {
|
||||
foreach (var actor in window_clones.get_children ()) {
|
||||
unowned SafeWindowClone clone = (SafeWindowClone) actor;
|
||||
|
||||
@ -677,8 +654,7 @@ namespace Gala
|
||||
* @return whether the switcher should actually be started or if there are
|
||||
* not enough windows
|
||||
*/
|
||||
bool collect_windows (Workspace workspace)
|
||||
{
|
||||
bool collect_windows (Workspace workspace) {
|
||||
#if HAS_MUTTER330
|
||||
var display = workspace.get_display ();
|
||||
#else
|
||||
@ -747,8 +723,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
WindowIcon next_window (Workspace workspace, bool backward)
|
||||
{
|
||||
WindowIcon next_window (Workspace workspace, bool backward) {
|
||||
Actor actor;
|
||||
if (!backward) {
|
||||
actor = current_window.get_next_sibling ();
|
||||
@ -769,8 +744,7 @@ namespace Gala
|
||||
*
|
||||
* @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)
|
||||
modifier_mask = 0;
|
||||
else {
|
||||
@ -785,8 +759,7 @@ namespace Gala
|
||||
/**
|
||||
* 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)
|
||||
return;
|
||||
|
||||
@ -802,8 +775,7 @@ namespace Gala
|
||||
n_dock_items = count;
|
||||
}
|
||||
|
||||
Gdk.ModifierType get_current_modifiers ()
|
||||
{
|
||||
Gdk.ModifierType get_current_modifiers () {
|
||||
Gdk.ModifierType modifiers;
|
||||
double[] axes = {};
|
||||
Gdk.Display.get_default ().get_device_manager ().get_client_pointer ()
|
||||
|
@ -18,28 +18,23 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
/**
|
||||
* Utility class which adds a border and a shadow to a Background
|
||||
*/
|
||||
class FramedBackground : BackgroundManager
|
||||
{
|
||||
class FramedBackground : BackgroundManager {
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public FramedBackground (Display display)
|
||||
{
|
||||
public FramedBackground (Display display) {
|
||||
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
|
||||
}
|
||||
#else
|
||||
public FramedBackground (Screen screen)
|
||||
{
|
||||
public FramedBackground (Screen screen) {
|
||||
Object (screen: screen, monitor_index: screen.get_primary_monitor (), control_position: false);
|
||||
}
|
||||
#endif
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
#if HAS_MUTTER330
|
||||
var primary = display.get_primary_monitor ();
|
||||
var monitor_geom = display.get_monitor_geometry (primary);
|
||||
@ -53,8 +48,7 @@ namespace Gala
|
||||
add_effect (effect);
|
||||
}
|
||||
|
||||
public override void paint ()
|
||||
{
|
||||
public override void paint () {
|
||||
base.paint ();
|
||||
|
||||
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
|
||||
* of the MultitaskingView.
|
||||
*/
|
||||
public class WorkspaceClone : Actor
|
||||
{
|
||||
public class WorkspaceClone : Actor {
|
||||
/**
|
||||
* The offset of the scaled background to the bottom of the monitor bounds
|
||||
*/
|
||||
@ -131,13 +124,11 @@ namespace Gala
|
||||
|
||||
uint hover_activate_timeout = 0;
|
||||
|
||||
public WorkspaceClone (Workspace workspace)
|
||||
{
|
||||
public WorkspaceClone (Workspace workspace) {
|
||||
Object (workspace: workspace);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
opened = false;
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -241,8 +232,7 @@ namespace Gala
|
||||
listener.window_no_longer_on_all_workspaces.connect (add_window);
|
||||
}
|
||||
|
||||
~WorkspaceClone ()
|
||||
{
|
||||
~WorkspaceClone () {
|
||||
#if HAS_MUTTER330
|
||||
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
|
||||
* belongs to this workspace and this monitor.
|
||||
*/
|
||||
void add_window (Window window)
|
||||
{
|
||||
void add_window (Window window) {
|
||||
#if HAS_MUTTER330
|
||||
if (window.window_type != WindowType.NORMAL
|
||||
|| window.get_workspace () != workspace
|
||||
@ -298,38 +287,32 @@ namespace Gala
|
||||
/**
|
||||
* Remove a window from the WindowCloneContainer and the IconGroup
|
||||
*/
|
||||
void remove_window (Window window)
|
||||
{
|
||||
void remove_window (Window window) {
|
||||
window_container.remove_window (window);
|
||||
icon_group.remove_window (window, opened);
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
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 ())
|
||||
remove_window (window);
|
||||
}
|
||||
#else
|
||||
void window_entered_monitor (Screen screen, int monitor, Window window)
|
||||
{
|
||||
void window_entered_monitor (Screen screen, int monitor, 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 ())
|
||||
remove_window (window);
|
||||
}
|
||||
#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) {
|
||||
window_container.set_size (monitor_geometry.width, monitor_geometry.height);
|
||||
background.set_size (window_container.width, window_container.height);
|
||||
@ -342,8 +325,7 @@ namespace Gala
|
||||
*
|
||||
* @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.y += amount;
|
||||
rect.width -= amount * 2;
|
||||
@ -356,8 +338,7 @@ namespace Gala
|
||||
* Also sets the current_window of the WindowCloneContainer to the active window
|
||||
* if it belongs to this workspace.
|
||||
*/
|
||||
public void open ()
|
||||
{
|
||||
public void open () {
|
||||
if (opened)
|
||||
return;
|
||||
|
||||
@ -413,8 +394,7 @@ namespace Gala
|
||||
* Close the view again by animating the background back to its scale and
|
||||
* the windows back to their old locations.
|
||||
*/
|
||||
public void close ()
|
||||
{
|
||||
public void close () {
|
||||
if (!opened)
|
||||
return;
|
||||
|
||||
|
@ -18,10 +18,8 @@
|
||||
using Clutter;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class WorkspaceInsertThumb : Actor
|
||||
{
|
||||
namespace Gala {
|
||||
public class WorkspaceInsertThumb : Actor {
|
||||
public const int EXPAND_DELAY = 300;
|
||||
|
||||
public int workspace_index { get; construct set; }
|
||||
@ -30,8 +28,7 @@ namespace Gala
|
||||
|
||||
uint expand_timeout = 0;
|
||||
|
||||
public WorkspaceInsertThumb (int workspace_index)
|
||||
{
|
||||
public WorkspaceInsertThumb (int workspace_index) {
|
||||
Object (workspace_index: workspace_index);
|
||||
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
@ -62,8 +59,7 @@ namespace Gala
|
||||
add_action (drop);
|
||||
}
|
||||
|
||||
public void set_window_thumb (Window window)
|
||||
{
|
||||
public void set_window_thumb (Window window) {
|
||||
destroy_all_children ();
|
||||
|
||||
var scale = InternalUtils.get_ui_scaling_factor ();
|
||||
@ -73,8 +69,7 @@ namespace Gala
|
||||
add_child (icon);
|
||||
}
|
||||
|
||||
bool expand ()
|
||||
{
|
||||
bool expand () {
|
||||
expand_timeout = 0;
|
||||
|
||||
transform (true);
|
||||
@ -82,8 +77,7 @@ namespace Gala
|
||||
return false;
|
||||
}
|
||||
|
||||
void transform (bool expand)
|
||||
{
|
||||
void transform (bool expand) {
|
||||
save_easing_state ();
|
||||
set_easing_mode (AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (200);
|
||||
@ -104,8 +98,7 @@ namespace Gala
|
||||
restore_easing_state ();
|
||||
}
|
||||
|
||||
void add_pulse_animation ()
|
||||
{
|
||||
void add_pulse_animation () {
|
||||
var transition = new TransitionGroup ();
|
||||
transition.duration = 800;
|
||||
transition.auto_reverse = true;
|
||||
|
@ -18,20 +18,17 @@
|
||||
using Gala;
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
public struct WindowGeometry {
|
||||
Meta.Rectangle inner;
|
||||
Meta.Rectangle outer;
|
||||
}
|
||||
|
||||
public class WindowListener : Object
|
||||
{
|
||||
public class WindowListener : Object {
|
||||
static WindowListener? instance = null;
|
||||
|
||||
#if HAS_MUTTER330
|
||||
public static void init (Meta.Display display)
|
||||
{
|
||||
public static void init (Meta.Display display) {
|
||||
if (instance != null)
|
||||
return;
|
||||
|
||||
@ -52,8 +49,7 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
#else
|
||||
public static void init (Screen screen)
|
||||
{
|
||||
public static void init (Screen screen) {
|
||||
if (instance != null)
|
||||
return;
|
||||
|
||||
@ -75,9 +71,7 @@ namespace Gala
|
||||
}
|
||||
#endif
|
||||
|
||||
public static unowned WindowListener get_default ()
|
||||
requires (instance != null)
|
||||
{
|
||||
public static unowned WindowListener get_default () requires (instance != null) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -85,21 +79,18 @@ namespace Gala
|
||||
|
||||
Gee.HashMap<Meta.Window, WindowGeometry?> unmaximized_state_geometry;
|
||||
|
||||
WindowListener ()
|
||||
{
|
||||
WindowListener () {
|
||||
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.unmanaged.connect (window_removed);
|
||||
|
||||
window_maximized_changed (window);
|
||||
}
|
||||
|
||||
void window_notify (Object object, ParamSpec pspec)
|
||||
{
|
||||
void window_notify (Object object, ParamSpec pspec) {
|
||||
var window = (Window) object;
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
window_no_longer_on_all_workspaces (window);
|
||||
}
|
||||
|
||||
void window_maximized_changed (Window window)
|
||||
{
|
||||
void window_maximized_changed (Window window) {
|
||||
WindowGeometry window_geometry = {};
|
||||
window_geometry.inner = window.get_frame_rect ();
|
||||
window_geometry.outer = window.get_buffer_rect ();
|
||||
@ -130,13 +119,11 @@ namespace Gala
|
||||
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);
|
||||
}
|
||||
|
||||
void window_removed (Window window)
|
||||
{
|
||||
void window_removed (Window window) {
|
||||
window.notify.disconnect (window_notify);
|
||||
window.unmanaged.disconnect (window_removed);
|
||||
}
|
||||
|
@ -17,19 +17,16 @@
|
||||
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
namespace Gala {
|
||||
const string DAEMON_DBUS_NAME = "org.pantheon.gala.daemon";
|
||||
const string DAEMON_DBUS_OBJECT_PATH = "/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 class WindowManagerGala : Meta.Plugin, WindowManager
|
||||
{
|
||||
public class WindowManagerGala : Meta.Plugin, WindowManager {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -90,8 +87,7 @@ namespace Gala
|
||||
|
||||
GLib.Settings animations_settings;
|
||||
|
||||
public WindowManagerGala ()
|
||||
{
|
||||
public WindowManagerGala () {
|
||||
info = Meta.PluginInfo () {name = "Gala", version = Config.VERSION, author = "Gala Developers",
|
||||
license = "GPLv3", description = "A nice elementary window manager"};
|
||||
|
||||
@ -113,8 +109,7 @@ namespace Gala
|
||||
enable_animations = animations_settings.get_boolean ("enable-animations");
|
||||
}
|
||||
|
||||
public override void start ()
|
||||
{
|
||||
public override void start () {
|
||||
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
||||
|
||||
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 {
|
||||
daemon_proxy = Bus.get_proxy.end (res);
|
||||
} catch (Error e) {
|
||||
@ -139,20 +133,17 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void lost_daemon ()
|
||||
{
|
||||
void lost_daemon () {
|
||||
daemon_proxy = null;
|
||||
}
|
||||
|
||||
void daemon_appeared ()
|
||||
{
|
||||
void daemon_appeared () {
|
||||
if (daemon_proxy == null) {
|
||||
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
|
||||
unowned Meta.Display display = get_display ();
|
||||
#else
|
||||
@ -371,8 +362,7 @@ namespace Gala
|
||||
return false;
|
||||
}
|
||||
|
||||
void configure_hotcorners ()
|
||||
{
|
||||
void configure_hotcorners () {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = get_display ();
|
||||
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());
|
||||
@ -388,8 +378,7 @@ namespace Gala
|
||||
update_input_area ();
|
||||
}
|
||||
|
||||
void add_hotcorner (float x, float y, string key)
|
||||
{
|
||||
void add_hotcorner (float x, float y, string key) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Clutter.Actor? stage = get_display ().get_stage ();
|
||||
#else
|
||||
@ -431,8 +420,7 @@ namespace Gala
|
||||
#if HAS_MUTTER330
|
||||
[CCode (instance_pos = -1)]
|
||||
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);
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
var index = manager.get_active_workspace_index () + direction;
|
||||
@ -449,8 +437,7 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -460,8 +447,7 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -474,16 +460,14 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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);
|
||||
switch_to_next_workspace (direction);
|
||||
}
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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 ();
|
||||
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 ());
|
||||
@ -491,8 +475,7 @@ namespace Gala
|
||||
#else
|
||||
[CCode (instance_pos = -1)]
|
||||
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 index = screen.get_active_workspace_index () + direction;
|
||||
|
||||
@ -508,8 +491,7 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -519,8 +501,7 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -532,16 +513,14 @@ namespace Gala
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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);
|
||||
switch_to_next_workspace (direction);
|
||||
}
|
||||
|
||||
[CCode (instance_pos = -1)]
|
||||
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);
|
||||
screen.get_workspace_by_index (index).activate (display.get_current_time ());
|
||||
}
|
||||
@ -550,8 +529,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void switch_to_next_workspace (MotionDirection direction)
|
||||
{
|
||||
public void switch_to_next_workspace (MotionDirection direction) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = get_display ();
|
||||
var active_workspace = display.get_workspace_manager ().get_active_workspace ();
|
||||
@ -589,8 +567,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
#if HAS_MUTTER330
|
||||
void update_input_area ()
|
||||
{
|
||||
void update_input_area () {
|
||||
unowned Meta.Display display = get_display ();
|
||||
|
||||
if (screensaver != null) {
|
||||
@ -613,8 +590,7 @@ namespace Gala
|
||||
InternalUtils.set_input_area (display, InputArea.DEFAULT);
|
||||
}
|
||||
#else
|
||||
void update_input_area ()
|
||||
{
|
||||
void update_input_area () {
|
||||
var screen = get_screen ();
|
||||
|
||||
if (screensaver != null) {
|
||||
@ -638,8 +614,7 @@ namespace Gala
|
||||
}
|
||||
#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 ();
|
||||
if (Utils.get_n_windows (workspace) == 0) {
|
||||
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" };
|
||||
|
||||
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> ();
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -734,8 +707,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void move_window (Window? window, MotionDirection direction)
|
||||
{
|
||||
public void move_window (Window? window, MotionDirection direction) {
|
||||
if (window == null)
|
||||
return;
|
||||
|
||||
@ -777,8 +749,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ModalProxy push_modal ()
|
||||
{
|
||||
public ModalProxy push_modal () {
|
||||
var proxy = new ModalProxy ();
|
||||
|
||||
modal_stack.offer_head (proxy);
|
||||
@ -810,8 +781,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void pop_modal (ModalProxy proxy)
|
||||
{
|
||||
public void pop_modal (ModalProxy proxy) {
|
||||
if (!modal_stack.remove (proxy)) {
|
||||
warning ("Attempted to remove a modal proxy that was not in the stack");
|
||||
return;
|
||||
@ -838,27 +808,23 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public bool is_modal ()
|
||||
{
|
||||
public bool is_modal () {
|
||||
return (modal_stack.size > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public bool modal_proxy_valid (ModalProxy proxy)
|
||||
{
|
||||
public bool modal_proxy_valid (ModalProxy proxy) {
|
||||
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,
|
||||
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!
|
||||
var win = window.get_compositor_private () as WindowActor;
|
||||
if (dim) {
|
||||
@ -872,8 +838,7 @@ namespace Gala
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void perform_action (ActionType type)
|
||||
{
|
||||
public void perform_action (ActionType type) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = get_display ();
|
||||
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) {
|
||||
case WindowMenuType.WM:
|
||||
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) {
|
||||
tile_preview = new Clutter.Actor ();
|
||||
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) {
|
||||
tile_preview.remove_all_transitions ();
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1126,8 +1087,7 @@ namespace Gala
|
||||
* 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
|
||||
if (!window.is_on_primary_monitor ())
|
||||
return;
|
||||
@ -1197,8 +1157,7 @@ namespace Gala
|
||||
|
||||
// must wait for size_changed to get updated frame_rect
|
||||
// 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;
|
||||
old_rect_size_change = old_frame_rect;
|
||||
}
|
||||
@ -1242,8 +1201,7 @@ namespace Gala
|
||||
size_change_completed (actor);
|
||||
}
|
||||
|
||||
public override void minimize (WindowActor actor)
|
||||
{
|
||||
public override void minimize (WindowActor actor) {
|
||||
const int duration = AnimationDuration.MINIMIZE;
|
||||
|
||||
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;
|
||||
|
||||
if (!enable_animations
|
||||
@ -1412,8 +1369,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
public override void unminimize (WindowActor actor)
|
||||
{
|
||||
public override void unminimize (WindowActor actor) {
|
||||
if (!enable_animations) {
|
||||
actor.show ();
|
||||
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 ();
|
||||
if (!enable_animations) {
|
||||
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 ();
|
||||
|
||||
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;
|
||||
if (!enable_animations
|
||||
|| 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 ();
|
||||
|
||||
// Do nothing if the current workspace would be empty
|
||||
@ -1792,8 +1744,7 @@ namespace Gala
|
||||
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 ();
|
||||
|
||||
// Do nothing if the current workspace is populated with other windows
|
||||
@ -1804,7 +1755,7 @@ namespace Gala
|
||||
if (!ws_assoc.contains (window)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var old_ws_index = ws_assoc.get (window);
|
||||
var new_ws_index = win_ws.index ();
|
||||
|
||||
@ -1828,8 +1779,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
// 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))
|
||||
return false;
|
||||
|
||||
@ -1848,8 +1798,7 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void kill_window_effects (WindowActor actor)
|
||||
{
|
||||
public override void kill_window_effects (WindowActor actor) {
|
||||
if (end_animation (ref mapping, actor))
|
||||
map_completed (actor);
|
||||
if (end_animation (ref unminimizing, actor))
|
||||
@ -1868,8 +1817,7 @@ namespace Gala
|
||||
List<Clutter.Actor>? parents;
|
||||
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;
|
||||
|
||||
if (!enable_animations
|
||||
@ -2093,8 +2041,7 @@ namespace Gala
|
||||
end_switch_workspace ();
|
||||
}
|
||||
|
||||
void end_switch_workspace ()
|
||||
{
|
||||
void end_switch_workspace () {
|
||||
if (windows == null || parents == null)
|
||||
return;
|
||||
|
||||
@ -2165,13 +2112,11 @@ namespace Gala
|
||||
switch_workspace_completed ();
|
||||
}
|
||||
|
||||
public override void kill_switch_workspace ()
|
||||
{
|
||||
public override void kill_switch_workspace () {
|
||||
end_switch_workspace ();
|
||||
}
|
||||
|
||||
public override bool keybinding_filter (Meta.KeyBinding binding)
|
||||
{
|
||||
public override bool keybinding_filter (Meta.KeyBinding binding) {
|
||||
if (!is_modal ())
|
||||
return false;
|
||||
|
||||
@ -2182,8 +2127,7 @@ namespace Gala
|
||||
&& modal_proxy.keybinding_filter (binding));
|
||||
}
|
||||
|
||||
public override void confirm_display_change ()
|
||||
{
|
||||
public override void confirm_display_change () {
|
||||
var pid = Util.show_dialog ("--question",
|
||||
_("Does the display look OK?"),
|
||||
"30",
|
||||
@ -2204,13 +2148,11 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
|
||||
public override unowned Meta.PluginInfo? plugin_info ()
|
||||
{
|
||||
public override unowned Meta.PluginInfo? plugin_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)
|
||||
return;
|
||||
|
||||
|
@ -17,19 +17,13 @@
|
||||
|
||||
using Meta;
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
public class WorkspaceManager : Object
|
||||
{
|
||||
public static void init (WindowManager wm)
|
||||
requires (instance == null)
|
||||
{
|
||||
namespace Gala {
|
||||
public class WorkspaceManager : Object {
|
||||
public static void init (WindowManager wm) requires (instance == null) {
|
||||
instance = new WorkspaceManager (wm);
|
||||
}
|
||||
|
||||
public static unowned WorkspaceManager get_default ()
|
||||
requires (instance != null)
|
||||
{
|
||||
public static unowned WorkspaceManager get_default () requires (instance != null) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -40,13 +34,11 @@ namespace Gala
|
||||
Gee.LinkedList<Workspace> workspaces_marked_removed;
|
||||
int remove_freeze_count = 0;
|
||||
|
||||
WorkspaceManager (WindowManager wm)
|
||||
{
|
||||
WorkspaceManager (WindowManager wm) {
|
||||
Object (wm: wm);
|
||||
}
|
||||
|
||||
construct
|
||||
{
|
||||
construct {
|
||||
workspaces_marked_removed = new Gee.LinkedList<Workspace> ();
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = wm.get_display ();
|
||||
@ -97,8 +89,7 @@ namespace Gala
|
||||
cleanup ();
|
||||
}
|
||||
|
||||
~WorkspaceManager ()
|
||||
{
|
||||
~WorkspaceManager () {
|
||||
Prefs.remove_listener (prefs_listener);
|
||||
|
||||
#if HAS_MUTTER330
|
||||
@ -120,8 +111,7 @@ namespace Gala
|
||||
}
|
||||
|
||||
#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);
|
||||
if (workspace == null)
|
||||
return;
|
||||
@ -130,8 +120,7 @@ namespace Gala
|
||||
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;
|
||||
for (int i = 0; i < manager.get_n_workspaces (); 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 ())
|
||||
return;
|
||||
|
||||
@ -159,8 +147,7 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
#else
|
||||
void workspace_added (Screen screen, int index)
|
||||
{
|
||||
void workspace_added (Screen screen, int index) {
|
||||
var workspace = screen.get_workspace_by_index (index);
|
||||
if (workspace == null)
|
||||
return;
|
||||
@ -169,8 +156,7 @@ namespace Gala
|
||||
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 ();
|
||||
|
||||
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 ())
|
||||
return;
|
||||
|
||||
@ -194,8 +179,7 @@ namespace Gala
|
||||
}
|
||||
#endif
|
||||
|
||||
void window_added (Workspace? workspace, Window window)
|
||||
{
|
||||
void window_added (Workspace? workspace, Window window) {
|
||||
if (workspace == null || !Prefs.get_dynamic_workspaces ()
|
||||
|| window.on_all_workspaces)
|
||||
return;
|
||||
@ -215,8 +199,7 @@ namespace Gala
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -252,37 +235,32 @@ namespace Gala
|
||||
}
|
||||
|
||||
#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 ()
|
||||
&& monitor == display.get_primary_monitor ())
|
||||
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 ()
|
||||
&& monitor == display.get_primary_monitor ())
|
||||
window_removed (window.get_workspace (), window);
|
||||
}
|
||||
#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 ()
|
||||
&& monitor == screen.get_primary_monitor ())
|
||||
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 ()
|
||||
&& monitor == screen.get_primary_monitor ())
|
||||
window_removed (window.get_workspace (), window);
|
||||
}
|
||||
#endif
|
||||
|
||||
void prefs_listener (Meta.Preference pref)
|
||||
{
|
||||
void prefs_listener (Meta.Preference pref) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.WorkspaceManager manager = wm.get_display ().get_workspace_manager ();
|
||||
|
||||
@ -302,8 +280,7 @@ namespace Gala
|
||||
#endif
|
||||
}
|
||||
|
||||
void append_workspace ()
|
||||
{
|
||||
void append_workspace () {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = wm.get_display ();
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
@ -321,8 +298,7 @@ namespace Gala
|
||||
*
|
||||
* @param workspace The workspace to remove
|
||||
*/
|
||||
void remove_workspace (Workspace workspace)
|
||||
{
|
||||
void remove_workspace (Workspace workspace) {
|
||||
#if HAS_MUTTER330
|
||||
unowned Meta.Display display = workspace.get_display ();
|
||||
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();
|
||||
@ -367,16 +343,14 @@ namespace Gala
|
||||
/**
|
||||
* Temporarily disables removing workspaces when they are empty
|
||||
*/
|
||||
public void freeze_remove ()
|
||||
{
|
||||
public void freeze_remove () {
|
||||
remove_freeze_count++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo the effect of freeze_remove()
|
||||
*/
|
||||
public void thaw_remove ()
|
||||
{
|
||||
public void thaw_remove () {
|
||||
remove_freeze_count--;
|
||||
|
||||
assert (remove_freeze_count >= 0);
|
||||
@ -387,8 +361,7 @@ namespace Gala
|
||||
* be removed. Particularily useful in conjunction with freeze/thaw_remove to
|
||||
* cleanup after an operation that required stable workspace/window indices
|
||||
*/
|
||||
public void cleanup ()
|
||||
{
|
||||
public void cleanup () {
|
||||
if (!Prefs.get_dynamic_workspaces ())
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user