Created
May 8, 2019 21:31
-
-
Save Tireg/22482d842e12864bba97784a64eca41d to your computer and use it in GitHub Desktop.
Fix Gala building with mutter 3.30 (See https://github.com/elementary/gala/issues/303 for instructions)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Utils.vala b/lib/Utils.vala | |
index 5832118..408f816 100644 | |
--- a/lib/Utils.vala | |
+++ b/lib/Utils.vala | |
@@ -187,8 +187,7 @@ namespace Gala | |
*/ | |
public static Meta.Window get_next_window (Meta.Workspace workspace, bool backward = false) | |
{ | |
- var screen = workspace.get_screen (); | |
- var display = screen.get_display (); | |
+ var display = workspace.get_display (); | |
var window = display.get_tab_next (Meta.TabList.NORMAL, | |
workspace, null, backward); | |
@@ -264,16 +263,16 @@ namespace Gala | |
/** | |
* Ring the system bell, will most likely emit a <beep> error sound or, if the | |
- * audible bell is disabled, flash the screen | |
+ * audible bell is disabled, flash the display | |
* | |
- * @param screen The screen to flash, if necessary | |
+ * @param display The display to flash, if necessary | |
*/ | |
- public static void bell (Meta.Screen screen) | |
+ public static void bell (Meta.Display display) | |
{ | |
if (Meta.Prefs.bell_is_audible ()) | |
Gdk.beep (); | |
else | |
- screen.get_display ().get_compositor ().flash_screen (screen); | |
+ display.get_compositor ().flash_display (display); | |
} | |
public static int get_ui_scaling_factor () | |
diff --git a/plugins/maskcorners/Main.vala b/plugins/maskcorners/Main.vala | |
index 670ac4f..094bc76 100644 | |
--- a/plugins/maskcorners/Main.vala | |
+++ b/plugins/maskcorners/Main.vala | |
@@ -23,7 +23,7 @@ namespace Gala.Plugins.MaskCorners | |
public class Main : Gala.Plugin | |
{ | |
Gala.WindowManager? wm = null; | |
- Screen screen; | |
+ Display display; | |
Settings settings; | |
List<Actor>[] cornermasks; | |
@@ -32,7 +32,7 @@ namespace Gala.Plugins.MaskCorners | |
public override void initialize (Gala.WindowManager wm) | |
{ | |
this.wm = wm; | |
- screen = wm.get_screen (); | |
+ display = wm.get_display (); | |
settings = Settings.get_default (); | |
setup_cornermasks (); | |
@@ -56,35 +56,35 @@ namespace Gala.Plugins.MaskCorners | |
var scale = 1; | |
#endif | |
- int n_monitors = screen.get_n_monitors (); | |
+ int n_monitors = display.get_n_monitors (); | |
cornermasks = new List<Actor>[n_monitors]; | |
corner_radius = settings.corner_radius * scale; | |
if (settings.only_on_primary) { | |
- add_cornermasks (screen.get_primary_monitor ()); | |
+ add_cornermasks (display.get_primary_monitor ()); | |
} else { | |
for (int m = 0; m < n_monitors; m++) | |
add_cornermasks (m); | |
} | |
if (settings.disable_on_fullscreen) | |
- screen.in_fullscreen_changed.connect (fullscreen_changed); | |
+ display.in_fullscreen_changed.connect (fullscreen_changed); | |
- screen.monitors_changed.connect (resetup_cornermasks); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (resetup_cornermasks); | |
#if HAS_MUTTER322 | |
- screen.get_display ().gl_video_memory_purged.connect (resetup_cornermasks); | |
+ display.gl_video_memory_purged.connect (resetup_cornermasks); | |
#endif | |
} | |
void destroy_cornermasks () | |
{ | |
#if HAS_MUTTER322 | |
- screen.get_display ().gl_video_memory_purged.disconnect (resetup_cornermasks); | |
+ display.gl_video_memory_purged.disconnect (resetup_cornermasks); | |
#endif | |
- screen.monitors_changed.disconnect (resetup_cornermasks); | |
- screen.in_fullscreen_changed.disconnect (fullscreen_changed); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.disconnect (resetup_cornermasks); | |
+ display.in_fullscreen_changed.disconnect (fullscreen_changed); | |
foreach (unowned List<Actor> list in cornermasks) { | |
foreach (Actor actor in list) | |
@@ -100,9 +100,9 @@ namespace Gala.Plugins.MaskCorners | |
void fullscreen_changed () | |
{ | |
- for (int i = 0; i < screen.get_n_monitors (); i++) { | |
+ for (int i = 0; i < display.get_n_monitors (); i++) { | |
foreach (Actor actor in cornermasks[i]) { | |
- if (screen.get_monitor_in_fullscreen (i)) | |
+ if (display.get_monitor_in_fullscreen (i)) | |
actor.hide (); | |
else | |
actor.show (); | |
@@ -112,7 +112,7 @@ namespace Gala.Plugins.MaskCorners | |
void add_cornermasks (int monitor_no) | |
{ | |
- var monitor_geometry = screen.get_monitor_geometry (monitor_no); | |
+ var monitor_geometry = display.get_monitor_geometry (monitor_no); | |
Canvas canvas = new Canvas (); | |
canvas.set_size (corner_radius, corner_radius); | |
diff --git a/plugins/notify/Main.vala b/plugins/notify/Main.vala | |
index 6769114..8ab7eb3 100644 | |
--- a/plugins/notify/Main.vala | |
+++ b/plugins/notify/Main.vala | |
@@ -30,9 +30,9 @@ namespace Gala.Plugins.Notify | |
public override void initialize (Gala.WindowManager wm) | |
{ | |
this.wm = wm; | |
- var screen = wm.get_screen (); | |
+ var display = wm.get_display (); | |
- stack = new NotificationStack (wm.get_screen ()); | |
+ stack = new NotificationStack (wm.get_display ()); | |
wm.ui_group.add_child (stack); | |
track_actor (stack); | |
@@ -43,8 +43,8 @@ namespace Gala.Plugins.Notify | |
server = new NotifyServer (stack); | |
update_position (); | |
- screen.monitors_changed.connect (update_position); | |
- screen.workareas_changed.connect (update_position); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (update_position); | |
+ display.workareas_changed.connect (update_position); | |
Bus.own_name (BusType.SESSION, "org.freedesktop.Notifications", BusNameOwnerFlags.NONE, | |
(connection) => { | |
@@ -64,9 +64,9 @@ namespace Gala.Plugins.Notify | |
void update_position () | |
{ | |
- var screen = wm.get_screen (); | |
- var primary = screen.get_primary_monitor (); | |
- var area = screen.get_active_workspace ().get_work_area_for_monitor (primary); | |
+ var display = wm.get_display (); | |
+ var primary = display.get_primary_monitor (); | |
+ var area = display.get_workspace_manager ().get_active_workspace ().get_work_area_for_monitor (primary); | |
stack.x = area.x + area.width - stack.width; | |
stack.y = area.y; | |
diff --git a/plugins/notify/NormalNotification.vala b/plugins/notify/NormalNotification.vala | |
index f9bafbb..bdfa2e2 100644 | |
--- a/plugins/notify/NormalNotification.vala | |
+++ b/plugins/notify/NormalNotification.vala | |
@@ -181,13 +181,13 @@ namespace Gala.Plugins.Notify | |
public string body { get; construct set; } | |
public uint32 sender_pid { get; construct; } | |
public string[] notification_actions { get; construct set; } | |
- public Screen screen { get; construct; } | |
+ public Display display { get; construct; } | |
Actor content_container; | |
NormalNotificationContent notification_content; | |
NormalNotificationContent? old_notification_content = null; | |
- public NormalNotification (Screen screen, uint32 id, string summary, string body, Gdk.Pixbuf? icon, | |
+ public NormalNotification (Display display, uint32 id, string summary, string body, Gdk.Pixbuf? icon, | |
NotificationUrgency urgency, int32 expire_timeout, uint32 pid, string[] actions) | |
{ | |
Object ( | |
@@ -195,7 +195,7 @@ namespace Gala.Plugins.Notify | |
icon: icon, | |
urgency: urgency, | |
expire_timeout: expire_timeout, | |
- screen: screen, | |
+ display: display, | |
summary: summary, | |
body: body, | |
sender_pid: pid, | |
@@ -303,9 +303,9 @@ namespace Gala.Plugins.Notify | |
unowned Meta.Window? window = get_window (); | |
if (window != null) { | |
unowned Meta.Workspace workspace = window.get_workspace (); | |
- var time = screen.get_display ().get_current_time (); | |
+ var time = display.get_current_time (); | |
- if (workspace != screen.get_active_workspace ()) | |
+ if (workspace != display.get_workspace_manager ().get_active_workspace ()) | |
workspace.activate_with_focus (window, time); | |
else | |
window.activate (time); | |
@@ -319,11 +319,12 @@ namespace Gala.Plugins.Notify | |
if (sender_pid == 0) | |
return null; | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
- if (actor.is_destroyed ()) | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
// the windows are sorted by stacking order when returned | |
// from meta_get_window_actors, so we can just pick the first | |
diff --git a/plugins/notify/NotificationStack.vala b/plugins/notify/NotificationStack.vala | |
index 9470507..3e91c24 100644 | |
--- a/plugins/notify/NotificationStack.vala | |
+++ b/plugins/notify/NotificationStack.vala | |
@@ -29,11 +29,11 @@ namespace Gala.Plugins.Notify | |
public signal void animations_changed (bool running); | |
- public Screen screen { get; construct; } | |
+ public Display display { get; construct; } | |
- public NotificationStack (Screen screen) | |
+ public NotificationStack (Display display) | |
{ | |
- Object (screen: screen); | |
+ Object (display: display); | |
} | |
construct | |
diff --git a/plugins/notify/NotifyServer.vala b/plugins/notify/NotifyServer.vala | |
index 6d0c978..871dd6a 100644 | |
--- a/plugins/notify/NotifyServer.vala | |
+++ b/plugins/notify/NotifyServer.vala | |
@@ -286,7 +286,7 @@ namespace Gala.Plugins.Notify | |
progress ? hints.@get ("value").get_int32 () : -1, | |
hints.@get (X_CANONICAL_PRIVATE_SYNCHRONOUS).get_string ()); | |
else | |
- notification = new NormalNotification (stack.screen, id, summary, body, pixbuf, | |
+ notification = new NormalNotification (stack.display, id, summary, body, pixbuf, | |
urgency, timeout, pid, actions); | |
notification.action_invoked.connect (notification_action_invoked_callback); | |
diff --git a/plugins/pip/Main.vala b/plugins/pip/Main.vala | |
index 0dca1fd..7dca678 100644 | |
--- a/plugins/pip/Main.vala | |
+++ b/plugins/pip/Main.vala | |
@@ -37,7 +37,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
public override void initialize (Gala.WindowManager wm) | |
{ | |
this.wm = wm; | |
- var display = wm.get_screen ().get_display (); | |
+ var display = wm.get_display (); | |
var settings = new GLib.Settings (Config.SCHEMA + ".keybindings"); | |
display.add_keybinding ("pip", settings, Meta.KeyBindingFlags.NONE, (Meta.KeyHandlerFunc) on_initiate); | |
@@ -55,8 +55,8 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
} | |
[CCode (instance_pos = -1)] | |
- void on_initiate (Meta.Display display, Meta.Screen screen, | |
- Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding) | |
+ void on_initiate (Meta.Display display, Meta.Window? window, | |
+ Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
selection_area = new SelectionArea (wm); | |
selection_area.selected.connect (on_selection_actor_selected); | |
@@ -134,8 +134,8 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
private Meta.WindowActor? get_window_actor_at (int x, int y) | |
{ | |
- var screen = wm.get_screen (); | |
- unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (screen); | |
+ var display = wm.get_display (); | |
+ unowned List<weak Clutter.Actor> actors = Meta.Compositor.get_window_actors (display); | |
var copy = actors.copy (); | |
copy.reverse (); | |
@@ -146,11 +146,13 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
return; | |
} | |
- var window = actor.get_meta_window (); | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ | |
+ var window = window_actor.get_meta_window (); | |
var rect = window.get_frame_rect (); | |
- if (!actor.is_destroyed () && !window.is_hidden () && !window.is_skip_taskbar () && meta_rectangle_contains (rect, x, y)) { | |
- selected = actor; | |
+ if (!window_actor.is_destroyed () && !window.is_hidden () && !window.is_skip_taskbar () && meta_rectangle_contains (rect, x, y)) { | |
+ selected = window_actor; | |
} | |
}); | |
@@ -159,8 +161,8 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
private Meta.WindowActor? get_active_window_actor () | |
{ | |
- var screen = wm.get_screen (); | |
- unowned List<weak Meta.WindowActor> actors = Meta.Compositor.get_window_actors (screen); | |
+ var display = wm.get_display (); | |
+ unowned List<weak Clutter.Actor> actors = Meta.Compositor.get_window_actors (display); | |
var copy = actors.copy (); | |
copy.reverse (); | |
@@ -171,9 +173,11 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin | |
return; | |
} | |
- var window = actor.get_meta_window (); | |
- if (!actor.is_destroyed () && !window.is_hidden () && !window.is_skip_taskbar () && window.has_focus ()) { | |
- active = actor; | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ | |
+ var window = window_actor.get_meta_window (); | |
+ if (!window_actor.is_destroyed () && !window.is_hidden () && !window.is_skip_taskbar () && window.has_focus ()) { | |
+ active = window_actor; | |
} | |
}); | |
diff --git a/plugins/pip/PopupWindow.vala b/plugins/pip/PopupWindow.vala | |
index 16b0144..40c828e 100644 | |
--- a/plugins/pip/PopupWindow.vala | |
+++ b/plugins/pip/PopupWindow.vala | |
@@ -233,7 +233,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
clicked = false; | |
if (dragging) { | |
- update_screen_position (); | |
+ update_display_position (); | |
dragging = false; | |
} else { | |
activate (); | |
@@ -266,7 +266,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
private void on_resize_drag_end (Clutter.Actor actor, float event_x, float event_y, Clutter.ModifierType type) | |
{ | |
reposition_resize_handle (); | |
- update_screen_position (); | |
+ update_display_position (); | |
} | |
private void on_resize_drag_motion (Clutter.Actor actor, float delta_x, float delta_y) | |
@@ -310,7 +310,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
private void update_window_focus () | |
{ | |
- unowned Meta.Window focus_window = wm.get_screen ().get_display ().get_focus_window (); | |
+ unowned Meta.Window focus_window = wm.get_display ().get_focus_window (); | |
if ((focus_window != null && !get_window_is_normal (focus_window)) | |
|| (previous_focus != null && !get_window_is_normal (previous_focus))) { | |
previous_focus = focus_window; | |
@@ -392,7 +392,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
} | |
} | |
- private void update_screen_position () | |
+ private void update_display_position () | |
{ | |
Meta.Rectangle monitor_rect; | |
get_current_monitor_rect (out monitor_rect); | |
@@ -405,15 +405,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
set_easing_duration (300); | |
set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK); | |
- var screen_limit_start = SCREEN_MARGIN + monitor_x; | |
- var screen_limit_end = monitor_width + monitor_x - SCREEN_MARGIN - width; | |
+ var display_limit_start = SCREEN_MARGIN + monitor_x; | |
+ var display_limit_end = monitor_width + monitor_x - SCREEN_MARGIN - width; | |
- x = x.clamp (screen_limit_start, screen_limit_end); | |
+ x = x.clamp (display_limit_start, display_limit_end); | |
- screen_limit_start = SCREEN_MARGIN + monitor_y; | |
- screen_limit_end = monitor_height + monitor_y - SCREEN_MARGIN - height; | |
+ display_limit_start = SCREEN_MARGIN + monitor_y; | |
+ display_limit_end = monitor_height + monitor_y - SCREEN_MARGIN - height; | |
- y = y.clamp (screen_limit_start, screen_limit_end); | |
+ y = y.clamp (display_limit_start, display_limit_end); | |
set_easing_mode (Clutter.AnimationMode.EASE_IN_QUAD); | |
set_easing_duration (0); | |
@@ -431,8 +431,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor | |
private void get_current_monitor_rect (out Meta.Rectangle rect) | |
{ | |
- var screen = wm.get_screen (); | |
- rect = screen.get_monitor_geometry (screen.get_current_monitor ()); | |
+ var display = wm.get_display (); | |
+ rect = display.get_monitor_geometry (display.get_current_monitor ()); | |
} | |
private void get_target_window_size (out float width, out float height) | |
diff --git a/plugins/pip/SelectionArea.vala b/plugins/pip/SelectionArea.vala | |
index 5c86c39..4bd6e2c 100644 | |
--- a/plugins/pip/SelectionArea.vala | |
+++ b/plugins/pip/SelectionArea.vala | |
@@ -41,13 +41,13 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor | |
visible = true; | |
reactive = true; | |
- int screen_width, screen_height; | |
- wm.get_screen ().get_size (out screen_width, out screen_height); | |
- width = screen_width; | |
- height = screen_height; | |
+ int display_width, display_height; | |
+ wm.get_display ().get_size (out display_width, out display_height); | |
+ width = display_width; | |
+ height = display_height; | |
var canvas = new Clutter.Canvas (); | |
- canvas.set_size (screen_width, screen_height); | |
+ canvas.set_size (display_width, display_height); | |
canvas.draw.connect (draw_area); | |
set_content (canvas); | |
@@ -126,7 +126,7 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor | |
public void close () | |
{ | |
- wm.get_screen ().set_cursor (Meta.Cursor.DEFAULT); | |
+ wm.get_display ().set_cursor (Meta.Cursor.DEFAULT); | |
if (modal_proxy != null) { | |
wm.pop_modal (modal_proxy); | |
@@ -135,7 +135,7 @@ public class Gala.Plugins.PIP.SelectionArea : Clutter.Actor | |
public void start_selection () | |
{ | |
- wm.get_screen ().set_cursor (Meta.Cursor.CROSSHAIR); | |
+ wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR); | |
grab_key_focus (); | |
modal_proxy = wm.push_modal (); | |
diff --git a/plugins/template/Main.vala b/plugins/template/Main.vala | |
index efa3ce3..f78a17b 100644 | |
--- a/plugins/template/Main.vala | |
+++ b/plugins/template/Main.vala | |
@@ -49,8 +49,8 @@ namespace Gala.Plugins.Template | |
// we want to place it in the lower right of the primary monitor with a bit | |
// of padding. refer to vapi/libmutter.vapi in gala's source for something | |
// remotely similar to a documentation | |
- var screen = wm.get_screen (); | |
- var rect = screen.get_monitor_geometry (screen.get_primary_monitor ()); | |
+ var display = wm.get_display (); | |
+ var rect = display.get_monitor_geometry (display.get_primary_monitor ()); | |
red_box.x = rect.x + rect.width - red_box.width - PADDING; | |
red_box.y = rect.y + rect.height - red_box.height - PADDING; | |
diff --git a/plugins/template/README b/plugins/template/README | |
index 28ebd85..d3d0dad 100644 | |
--- a/plugins/template/README | |
+++ b/plugins/template/README | |
@@ -25,34 +25,34 @@ To add keybindings, you'll need a gsettings schema. You can take a look at Gala' | |
schema in data/org.pantheon.desktop.gschema.xml for an example. You'll also find | |
how to correctly declare shortcut keys in that file. Once you got this file ready | |
it's pretty easy. Just enable its installation in cmake, the relevant is commented | |
-out in this template, and call wm.get_screen().get_display().add_keybinding(). | |
+out in this template, and call wm.get_display().add_keybinding(). | |
The keybinding function takes the name of the shortcut key in your | |
schema, then a GSettings instance for that schema, which can be obtained with | |
'new GLib.Settings("org.pantheon.gala.plugins.my-plugin")', then some flags, for | |
which you can almost always use 0, refer to the vapi for more details, and finally | |
your function as arguments. Its delegate is: | |
-public delegate void KeyHandlerFunc (Meta.Display display, Meta.Screen screen, | |
- Meta.Window? window, X.Event event, Meta.KeyBinding binding); | |
+public delegate void KeyHandlerFunc (Meta.Display display, Meta.Window? window, | |
+ X.Event event, Meta.KeyBinding binding); | |
So it'd be something like | |
void initialize (Gala.WindowManager wm) | |
{ | |
[...] | |
- var display = wm.get_screen ().get_display (); | |
+ var display = wm.get_display (); | |
var schema = new GLib.Settings ("org.pantheon.desktop.gala.plugins"); | |
display.add_keybinding ("my-shortcut", schema, 0, my_handler); | |
[...] | |
} | |
-void my_handler (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+void my_handler (Meta.Display display, Meta.Window? window, | |
X.Event event, Meta.KeyBinding binding) | |
{ | |
print ("Shortcut hit! D:"); | |
} | |
void destroy () | |
{ | |
- wm.get_screen ().get_display ().remove_keybinding ("my-shortcut"); | |
+ wm.get_display ().remove_keybinding ("my-shortcut"); | |
} | |
Overriding default keybindings | |
diff --git a/plugins/zoom/Main.vala b/plugins/zoom/Main.vala | |
index 8457e10..0fc3266 100644 | |
--- a/plugins/zoom/Main.vala | |
+++ b/plugins/zoom/Main.vala | |
@@ -30,7 +30,7 @@ namespace Gala.Plugins.Zoom | |
public override void initialize (Gala.WindowManager wm) | |
{ | |
this.wm = wm; | |
- var display = wm.get_screen ().get_display (); | |
+ var display = wm.get_display (); | |
var schema = new GLib.Settings (Config.SCHEMA + ".keybindings"); | |
display.add_keybinding ("zoom-in", schema, 0, (Meta.KeyHandlerFunc) zoom_in); | |
@@ -42,7 +42,7 @@ namespace Gala.Plugins.Zoom | |
if (wm == null) | |
return; | |
- var display = wm.get_screen ().get_display (); | |
+ var display = wm.get_display (); | |
display.remove_keybinding ("zoom-in"); | |
display.remove_keybinding ("zoom-out"); | |
@@ -53,15 +53,15 @@ namespace Gala.Plugins.Zoom | |
} | |
[CCode (instance_pos = -1)] | |
- void zoom_in (Meta.Display display, Meta.Screen screen, | |
- Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding) | |
+ void zoom_in (Meta.Display display, Meta.Window? window, | |
+ Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
zoom (true); | |
} | |
[CCode (instance_pos = -1)] | |
- void zoom_out (Meta.Display display, Meta.Screen screen, | |
- Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding) | |
+ void zoom_out (Meta.Display display, Meta.Window? window, | |
+ Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
zoom (false); | |
} | |
diff --git a/src/Background/Background.vala b/src/Background/Background.vala | |
index 4b934bb..d2e985e 100644 | |
--- a/src/Background/Background.vala | |
+++ b/src/Background/Background.vala | |
@@ -25,7 +25,7 @@ namespace Gala | |
public signal void changed (); | |
public signal void loaded (); | |
- public Meta.Screen screen { get; construct; } | |
+ public Meta.Display display { get; construct; } | |
public int monitor_index { get; construct; } | |
public BackgroundSource background_source { get; construct; } | |
public bool is_loaded { get; private set; default = false; } | |
@@ -38,10 +38,10 @@ namespace Gala | |
Cancellable cancellable; | |
uint update_animation_timeout_id = 0; | |
- public Background (Meta.Screen screen, int monitor_index, string? filename, | |
+ public Background (Meta.Display display, int monitor_index, string? filename, | |
BackgroundSource background_source, GDesktop.BackgroundStyle style) | |
{ | |
- Object (screen: screen, | |
+ Object (display: display, | |
monitor_index: monitor_index, | |
background_source: background_source, | |
style: style, | |
@@ -50,7 +50,7 @@ namespace Gala | |
construct | |
{ | |
- background = new Meta.Background (screen); | |
+ background = new Meta.Background (display); | |
background.set_data<unowned Background> ("delegate", this); | |
file_watches = new Gee.HashMap<string,ulong> (); | |
@@ -145,7 +145,7 @@ namespace Gala | |
{ | |
update_animation_timeout_id = 0; | |
- animation.update (screen.get_monitor_geometry (monitor_index)); | |
+ animation.update (display.get_monitor_geometry (monitor_index)); | |
var files = animation.key_frame_files; | |
Clutter.Callback finish = () => { | |
diff --git a/src/Background/BackgroundCache.vala b/src/Background/BackgroundCache.vala | |
index 6126e3b..16ab74d 100644 | |
--- a/src/Background/BackgroundCache.vala | |
+++ b/src/Background/BackgroundCache.vala | |
@@ -91,11 +91,11 @@ namespace Gala | |
return animation; | |
} | |
- public BackgroundSource get_background_source (Meta.Screen screen, string settings_schema) | |
+ public BackgroundSource get_background_source (Meta.Display display, string settings_schema) | |
{ | |
var background_source = background_sources[settings_schema]; | |
if (background_source == null) { | |
- background_source = new BackgroundSource (screen, settings_schema); | |
+ background_source = new BackgroundSource (display, settings_schema); | |
background_source.use_count = 1; | |
background_sources[settings_schema] = background_source; | |
} else | |
diff --git a/src/Background/BackgroundContainer.vala b/src/Background/BackgroundContainer.vala | |
index ceaf44c..5ac4dc3 100644 | |
--- a/src/Background/BackgroundContainer.vala | |
+++ b/src/Background/BackgroundContainer.vala | |
@@ -21,23 +21,23 @@ namespace Gala | |
{ | |
public signal void changed (); | |
- public Meta.Screen screen { get; construct; } | |
+ public Meta.Display display { get; construct; } | |
- public BackgroundContainer (Meta.Screen screen) | |
+ public BackgroundContainer (Meta.Display display) | |
{ | |
- Object (screen: screen); | |
+ Object (display: display); | |
} | |
construct | |
{ | |
- screen.monitors_changed.connect (update); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (update); | |
update (); | |
} | |
~BackgroundContainer () | |
{ | |
- screen.monitors_changed.disconnect (update); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.disconnect (update); | |
} | |
void update () | |
@@ -48,8 +48,8 @@ namespace Gala | |
destroy_all_children (); | |
- for (var i = 0; i < screen.get_n_monitors (); i++) { | |
- var background = new BackgroundManager (screen, i); | |
+ for (var i = 0; i < display.get_n_monitors (); i++) { | |
+ var background = new BackgroundManager (display, i); | |
add_child (background); | |
diff --git a/src/Background/BackgroundManager.vala b/src/Background/BackgroundManager.vala | |
index 4ab5c30..9e901b2 100644 | |
--- a/src/Background/BackgroundManager.vala | |
+++ b/src/Background/BackgroundManager.vala | |
@@ -24,7 +24,7 @@ namespace Gala | |
public signal void changed (); | |
- public Meta.Screen screen { get; construct; } | |
+ public Meta.Display display { get; construct; } | |
public int monitor_index { get; construct; } | |
public bool control_position { get; construct; } | |
@@ -32,14 +32,14 @@ namespace Gala | |
Meta.BackgroundActor background_actor; | |
Meta.BackgroundActor? new_background_actor = null; | |
- public BackgroundManager (Meta.Screen screen, int monitor_index, bool control_position = true) | |
+ public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true) | |
{ | |
- Object (screen: screen, monitor_index: monitor_index, control_position: control_position); | |
+ Object (display: display, monitor_index: monitor_index, control_position: control_position); | |
} | |
construct | |
{ | |
- background_source = BackgroundCache.get_default ().get_background_source (screen, BACKGROUND_SCHEMA); | |
+ background_source = BackgroundCache.get_default ().get_background_source (display, BACKGROUND_SCHEMA); | |
background_actor = create_background_actor (); | |
} | |
@@ -125,13 +125,13 @@ namespace Gala | |
Meta.BackgroundActor create_background_actor () | |
{ | |
var background = background_source.get_background (monitor_index); | |
- var background_actor = new Meta.BackgroundActor (screen, monitor_index); | |
+ var background_actor = new Meta.BackgroundActor (display, monitor_index); | |
background_actor.background = background.background; | |
insert_child_below (background_actor, null); | |
- var monitor = screen.get_monitor_geometry (monitor_index); | |
+ var monitor = display.get_monitor_geometry (monitor_index); | |
background_actor.set_size (monitor.width, monitor.height); | |
diff --git a/src/Background/BackgroundSource.vala b/src/Background/BackgroundSource.vala | |
index 1548a0d..26cddd5 100644 | |
--- a/src/Background/BackgroundSource.vala | |
+++ b/src/Background/BackgroundSource.vala | |
@@ -21,23 +21,23 @@ namespace Gala | |
{ | |
public signal void changed (); | |
- public Meta.Screen screen { get; construct; } | |
+ public Meta.Display display { get; construct; } | |
public Settings settings { get; construct; } | |
internal int use_count { get; set; default = 0; } | |
Gee.HashMap<int,Background> backgrounds; | |
- public BackgroundSource (Meta.Screen screen, string settings_schema) | |
+ public BackgroundSource (Meta.Display display, string settings_schema) | |
{ | |
- Object (screen: screen, settings: new Settings (settings_schema)); | |
+ Object (display: display, settings: new Settings (settings_schema)); | |
} | |
construct | |
{ | |
backgrounds = new Gee.HashMap<int,Background> (); | |
- screen.monitors_changed.connect (monitors_changed); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (monitors_changed); | |
settings_hash_cache = get_current_settings_hash_cache (); | |
settings.changed.connect (settings_changed); | |
@@ -45,7 +45,7 @@ namespace Gala | |
void monitors_changed () | |
{ | |
- var n = screen.get_n_monitors (); | |
+ var n = display.get_n_monitors (); | |
var i = 0; | |
foreach (var background in backgrounds.values) { | |
@@ -82,7 +82,7 @@ namespace Gala | |
monitor_index = 0; | |
if (!backgrounds.has_key (monitor_index)) { | |
- var background = new Background (screen, monitor_index, filename, this, (GDesktop.BackgroundStyle) style); | |
+ var background = new Background (display, monitor_index, filename, this, (GDesktop.BackgroundStyle) style); | |
background.changed.connect (background_changed); | |
backgrounds[monitor_index] = background; | |
} | |
@@ -99,7 +99,7 @@ namespace Gala | |
public void destroy () | |
{ | |
- screen.monitors_changed.disconnect (monitors_changed); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.disconnect (monitors_changed); | |
foreach (var background in backgrounds) { | |
background.changed.disconnect (background_changed); | |
diff --git a/src/Background/SystemBackground.vala b/src/Background/SystemBackground.vala | |
index f41fdda..12645e6 100644 | |
--- a/src/Background/SystemBackground.vala | |
+++ b/src/Background/SystemBackground.vala | |
@@ -25,9 +25,9 @@ namespace Gala | |
public signal void loaded (); | |
- public SystemBackground (Meta.Screen screen) | |
+ public SystemBackground (Meta.Display display) | |
{ | |
- Object (meta_screen: screen, monitor: 0); | |
+ Object (meta_display: display, monitor: 0); | |
} | |
construct | |
@@ -39,7 +39,7 @@ namespace Gala | |
} | |
if (system_background == null) { | |
- system_background = new Meta.Background (meta_screen); | |
+ system_background = new Meta.Background (meta_display); | |
system_background.set_color (DEFAULT_BACKGROUND_COLOR); | |
system_background.set_file (background_file, GDesktop.BackgroundStyle.WALLPAPER); | |
} | |
diff --git a/src/DBusAccelerator.vala b/src/DBusAccelerator.vala | |
index fcd01a4..d1d46ef 100644 | |
--- a/src/DBusAccelerator.vala | |
+++ b/src/DBusAccelerator.vala | |
@@ -47,7 +47,7 @@ namespace Gala | |
wm = _wm; | |
grabbed_accelerators = new HashTable<string, uint> (str_hash, str_equal); | |
- wm.get_screen ().get_display ().accelerator_activated.connect (on_accelerator_activated); | |
+ wm.get_display ().accelerator_activated.connect (on_accelerator_activated); | |
} | |
void on_accelerator_activated (uint action, uint device_id, uint timestamp) | |
@@ -68,7 +68,7 @@ namespace Gala | |
uint? action = grabbed_accelerators[accelerator]; | |
if (action == null) { | |
- action = wm.get_screen ().get_display ().grab_accelerator (accelerator); | |
+ action = wm.get_display ().grab_accelerator (accelerator); | |
if (action > 0) { | |
grabbed_accelerators[accelerator] = action; | |
} | |
@@ -94,7 +94,7 @@ namespace Gala | |
foreach (unowned string accelerator in grabbed_accelerators.get_keys ()) { | |
if (grabbed_accelerators[accelerator] == action) { | |
- ret = wm.get_screen ().get_display ().ungrab_accelerator (action); | |
+ ret = wm.get_display ().ungrab_accelerator (action); | |
grabbed_accelerators.remove (accelerator); | |
break; | |
} | |
diff --git a/src/InternalUtils.vala b/src/InternalUtils.vala | |
index c40ef62..f29f15c 100644 | |
--- a/src/InternalUtils.vala | |
+++ b/src/InternalUtils.vala | |
@@ -71,14 +71,12 @@ namespace Gala | |
/** | |
* set the area where clutter can receive events | |
**/ | |
- public static void set_input_area (Screen screen, InputArea area) | |
+ public static void set_input_area (Display display, InputArea area) | |
{ | |
- var display = screen.get_display (); | |
- | |
X.Xrectangle[] rects = {}; | |
int width, height; | |
- screen.get_size (out width, out height); | |
- var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ()); | |
+ display.get_size (out width, out height); | |
+ var geometry = display.get_monitor_geometry (display.get_primary_monitor ()); | |
switch (area) { | |
case InputArea.FULLSCREEN: | |
@@ -110,12 +108,12 @@ namespace Gala | |
break; | |
case InputArea.NONE: | |
default: | |
- Util.empty_stage_input_region (screen); | |
+ Compositor.empty_stage_input_region (display); | |
return; | |
} | |
- var xregion = X.Fixes.create_region (display.get_xdisplay (), rects); | |
- Util.set_stage_input_region (screen, xregion); | |
+ var xregion = X.Fixes.create_region (display.get_x11_display ().get_xdisplay (), rects); | |
+ Compositor.set_stage_input_region (display, xregion); | |
} | |
/** | |
@@ -132,12 +130,13 @@ namespace Gala | |
new_window.change_workspace_by_index (index, false); | |
- unowned List<unowned WindowActor> actors = Compositor.get_window_actors (new_window.get_screen ()); | |
- foreach (unowned Meta.WindowActor actor in actors) { | |
- if (actor.is_destroyed ()) | |
+ unowned List<unowned Clutter.Actor> actors = Compositor.get_window_actors (new_window.get_display ()); | |
+ foreach (unowned Clutter.Actor actor in actors) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
if (window == new_window) | |
continue; | |
diff --git a/src/ScreenshotManager.vala b/src/ScreenshotManager.vala | |
index 3c61fcb..2ae0360 100644 | |
--- a/src/ScreenshotManager.vala | |
+++ b/src/ScreenshotManager.vala | |
@@ -72,7 +72,7 @@ namespace Gala | |
debug ("Taking screenshot"); | |
int width, height; | |
- wm.get_screen ().get_size (out width, out height); | |
+ wm.get_display ().get_size (out width, out height); | |
var image = take_screenshot (0, 0, width, height, include_cursor); | |
@@ -104,7 +104,7 @@ namespace Gala | |
{ | |
debug ("Taking window screenshot"); | |
- var window = wm.get_screen ().get_display ().get_focus_window (); | |
+ var window = wm.get_display ().get_focus_window (); | |
var window_actor = (Meta.WindowActor) window.get_compositor_private (); | |
unowned Meta.ShapedTexture window_texture = (Meta.ShapedTexture) window_actor.get_texture (); | |
@@ -251,7 +251,7 @@ namespace Gala | |
Cairo.ImageSurface composite_stage_cursor (Cairo.ImageSurface image, Cairo.RectangleInt image_rect) | |
{ | |
- unowned Meta.CursorTracker cursor_tracker = Meta.CursorTracker.get_for_screen (wm.get_screen ()); | |
+ unowned Meta.CursorTracker cursor_tracker = Meta.CursorTracker.get_for_display (wm.get_display ()); | |
int x, y; | |
cursor_tracker.get_pointer (out x, out y, null); | |
diff --git a/src/Widgets/IconGroup.vala b/src/Widgets/IconGroup.vala | |
index 29abe31..4169608 100644 | |
--- a/src/Widgets/IconGroup.vala | |
+++ b/src/Widgets/IconGroup.vala | |
@@ -324,7 +324,7 @@ namespace Gala | |
*/ | |
void close () | |
{ | |
- var time = workspace.get_screen ().get_display ().get_current_time (); | |
+ var time = workspace.get_display ().get_current_time (); | |
foreach (var window in workspace.list_windows ()) { | |
var type = window.window_type; | |
if (!window.is_on_all_workspaces () && (type == WindowType.NORMAL | |
@@ -391,12 +391,12 @@ namespace Gala | |
// it's not safe to to call meta_workspace_index() here, we may be still animating something | |
// while the workspace is already gone, which would result in a crash. | |
- var screen = workspace.get_screen (); | |
- var workspace_index = screen.get_workspaces ().index (workspace); | |
+ var display = workspace.get_display (); | |
+ var workspace_index = display.get_workspace_manager().get_workspaces ().index (workspace); | |
if (n_windows < 1) { | |
if (!Prefs.get_dynamic_workspaces () | |
- || workspace_index != screen.get_n_workspaces () - 1) | |
+ || workspace_index != display.get_workspace_manager().get_n_workspaces () - 1) | |
return false; | |
var buffer = new Granite.Drawing.BufferSurface (SIZE * scale, SIZE * scale); | |
diff --git a/src/Widgets/IconGroupContainer.vala b/src/Widgets/IconGroupContainer.vala | |
index 6f5f7c2..7269488 100644 | |
--- a/src/Widgets/IconGroupContainer.vala | |
+++ b/src/Widgets/IconGroupContainer.vala | |
@@ -32,11 +32,11 @@ namespace Gala | |
public signal void request_reposition (); | |
- public Screen screen { get; construct; } | |
+ public Display display { get; construct; } | |
- public IconGroupContainer (Screen screen) | |
+ public IconGroupContainer (Display display) | |
{ | |
- Object (screen: screen); | |
+ Object (display: display); | |
layout_manager = new BoxLayout (); | |
} | |
diff --git a/src/Widgets/MonitorClone.vala b/src/Widgets/MonitorClone.vala | |
index 96681ce..bb32232 100644 | |
--- a/src/Widgets/MonitorClone.vala | |
+++ b/src/Widgets/MonitorClone.vala | |
@@ -31,32 +31,33 @@ namespace Gala | |
{ | |
public signal void window_selected (Window window); | |
- public Screen screen { get; construct; } | |
+ public Display display { get; construct; } | |
public int monitor { get; construct; } | |
WindowCloneContainer window_container; | |
BackgroundManager background; | |
- public MonitorClone (Screen screen, int monitor) | |
+ public MonitorClone (Display display, int monitor) | |
{ | |
- Object (screen: screen, monitor: monitor); | |
+ Object (display: display, monitor: monitor); | |
} | |
construct | |
{ | |
reactive = true; | |
- background = new BackgroundManager (screen, monitor, false); | |
+ background = new BackgroundManager (display, monitor, false); | |
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION); | |
window_container = new WindowCloneContainer (); | |
window_container.window_selected.connect ((w) => { window_selected (w); }); | |
- screen.restacked.connect (window_container.restack_windows); | |
+ display.restacked.connect (window_container.restack_windows); | |
- screen.window_entered_monitor.connect (window_entered); | |
- screen.window_left_monitor.connect (window_left); | |
+ display.window_entered_monitor.connect (window_entered); | |
+ display.window_left_monitor.connect (window_left); | |
- foreach (unowned Meta.WindowActor window_actor in Meta.Compositor.get_window_actors (screen)) { | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
if (window_actor.is_destroyed ()) | |
continue; | |
@@ -77,9 +78,9 @@ namespace Gala | |
~MonitorClone () | |
{ | |
- screen.window_entered_monitor.disconnect (window_entered); | |
- screen.window_left_monitor.disconnect (window_left); | |
- screen.restacked.disconnect (window_container.restack_windows); | |
+ display.window_entered_monitor.disconnect (window_entered); | |
+ display.window_left_monitor.disconnect (window_left); | |
+ display.restacked.disconnect (window_container.restack_windows); | |
} | |
/** | |
@@ -87,7 +88,7 @@ namespace Gala | |
*/ | |
public void update_allocation () | |
{ | |
- var monitor_geometry = screen.get_monitor_geometry (monitor); | |
+ var monitor_geometry = display.get_monitor_geometry (monitor); | |
set_position (monitor_geometry.x, monitor_geometry.y); | |
set_size (monitor_geometry.width, monitor_geometry.height); | |
diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala | |
index 5f720ce..2c91eaf 100644 | |
--- a/src/Widgets/MultitaskingView.vala | |
+++ b/src/Widgets/MultitaskingView.vala | |
@@ -33,7 +33,7 @@ namespace Gala | |
public WindowManager wm { get; construct; } | |
- Meta.Screen screen; | |
+ Meta.Display display; | |
ModalProxy modal_proxy; | |
bool opened = false; | |
bool animating = false; | |
@@ -58,12 +58,12 @@ namespace Gala | |
clip_to_allocation = true; | |
opened = false; | |
- screen = wm.get_screen (); | |
+ display = wm.get_display (); | |
workspaces = new Actor (); | |
workspaces.set_easing_mode (AnimationMode.EASE_OUT_QUAD); | |
- icon_groups = new IconGroupContainer (screen); | |
+ icon_groups = new IconGroupContainer (display); | |
icon_groups.request_reposition.connect (() => reposition_icon_groups (true)); | |
dock_clones = new Actor (); | |
@@ -72,18 +72,18 @@ namespace Gala | |
add_child (workspaces); | |
add_child (dock_clones); | |
- foreach (var workspace in screen.get_workspaces ()) | |
+ foreach (var workspace in display.get_workspace_manager ().get_workspaces ()) | |
add_workspace (workspace.index ()); | |
- screen.workspace_added.connect (add_workspace); | |
- screen.workspace_removed.connect (remove_workspace); | |
- screen.workspace_switched.connect_after ((from, to, direction) => { | |
+ display.get_workspace_manager ().workspace_added.connect (add_workspace); | |
+ display.get_workspace_manager ().workspace_removed.connect (remove_workspace); | |
+ display.get_workspace_manager ().workspace_switched.connect_after ((from, to, direction) => { | |
update_positions (opened); | |
}); | |
window_containers_monitors = new List<MonitorClone> (); | |
update_monitors (); | |
- screen.monitors_changed.connect (update_monitors); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (update_monitors); | |
Prefs.add_listener ((pref) => { | |
if (pref == Preference.WORKSPACES_ONLY_ON_PRIMARY) { | |
@@ -96,7 +96,7 @@ namespace Gala | |
return; | |
Idle.add (() => { | |
- unowned List<Workspace> existing_workspaces = screen.get_workspaces (); | |
+ unowned List<Workspace> existing_workspaces = display.get_workspace_manager ().get_workspaces (); | |
foreach (var child in workspaces.get_children ()) { | |
unowned WorkspaceClone workspace_clone = (WorkspaceClone) child; | |
@@ -127,14 +127,14 @@ namespace Gala | |
foreach (var monitor_clone in window_containers_monitors) | |
monitor_clone.destroy (); | |
- var primary = screen.get_primary_monitor (); | |
+ var primary = display.get_primary_monitor (); | |
if (InternalUtils.workspaces_only_on_primary ()) { | |
- for (var monitor = 0; monitor < screen.get_n_monitors (); monitor++) { | |
+ for (var monitor = 0; monitor < display.get_n_monitors (); monitor++) { | |
if (monitor == primary) | |
continue; | |
- var monitor_clone = new MonitorClone (screen, monitor); | |
+ var monitor_clone = new MonitorClone (display, monitor); | |
monitor_clone.window_selected.connect (window_selected); | |
monitor_clone.visible = opened; | |
@@ -143,7 +143,7 @@ namespace Gala | |
} | |
} | |
- var primary_geometry = screen.get_monitor_geometry (primary); | |
+ var primary_geometry = display.get_monitor_geometry (primary); | |
set_position (primary_geometry.x, primary_geometry.y); | |
set_size (primary_geometry.width, primary_geometry.height); | |
@@ -205,11 +205,11 @@ namespace Gala | |
// smooth scroll delay still active | |
return false; | |
- var active_workspace = screen.get_active_workspace (); | |
+ var active_workspace = display.get_workspace_manager ().get_active_workspace (); | |
var new_workspace = active_workspace.get_neighbor (direction); | |
if (active_workspace != new_workspace) | |
- new_workspace.activate (screen.get_display ().get_current_time ()); | |
+ new_workspace.activate (display.get_current_time ()); | |
return false; | |
} | |
@@ -224,7 +224,7 @@ namespace Gala | |
void update_positions (bool animate) | |
{ | |
var scale = InternalUtils.get_ui_scaling_factor (); | |
- var active_index = screen.get_active_workspace ().index (); | |
+ var active_index = display.get_workspace_manager ().get_active_workspace ().index (); | |
var active_x = 0.0f; | |
foreach (var child in workspaces.get_children ()) { | |
@@ -254,7 +254,7 @@ namespace Gala | |
void reposition_icon_groups (bool animate) | |
{ | |
- var active_index = screen.get_active_workspace ().index (); | |
+ var active_index = display.get_workspace_manager ().get_active_workspace ().index (); | |
if (animate) { | |
icon_groups.save_easing_state (); | |
@@ -277,7 +277,7 @@ namespace Gala | |
void add_workspace (int num) | |
{ | |
- var workspace = new WorkspaceClone (screen.get_workspace_by_index (num)); | |
+ var workspace = new WorkspaceClone (display.get_workspace_manager ().get_workspace_by_index (num)); | |
workspace.window_selected.connect (window_selected); | |
workspace.selected.connect (activate_workspace); | |
@@ -295,7 +295,7 @@ namespace Gala | |
WorkspaceClone? workspace = null; | |
// FIXME is there a better way to get the removed workspace? | |
- unowned List<Meta.Workspace> existing_workspaces = screen.get_workspaces (); | |
+ unowned List<Meta.Workspace> existing_workspaces = display.get_workspace_manager ().get_workspaces (); | |
foreach (var child in workspaces.get_children ()) { | |
unowned WorkspaceClone clone = (WorkspaceClone) child; | |
@@ -328,9 +328,9 @@ namespace Gala | |
*/ | |
void activate_workspace (WorkspaceClone clone, bool close_view) | |
{ | |
- close_view = close_view && screen.get_active_workspace () == clone.workspace; | |
+ close_view = close_view && display.get_workspace_manager ().get_active_workspace () == clone.workspace; | |
- clone.workspace.activate (screen.get_display ().get_current_time ()); | |
+ clone.workspace.activate (display.get_current_time ()); | |
if (close_view) | |
toggle (); | |
@@ -390,7 +390,7 @@ namespace Gala | |
{ | |
foreach (var child in workspaces.get_children ()) { | |
unowned WorkspaceClone workspace_clone = (WorkspaceClone) child; | |
- if (workspace_clone.workspace == screen.get_active_workspace ()) { | |
+ if (workspace_clone.workspace == display.get_workspace_manager ().get_active_workspace ()) { | |
return workspace_clone; | |
} | |
} | |
@@ -400,10 +400,10 @@ namespace Gala | |
void window_selected (Meta.Window window) | |
{ | |
- var time = screen.get_display ().get_current_time (); | |
+ var time = display.get_current_time (); | |
var workspace = window.get_workspace (); | |
- if (workspace != screen.get_active_workspace ()) | |
+ if (workspace != display.get_workspace_manager ().get_active_workspace ()) | |
workspace.activate (time); | |
else { | |
window.activate (time); | |
@@ -482,7 +482,7 @@ namespace Gala | |
// find active workspace clone and raise it, so there are no overlaps while transitioning | |
WorkspaceClone? active_workspace = null; | |
- var active = screen.get_active_workspace (); | |
+ var active = display.get_workspace_manager ().get_active_workspace (); | |
foreach (var child in workspaces.get_children ()) { | |
unowned WorkspaceClone workspace = (WorkspaceClone) child; | |
if (workspace.workspace == active) { | |
@@ -512,22 +512,23 @@ namespace Gala | |
dock_clones.get_transformed_position (out clone_offset_x, out clone_offset_y); | |
if (opening) { | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
const int MAX_OFFSET = 100; | |
- if (actor.is_destroyed ()) | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
var monitor = window.get_monitor (); | |
if (window.window_type != WindowType.DOCK) | |
continue; | |
- if (screen.get_monitor_in_fullscreen (monitor)) | |
+ if (display.get_monitor_in_fullscreen (monitor)) | |
continue; | |
- var monitor_geom = screen.get_monitor_geometry (monitor); | |
+ var monitor_geom = display.get_monitor_geometry (monitor); | |
var window_geom = window.get_frame_rect (); | |
var top = monitor_geom.y + MAX_OFFSET > window_geom.y; | |
diff --git a/src/Widgets/SelectionArea.vala b/src/Widgets/SelectionArea.vala | |
index 13f5ad6..ddf89c3 100644 | |
--- a/src/Widgets/SelectionArea.vala | |
+++ b/src/Widgets/SelectionArea.vala | |
@@ -43,13 +43,13 @@ namespace Gala | |
visible = true; | |
reactive = true; | |
- int screen_width, screen_height; | |
- wm.get_screen ().get_size (out screen_width, out screen_height); | |
- width = screen_width; | |
- height = screen_height; | |
+ int display_width, display_height; | |
+ wm.get_display ().get_size (out display_width, out display_height); | |
+ width = display_width; | |
+ height = display_height; | |
var canvas = new Clutter.Canvas (); | |
- canvas.set_size (screen_width, screen_height); | |
+ canvas.set_size (display_width, display_height); | |
canvas.draw.connect (draw_area); | |
set_content (canvas); | |
@@ -125,7 +125,7 @@ namespace Gala | |
public void close () | |
{ | |
- wm.get_screen ().set_cursor (Meta.Cursor.DEFAULT); | |
+ wm.get_display ().set_cursor (Meta.Cursor.DEFAULT); | |
if (modal_proxy != null) { | |
wm.pop_modal (modal_proxy); | |
@@ -134,7 +134,7 @@ namespace Gala | |
public void start_selection () | |
{ | |
- wm.get_screen ().set_cursor (Meta.Cursor.CROSSHAIR); | |
+ wm.get_display ().set_cursor (Meta.Cursor.CROSSHAIR); | |
grab_key_focus (); | |
modal_proxy = wm.push_modal (); | |
diff --git a/src/Widgets/WindowClone.vala b/src/Widgets/WindowClone.vala | |
index 26fd34d..a5c59f5 100644 | |
--- a/src/Widgets/WindowClone.vala | |
+++ b/src/Widgets/WindowClone.vala | |
@@ -270,7 +270,7 @@ namespace Gala | |
bool should_fade () | |
{ | |
return (overview_mode | |
- && window.get_workspace () != window.get_screen ().get_active_workspace ()) || window.minimized; | |
+ && window.get_workspace () != window.get_display ().get_workspace_manager ().get_active_workspace ()) || window.minimized; | |
} | |
void on_all_workspaces_changed () | |
@@ -289,7 +289,7 @@ namespace Gala | |
{ | |
var outer_rect = window.get_frame_rect (); | |
- var monitor_geom = window.get_screen ().get_monitor_geometry (window.get_monitor ()); | |
+ var monitor_geom = window.get_display ().get_monitor_geometry (window.get_monitor ()); | |
var offset_x = monitor_geom.x; | |
var offset_y = monitor_geom.y; | |
@@ -458,10 +458,10 @@ namespace Gala | |
*/ | |
void close_window () | |
{ | |
- var screen = window.get_screen (); | |
- check_confirm_dialog_cb = screen.window_entered_monitor.connect (check_confirm_dialog); | |
+ var display = window.get_display (); | |
+ check_confirm_dialog_cb = display.window_entered_monitor.connect (check_confirm_dialog); | |
- window.@delete (screen.get_display ().get_current_time ()); | |
+ window.@delete (display.get_current_time ()); | |
} | |
void check_confirm_dialog (int monitor, Meta.Window new_window) | |
@@ -472,7 +472,7 @@ namespace Gala | |
return false; | |
}); | |
- SignalHandler.disconnect (window.get_screen (), check_confirm_dialog_cb); | |
+ SignalHandler.disconnect (window.get_display (), check_confirm_dialog_cb); | |
check_confirm_dialog_cb = 0; | |
} | |
} | |
@@ -491,7 +491,7 @@ namespace Gala | |
clone.destroy (); | |
if (check_confirm_dialog_cb != 0) { | |
- SignalHandler.disconnect (window.get_screen (), check_confirm_dialog_cb); | |
+ SignalHandler.disconnect (window.get_display (), check_confirm_dialog_cb); | |
check_confirm_dialog_cb = 0; | |
} | |
@@ -583,7 +583,7 @@ namespace Gala | |
// for an icon group, we only do animations if there is an actual movement possible | |
if (icon_group != null | |
&& icon_group.workspace == window.get_workspace () | |
- && window.get_monitor () == window.get_screen ().get_primary_monitor ()) | |
+ && window.get_monitor () == window.get_display ().get_primary_monitor ()) | |
return; | |
var scale = hovered ? 0.4 : 1.0; | |
@@ -619,7 +619,7 @@ namespace Gala | |
void drag_end (Actor destination) | |
{ | |
Meta.Workspace workspace = null; | |
- var primary = window.get_screen ().get_primary_monitor (); | |
+ var primary = window.get_display ().get_primary_monitor (); | |
if (destination is IconGroup) { | |
workspace = ((IconGroup) destination).workspace; | |
diff --git a/src/Widgets/WindowCloneContainer.vala b/src/Widgets/WindowCloneContainer.vala | |
index de0cfb7..e85d929 100644 | |
--- a/src/Widgets/WindowCloneContainer.vala | |
+++ b/src/Widgets/WindowCloneContainer.vala | |
@@ -144,9 +144,8 @@ namespace Gala | |
* Sort the windows z-order by their actual stacking to make intersections | |
* during animations correct. | |
*/ | |
- public void restack_windows (Screen screen) | |
+ public void restack_windows (Display display) | |
{ | |
- unowned Meta.Display display = screen.get_display (); | |
var children = get_children (); | |
GLib.SList<Meta.Window> windows = new GLib.SList<Meta.Window> (); | |
diff --git a/src/Widgets/WindowOverview.vala b/src/Widgets/WindowOverview.vala | |
index 9a31aab..fc41ac0 100644 | |
--- a/src/Widgets/WindowOverview.vala | |
+++ b/src/Widgets/WindowOverview.vala | |
@@ -37,7 +37,7 @@ namespace Gala | |
public WindowManager wm { get; construct; } | |
- Meta.Screen screen; | |
+ Meta.Display display; | |
ModalProxy modal_proxy; | |
bool ready; | |
@@ -52,10 +52,10 @@ namespace Gala | |
construct | |
{ | |
- screen = wm.get_screen (); | |
+ display = wm.get_display (); | |
- screen.workspace_switched.connect (close); | |
- screen.restacked.connect (restack_windows); | |
+ display.get_workspace_manager ().workspace_switched.connect (close); | |
+ display.restacked.connect (restack_windows); | |
visible = false; | |
ready = true; | |
@@ -64,7 +64,7 @@ namespace Gala | |
~WindowOverview () | |
{ | |
- screen.restacked.disconnect (restack_windows); | |
+ display.restacked.disconnect (restack_windows); | |
} | |
public override bool key_press_event (Clutter.KeyEvent event) | |
@@ -121,10 +121,10 @@ namespace Gala | |
workspaces = new List<Workspace> (); | |
if (all_windows) { | |
- foreach (var workspace in screen.get_workspaces ()) | |
+ foreach (var workspace in display.get_workspace_manager ().get_workspaces ()) | |
workspaces.append (workspace); | |
} else { | |
- workspaces.append (screen.get_active_workspace ()); | |
+ workspaces.append (display.get_workspace_manager ().get_active_workspace ()); | |
} | |
foreach (var workspace in workspaces) { | |
@@ -161,10 +161,10 @@ namespace Gala | |
workspace.window_removed.connect (remove_window); | |
} | |
- screen.window_left_monitor.connect (window_left_monitor); | |
+ display.window_left_monitor.connect (window_left_monitor); | |
// sort windows by stacking order | |
- var windows = screen.get_display ().sort_windows_by_stacking (used_windows); | |
+ var windows = display.sort_windows_by_stacking (used_windows); | |
grab_key_focus (); | |
@@ -173,8 +173,8 @@ namespace Gala | |
visible = true; | |
- for (var i = 0; i < screen.get_n_monitors (); i++) { | |
- var geometry = screen.get_monitor_geometry (i); | |
+ for (var i = 0; i < display.get_n_monitors (); i++) { | |
+ var geometry = display.get_monitor_geometry (i); | |
var container = new WindowCloneContainer (true); | |
container.padding_top = TOP_GAP; | |
@@ -211,10 +211,10 @@ namespace Gala | |
return (name != "expose-windows" && name != "expose-all-windows"); | |
} | |
- void restack_windows (Screen screen) | |
+ void restack_windows (Display display) | |
{ | |
foreach (var child in get_children ()) | |
- ((WindowCloneContainer) child).restack_windows (screen); | |
+ ((WindowCloneContainer) child).restack_windows (display); | |
} | |
void window_left_monitor (int num, Window window) | |
@@ -260,14 +260,14 @@ namespace Gala | |
void thumb_selected (Window window) | |
{ | |
- if (window.get_workspace () == screen.get_active_workspace ()) { | |
- window.activate (screen.get_display ().get_current_time ()); | |
+ if (window.get_workspace () == display.get_workspace_manager ().get_active_workspace ()) { | |
+ window.activate (display.get_current_time ()); | |
close (); | |
} else { | |
close (); | |
//wait for the animation to finish before switching | |
Timeout.add (400, () => { | |
- window.get_workspace ().activate_with_focus (window, screen.get_display ().get_current_time ()); | |
+ window.get_workspace ().activate_with_focus (window, display.get_current_time ()); | |
return false; | |
}); | |
} | |
@@ -285,7 +285,7 @@ namespace Gala | |
workspace.window_added.disconnect (add_window); | |
workspace.window_removed.disconnect (remove_window); | |
} | |
- screen.window_left_monitor.disconnect (window_left_monitor); | |
+ display.window_left_monitor.disconnect (window_left_monitor); | |
ready = false; | |
@@ -307,7 +307,7 @@ namespace Gala | |
ready = true; | |
visible = false; | |
- foreach (var window in screen.get_active_workspace ().list_windows ()) | |
+ foreach (var window in display.get_workspace_manager ().get_active_workspace ().list_windows ()) | |
if (window.showing_on_its_workspace ()) | |
((Actor) window.get_compositor_private ()).show (); | |
diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala | |
index 433a7d0..0c46caa 100644 | |
--- a/src/Widgets/WindowSwitcher.vala | |
+++ b/src/Widgets/WindowSwitcher.vala | |
@@ -33,7 +33,7 @@ namespace Gala | |
Actor window_clones; | |
List<unowned Actor> clone_sort_order; | |
- WindowActor? dock_window; | |
+ Clutter.Actor? dock_window; | |
Actor dock; | |
Plank.Surface? dock_surface; | |
Plank.DockTheme dock_theme; | |
@@ -104,7 +104,7 @@ namespace Gala | |
add_child (window_clones); | |
add_child (dock); | |
- wm.get_screen ().monitors_changed.connect (update_actors); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (update_actors); | |
visible = false; | |
} | |
@@ -114,7 +114,7 @@ namespace Gala | |
if (monitor != null) | |
monitor.cancel (); | |
- wm.get_screen ().monitors_changed.disconnect (update_actors); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.disconnect (update_actors); | |
} | |
void load_dock_theme () | |
@@ -136,8 +136,8 @@ namespace Gala | |
{ | |
ui_scale_factor = InternalUtils.get_ui_scaling_factor (); | |
- var screen = wm.get_screen (); | |
- var geometry = screen.get_monitor_geometry (screen.get_primary_monitor ()); | |
+ var display = wm.get_display (); | |
+ var geometry = display.get_monitor_geometry (display.get_primary_monitor ()); | |
var layout = (BoxLayout) dock.layout_manager; | |
var position = dock_settings.Position; | |
@@ -190,7 +190,7 @@ namespace Gala | |
void update_background () | |
{ | |
int width = 0, height = 0; | |
- wm.get_screen ().get_size (out width, out height); | |
+ wm.get_display ().get_size (out width, out height); | |
background.set_size (width, height); | |
} | |
@@ -336,7 +336,7 @@ namespace Gala | |
// wait for the dimming to finish | |
Timeout.add (250, () => { | |
- close (wm.get_screen ().get_display ().get_current_time ()); | |
+ close (wm.get_display ().get_current_time ()); | |
return false; | |
}); | |
} else | |
@@ -353,7 +353,7 @@ namespace Gala | |
void icon_removed (Actor actor) | |
{ | |
if (dock.get_n_children () == 1) { | |
- close (wm.get_screen ().get_display ().get_current_time ()); | |
+ close (wm.get_display ().get_current_time ()); | |
return; | |
} | |
@@ -378,11 +378,11 @@ namespace Gala | |
public override void key_focus_out () | |
{ | |
- close (wm.get_screen ().get_display ().get_current_time ()); | |
+ close (wm.get_display ().get_current_time ()); | |
} | |
[CCode (instance_pos = -1)] | |
- public void handle_switch_windows (Display display, Screen screen, Window? window, | |
+ public void handle_switch_windows (Display display, Window? window, | |
Clutter.KeyEvent event, KeyBinding binding) | |
{ | |
var now = get_monotonic_time () / 1000; | |
@@ -397,7 +397,7 @@ namespace Gala | |
last_switch = now; | |
- var workspace = screen.get_active_workspace (); | |
+ var workspace = display.get_workspace_manager ().get_active_workspace (); | |
var binding_name = binding.get_name (); | |
var backward = binding_name.has_suffix ("-backward"); | |
@@ -443,13 +443,13 @@ namespace Gala | |
grab_key_focus (); | |
if ((get_current_modifiers () & modifier_mask) == 0) | |
- close (wm.get_screen ().get_display ().get_current_time ()); | |
+ close (wm.get_display ().get_current_time ()); | |
} | |
void close_cleanup () | |
{ | |
- var screen = wm.get_screen (); | |
- var workspace = screen.get_active_workspace (); | |
+ var display = wm.get_display (); | |
+ var workspace = display.get_workspace_manager ().get_active_workspace (); | |
dock.destroy_all_children (); | |
@@ -460,11 +460,12 @@ namespace Gala | |
window_clones.destroy_all_children (); | |
// need to go through all the windows because of hidden dialogs | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
- if (actor.is_destroyed ()) | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
if (window.get_workspace () == workspace | |
&& window.showing_on_its_workspace ()) | |
actor.show (); | |
@@ -625,8 +626,7 @@ namespace Gala | |
*/ | |
bool collect_windows (Workspace workspace) | |
{ | |
- var screen = workspace.get_screen (); | |
- var display = screen.get_display (); | |
+ var display = workspace.get_display (); | |
var windows = display.get_tab_list (TabList.NORMAL, workspace); | |
var current = display.get_tab_current (TabList.NORMAL, workspace); | |
@@ -639,7 +639,7 @@ namespace Gala | |
if (window.minimized) | |
window.unminimize (); | |
else | |
- Utils.bell (screen); | |
+ Utils.bell (display); | |
window.activate (display.get_current_time ()); | |
@@ -658,11 +658,12 @@ namespace Gala | |
current_window = (WindowIcon) dock.get_child_at_index (0); | |
// hide the others | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
- if (actor.is_destroyed ()) | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
var type = window.window_type; | |
if (type != WindowType.DOCK | |
diff --git a/src/Widgets/WorkspaceClone.vala b/src/Widgets/WorkspaceClone.vala | |
index 4a53e87..c478b6c 100644 | |
--- a/src/Widgets/WorkspaceClone.vala | |
+++ b/src/Widgets/WorkspaceClone.vala | |
@@ -25,15 +25,15 @@ namespace Gala | |
*/ | |
class FramedBackground : BackgroundManager | |
{ | |
- public FramedBackground (Screen screen) | |
+ public FramedBackground (Display display) | |
{ | |
- Object (screen: screen, monitor_index: screen.get_primary_monitor (), control_position: false); | |
+ Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false); | |
} | |
construct | |
{ | |
- var primary = screen.get_primary_monitor (); | |
- var monitor_geom = screen.get_monitor_geometry (primary); | |
+ var primary = display.get_primary_monitor (); | |
+ var monitor_geom = display.get_monitor_geometry (primary); | |
var effect = new ShadowEffect (40, 5); | |
effect.css_class = "workspace"; | |
@@ -137,10 +137,10 @@ namespace Gala | |
{ | |
opened = false; | |
- unowned Screen screen = workspace.get_screen (); | |
- var monitor_geometry = screen.get_monitor_geometry (screen.get_primary_monitor ()); | |
+ unowned Display display = workspace.get_display (); | |
+ var monitor_geometry = display.get_monitor_geometry (display.get_primary_monitor ()); | |
- background = new FramedBackground (workspace.get_screen ()); | |
+ background = new FramedBackground (workspace.get_display ()); | |
background.reactive = true; | |
background.button_press_event.connect (() => { | |
selected (true); | |
@@ -150,12 +150,12 @@ namespace Gala | |
window_container = new WindowCloneContainer (); | |
window_container.window_selected.connect ((w) => { window_selected (w); }); | |
window_container.set_size (monitor_geometry.width, monitor_geometry.height); | |
- screen.restacked.connect (window_container.restack_windows); | |
+ display.restacked.connect (window_container.restack_windows); | |
icon_group = new IconGroup (workspace); | |
icon_group.selected.connect (() => { | |
- if (workspace == screen.get_active_workspace ()) | |
- Utils.bell (screen); | |
+ if (workspace == display.get_workspace_manager ().get_active_workspace ()) | |
+ Utils.bell (display); | |
else | |
selected (false); | |
}); | |
@@ -181,8 +181,8 @@ namespace Gala | |
} | |
}); | |
- screen.window_entered_monitor.connect (window_entered_monitor); | |
- screen.window_left_monitor.connect (window_left_monitor); | |
+ display.window_entered_monitor.connect (window_entered_monitor); | |
+ display.window_left_monitor.connect (window_left_monitor); | |
workspace.window_added.connect (add_window); | |
workspace.window_removed.connect (remove_window); | |
@@ -194,7 +194,7 @@ namespace Gala | |
foreach (var window in windows) { | |
if (window.window_type == WindowType.NORMAL | |
&& !window.on_all_workspaces | |
- && window.get_monitor () == screen.get_primary_monitor ()) { | |
+ && window.get_monitor () == display.get_primary_monitor ()) { | |
window_container.add_window (window); | |
icon_group.add_window (window, true); | |
} | |
@@ -206,12 +206,12 @@ namespace Gala | |
~WorkspaceClone () | |
{ | |
- unowned Screen screen = workspace.get_screen (); | |
+ unowned Display display = workspace.get_display (); | |
- screen.restacked.disconnect (window_container.restack_windows); | |
+ display.restacked.disconnect (window_container.restack_windows); | |
- screen.window_entered_monitor.disconnect (window_entered_monitor); | |
- screen.window_left_monitor.disconnect (window_left_monitor); | |
+ display.window_entered_monitor.disconnect (window_entered_monitor); | |
+ display.window_left_monitor.disconnect (window_left_monitor); | |
workspace.window_added.disconnect (add_window); | |
workspace.window_removed.disconnect (remove_window); | |
@@ -230,7 +230,7 @@ namespace Gala | |
if (window.window_type != WindowType.NORMAL | |
|| window.get_workspace () != workspace | |
|| window.on_all_workspaces | |
- || window.get_monitor () != window.get_screen ().get_primary_monitor ()) | |
+ || window.get_monitor () != window.get_display ().get_primary_monitor ()) | |
return; | |
foreach (var child in window_container.get_children ()) | |
@@ -250,14 +250,14 @@ namespace Gala | |
icon_group.remove_window (window, opened); | |
} | |
- void window_entered_monitor (Screen screen, int monitor, Window window) | |
+ void window_entered_monitor (Display display, int monitor, Window window) | |
{ | |
add_window (window); | |
} | |
- void window_left_monitor (Screen screen, int monitor, Window window) | |
+ void window_left_monitor (Display display, int monitor, Window window) | |
{ | |
- if (monitor == screen.get_primary_monitor ()) | |
+ if (monitor == display.get_primary_monitor ()) | |
remove_window (window); | |
} | |
@@ -296,12 +296,11 @@ namespace Gala | |
opened = true; | |
- var screen = workspace.get_screen (); | |
- var display = screen.get_display (); | |
+ var display = workspace.get_display (); | |
var scale_factor = InternalUtils.get_ui_scaling_factor (); | |
- var monitor = screen.get_monitor_geometry (screen.get_primary_monitor ()); | |
+ var monitor = display.get_monitor_geometry (display.get_primary_monitor ()); | |
var scale = (float)(monitor.height - TOP_OFFSET * scale_factor - BOTTOM_OFFSET * scale_factor) / monitor.height; | |
var pivotY = TOP_OFFSET * scale_factor / (monitor.height - monitor.height * scale); | |
@@ -330,7 +329,7 @@ namespace Gala | |
icon_group.redraw (); | |
- window_container.open (screen.get_active_workspace () == workspace ? display.get_focus_window () : null); | |
+ window_container.open (display.get_workspace_manager ().get_active_workspace () == workspace ? display.get_focus_window () : null); | |
} | |
/** | |
diff --git a/src/WindowListener.vala b/src/WindowListener.vala | |
index 13e2d94..683ec73 100644 | |
--- a/src/WindowListener.vala | |
+++ b/src/WindowListener.vala | |
@@ -29,23 +29,24 @@ namespace Gala | |
{ | |
static WindowListener? instance = null; | |
- public static void init (Screen screen) | |
+ public static void init (Display display) | |
{ | |
if (instance != null) | |
return; | |
instance = new WindowListener (); | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
- if (actor.is_destroyed ()) | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
if (window.window_type == WindowType.NORMAL) | |
instance.monitor_window (window); | |
} | |
- screen.get_display ().window_created.connect ((window) => { | |
+ display.window_created.connect ((window) => { | |
if (window.window_type == WindowType.NORMAL) | |
instance.monitor_window (window); | |
}); | |
diff --git a/src/WindowManager.vala b/src/WindowManager.vala | |
index 1fdee9e..a2f531f 100644 | |
--- a/src/WindowManager.vala | |
+++ b/src/WindowManager.vala | |
@@ -87,11 +87,12 @@ namespace Gala | |
license = "GPLv3", description = "A nice elementary window manager"}; | |
Prefs.set_ignore_request_hide_titlebar (true); | |
- Prefs.override_preference_schema ("dynamic-workspaces", Config.SCHEMA + ".behavior"); | |
- Prefs.override_preference_schema ("attach-modal-dialogs", Config.SCHEMA + ".appearance"); | |
- Prefs.override_preference_schema ("button-layout", Config.SCHEMA + ".appearance"); | |
- Prefs.override_preference_schema ("edge-tiling", Config.SCHEMA + ".behavior"); | |
- Prefs.override_preference_schema ("enable-animations", Config.SCHEMA + ".animations"); | |
+ //TODO: Fix this ! | |
+ //Prefs.override_preference_schema ("dynamic-workspaces", Config.SCHEMA + ".behavior"); | |
+ //Prefs.override_preference_schema ("attach-modal-dialogs", Config.SCHEMA + ".appearance"); | |
+ //Prefs.override_preference_schema ("button-layout", Config.SCHEMA + ".appearance"); | |
+ //Prefs.override_preference_schema ("edge-tiling", Config.SCHEMA + ".behavior"); | |
+ //Prefs.override_preference_schema ("enable-animations", Config.SCHEMA + ".animations"); | |
} | |
public override void start () | |
@@ -101,7 +102,7 @@ namespace Gala | |
Bus.watch_name (BusType.SESSION, DAEMON_DBUS_NAME, BusNameWatcherFlags.NONE, daemon_appeared, lost_daemon); | |
#if HAS_MUTTER322 | |
- get_screen ().get_display ().gl_video_memory_purged.connect (() => { | |
+ get_display ().gl_video_memory_purged.connect (() => { | |
Meta.Background.refresh_all (); | |
SystemBackground.refresh (); | |
}); | |
@@ -131,13 +132,12 @@ namespace Gala | |
bool show_stage () | |
{ | |
- var screen = get_screen (); | |
- var display = screen.get_display (); | |
+ var display = get_display (); | |
DBus.init (this); | |
DBusAccelerator.init (this); | |
MediaFeedback.init (); | |
- WindowListener.init (screen); | |
+ WindowListener.init (display); | |
KeyboardManager.init (display); | |
// Due to a bug which enables access to the stage when using multiple monitors | |
@@ -152,7 +152,7 @@ namespace Gala | |
warning (e.message); | |
} | |
- stage = Compositor.get_stage_for_screen (screen) as Clutter.Stage; | |
+ stage = Compositor.get_stage_for_display (display) as Clutter.Stage; | |
var color = BackgroundSettings.get_default ().primary_color; | |
stage.background_color = Clutter.Color.from_string (color); | |
@@ -169,7 +169,7 @@ namespace Gala | |
* +-- top window group | |
*/ | |
- var system_background = new SystemBackground (screen); | |
+ var system_background = new SystemBackground (display); | |
system_background.add_constraint (new Clutter.BindConstraint (stage, | |
Clutter.BindCoordinate.ALL, 0)); | |
stage.insert_child_below (system_background, null); | |
@@ -178,15 +178,15 @@ namespace Gala | |
ui_group.reactive = true; | |
stage.add_child (ui_group); | |
- window_group = Compositor.get_window_group_for_screen (screen); | |
+ window_group = Compositor.get_window_group_for_display (display); | |
stage.remove_child (window_group); | |
ui_group.add_child (window_group); | |
- background_group = new BackgroundContainer (screen); | |
+ background_group = new BackgroundContainer (display); | |
window_group.add_child (background_group); | |
window_group.set_child_below_sibling (background_group, null); | |
- top_window_group = Compositor.get_top_window_group_for_screen (screen); | |
+ top_window_group = Compositor.get_top_window_group_for_display (display); | |
stage.remove_child (top_window_group); | |
ui_group.add_child (top_window_group); | |
@@ -241,7 +241,7 @@ namespace Gala | |
/*hot corner, getting enum values from GraniteServicesSettings did not work, so we use GSettings directly*/ | |
configure_hotcorners (); | |
- screen.monitors_changed.connect (configure_hotcorners); | |
+ Meta.MonitorManager.get ().monitors_changed_internal.connect (configure_hotcorners); | |
BehaviorSettings.get_default ().schema.changed.connect (configure_hotcorners); | |
@@ -312,7 +312,7 @@ namespace Gala | |
void configure_hotcorners () | |
{ | |
- var geometry = get_screen ().get_monitor_geometry (get_screen ().get_primary_monitor ()); | |
+ var geometry = get_display ().get_monitor_geometry (get_display ().get_primary_monitor ()); | |
add_hotcorner (geometry.x, geometry.y, "hotcorner-topleft"); | |
add_hotcorner (geometry.x + geometry.width - 1, geometry.y, "hotcorner-topright"); | |
@@ -324,7 +324,7 @@ namespace Gala | |
void add_hotcorner (float x, float y, string key) | |
{ | |
- unowned Clutter.Actor? stage = Compositor.get_stage_for_screen (get_screen ()); | |
+ unowned Clutter.Actor? stage = Compositor.get_stage_for_display (get_display ()); | |
return_if_fail (stage != null); | |
var action = (ActionType) BehaviorSettings.get_default ().schema.get_enum (key); | |
@@ -359,24 +359,24 @@ namespace Gala | |
} | |
[CCode (instance_pos = -1)] | |
- void handle_cycle_workspaces (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+ void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, | |
Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
var direction = (binding.get_name () == "cycle-workspaces-next" ? 1 : -1); | |
- var index = screen.get_active_workspace_index () + direction; | |
+ var index = display.get_workspace_manager ().get_active_workspace_index () + direction; | |
int dynamic_offset = Prefs.get_dynamic_workspaces () ? 1 : 0; | |
if (index < 0) | |
- index = screen.get_n_workspaces () - 1 - dynamic_offset; | |
- else if (index > screen.get_n_workspaces () - 1 - dynamic_offset) | |
+ index = display.get_workspace_manager ().get_n_workspaces () - 1 - dynamic_offset; | |
+ else if (index > display.get_workspace_manager ().get_n_workspaces () - 1 - dynamic_offset) | |
index = 0; | |
- screen.get_workspace_by_index (index).activate (display.get_current_time ()); | |
+ display.get_workspace_manager ().get_workspace_by_index (index).activate (display.get_current_time ()); | |
} | |
[CCode (instance_pos = -1)] | |
- void handle_move_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+ void handle_move_to_workspace (Meta.Display display, Meta.Window? window, | |
Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
if (window == null) | |
@@ -387,20 +387,20 @@ namespace Gala | |
} | |
[CCode (instance_pos = -1)] | |
- void handle_move_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+ void handle_move_to_workspace_end (Meta.Display display, Meta.Window? window, | |
Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
if (window == null) | |
return; | |
- var index = (binding.get_name () == "move-to-workspace-first" ? 0 : screen.get_n_workspaces () - 1); | |
- var workspace = screen.get_workspace_by_index (index); | |
+ var index = (binding.get_name () == "move-to-workspace-first" ? 0 : display.get_workspace_manager ().get_n_workspaces () - 1); | |
+ var workspace = display.get_workspace_manager ().get_workspace_by_index (index); | |
window.change_workspace (workspace); | |
workspace.activate_with_focus (window, display.get_current_time ()); | |
} | |
[CCode (instance_pos = -1)] | |
- void handle_switch_to_workspace (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+ void handle_switch_to_workspace (Meta.Display display, Meta.Window? window, | |
Clutter.KeyEvent event, Meta.KeyBinding binding) | |
{ | |
var direction = (binding.get_name () == "switch-to-workspace-left" ? MotionDirection.LEFT : MotionDirection.RIGHT); | |
@@ -408,11 +408,11 @@ namespace Gala | |
} | |
[CCode (instance_pos = -1)] | |
- void handle_switch_to_workspace_end (Meta.Display display, Meta.Screen screen, Meta.Window? window, | |
+ void handle_switch_to_workspace_end (Meta.Display display, Meta.Window? window, | |
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 ()); | |
+ var index = (binding.get_name () == "switch-to-workspace-first" ? 0 : display.get_workspace_manager ().n_workspaces - 1); | |
+ display.get_workspace_manager ().get_workspace_by_index (index).activate (display.get_current_time ()); | |
} | |
/** | |
@@ -420,9 +420,8 @@ namespace Gala | |
*/ | |
public void switch_to_next_workspace (MotionDirection direction) | |
{ | |
- var screen = get_screen (); | |
- var display = screen.get_display (); | |
- var active_workspace = screen.get_active_workspace (); | |
+ var display = get_display (); | |
+ var active_workspace = display.get_workspace_manager ().get_active_workspace (); | |
var neighbor = active_workspace.get_neighbor (direction); | |
if (neighbor != active_workspace) { | |
@@ -453,12 +452,12 @@ namespace Gala | |
void update_input_area () | |
{ | |
- var screen = get_screen (); | |
+ var display = get_display (); | |
if (screensaver != null) { | |
try { | |
if (screensaver.get_active ()) { | |
- InternalUtils.set_input_area (screen, InputArea.NONE); | |
+ InternalUtils.set_input_area (display, InputArea.NONE); | |
return; | |
} | |
} catch (Error e) { | |
@@ -470,9 +469,9 @@ namespace Gala | |
} | |
if (is_modal ()) | |
- InternalUtils.set_input_area (screen, InputArea.FULLSCREEN); | |
+ InternalUtils.set_input_area (display, InputArea.FULLSCREEN); | |
else | |
- InternalUtils.set_input_area (screen, InputArea.DEFAULT); | |
+ InternalUtils.set_input_area (display, InputArea.DEFAULT); | |
} | |
void show_bottom_stack_window (Meta.Window bottom_window) | |
@@ -552,7 +551,7 @@ namespace Gala | |
{ | |
var list = new Gee.ArrayList<uint32> (); | |
- foreach (var workspace in get_screen ().get_workspaces ()) { | |
+ foreach (var workspace in get_display ().get_workspace_manager ().get_workspaces ()) { | |
foreach (var window in workspace.list_windows ()) | |
list.add ((uint32)window.get_xwindow ()); | |
} | |
@@ -568,15 +567,14 @@ namespace Gala | |
if (window == null) | |
return; | |
- var screen = get_screen (); | |
- var display = screen.get_display (); | |
+ var display = get_display (); | |
- var active = screen.get_active_workspace (); | |
+ var active = display.get_workspace_manager ().get_active_workspace (); | |
var next = active.get_neighbor (direction); | |
//dont allow empty workspaces to be created by moving, if we have dynamic workspaces | |
- if (Prefs.get_dynamic_workspaces () && Utils.get_n_windows (active) == 1 && next.index () == screen.n_workspaces - 1) { | |
- Utils.bell (screen); | |
+ if (Prefs.get_dynamic_workspaces () && Utils.get_n_windows (active) == 1 && next.index () == display.get_workspace_manager ().n_workspaces - 1) { | |
+ Utils.bell (display); | |
return; | |
} | |
@@ -601,13 +599,13 @@ namespace Gala | |
if (modal_stack.size >= 2) | |
return proxy; | |
- var screen = get_screen (); | |
- var time = screen.get_display ().get_current_time (); | |
+ var display = get_display (); | |
+ var time = display.get_current_time (); | |
update_input_area (); | |
begin_modal (0, time); | |
- Meta.Util.disable_unredirect_for_screen (screen); | |
+ Meta.Compositor.disable_unredirect_for_display (display); | |
return proxy; | |
} | |
@@ -627,10 +625,10 @@ namespace Gala | |
update_input_area (); | |
- var screen = get_screen (); | |
- end_modal (screen.get_display ().get_current_time ()); | |
+ var display = get_display (); | |
+ end_modal (display.get_current_time ()); | |
- Meta.Util.enable_unredirect_for_screen (screen); | |
+ Meta.Compositor.enable_unredirect_for_display (display); | |
} | |
/** | |
@@ -672,8 +670,7 @@ namespace Gala | |
*/ | |
public void perform_action (ActionType type) | |
{ | |
- var screen = get_screen (); | |
- var display = screen.get_display (); | |
+ var display = get_display (); | |
var current = display.get_focus_window (); | |
switch (type) { | |
@@ -800,7 +797,7 @@ namespace Gala | |
} | |
break; | |
case ActionType.SWITCH_TO_WORKSPACE_LAST: | |
- var workspace = screen.get_workspace_by_index (screen.get_n_workspaces () - 1); | |
+ var workspace = display.get_workspace_manager ().get_workspace_by_index (display.get_workspace_manager ().get_n_workspaces () - 1); | |
workspace.activate (display.get_current_time ()); | |
break; | |
default: | |
@@ -927,8 +924,8 @@ namespace Gala | |
if (!Prefs.get_dynamic_workspaces ()) | |
return; | |
- unowned Meta.Screen screen = get_screen (); | |
- var time = screen.get_display ().get_current_time (); | |
+ unowned Meta.Display display = get_display (); | |
+ var time = display.get_current_time (); | |
unowned Meta.Workspace win_ws = window.get_workspace (); | |
if (which_change == Meta.SizeChange.FULLSCREEN) { | |
@@ -940,7 +937,7 @@ namespace Gala | |
var new_ws_index = old_ws_index + 1; | |
InternalUtils.insert_workspace_with_window (new_ws_index, window); | |
- var new_ws_obj = screen.get_workspace_by_index (new_ws_index); | |
+ var new_ws_obj = display.get_workspace_manager ().get_workspace_by_index (new_ws_index); | |
window.change_workspace (new_ws_obj); | |
new_ws_obj.activate_with_focus (window, time); | |
@@ -949,8 +946,8 @@ namespace Gala | |
var old_ws_index = ws_assoc.get (window); | |
var new_ws_index = win_ws.index (); | |
- if (new_ws_index != old_ws_index && old_ws_index < screen.get_n_workspaces ()) { | |
- var old_ws_obj = screen.get_workspace_by_index (old_ws_index); | |
+ if (new_ws_index != old_ws_index && old_ws_index < display.get_workspace_manager ().get_n_workspaces ()) { | |
+ var old_ws_obj = display.get_workspace_manager ().get_workspace_by_index (old_ws_index); | |
window.change_workspace (old_ws_obj); | |
old_ws_obj.activate_with_focus (window, time); | |
} | |
@@ -1013,7 +1010,7 @@ namespace Gala | |
minimizing.add (actor); | |
int width, height; | |
- get_screen ().get_size (out width, out height); | |
+ get_display ().get_size (out width, out height); | |
Rectangle icon = {}; | |
if (actor.get_meta_window ().get_icon_geometry (out icon)) { | |
@@ -1564,18 +1561,18 @@ namespace Gala | |
return; | |
} | |
- float screen_width, screen_height; | |
- var screen = get_screen (); | |
- var primary = screen.get_primary_monitor (); | |
+ float display_width, display_height; | |
+ var display = get_display (); | |
+ var primary = display.get_primary_monitor (); | |
var move_primary_only = InternalUtils.workspaces_only_on_primary (); | |
- var monitor_geom = screen.get_monitor_geometry (primary); | |
+ var monitor_geom = display.get_monitor_geometry (primary); | |
var clone_offset_x = move_primary_only ? monitor_geom.x : 0.0f; | |
var clone_offset_y = move_primary_only ? monitor_geom.y : 0.0f; | |
- screen.get_size (out screen_width, out screen_height); | |
+ display.get_size (out display_width, out display_height); | |
- unowned Meta.Workspace workspace_from = screen.get_workspace_by_index (from); | |
- unowned Meta.Workspace workspace_to = screen.get_workspace_by_index (to); | |
+ unowned Meta.Workspace workspace_from = display.get_workspace_manager ().get_workspace_by_index (from); | |
+ unowned Meta.Workspace workspace_to = display.get_workspace_manager ().get_workspace_by_index (to); | |
var main_container = new Clutter.Actor (); | |
var static_windows = new Clutter.Actor (); | |
@@ -1630,11 +1627,12 @@ namespace Gala | |
var docks = new List<WindowActor> (); | |
// collect all windows and put them in the appropriate containers | |
- foreach (unowned Meta.WindowActor actor in Meta.Compositor.get_window_actors (screen)) { | |
- if (actor.is_destroyed ()) | |
+ foreach (unowned Clutter.Actor actor in Meta.Compositor.get_window_actors (display)) { | |
+ unowned Meta.WindowActor window_actor = (Meta.WindowActor) actor; | |
+ if (window_actor.is_destroyed ()) | |
continue; | |
- unowned Meta.Window window = actor.get_meta_window (); | |
+ unowned Meta.Window window = window_actor.get_meta_window (); | |
if (!window.showing_on_its_workspace () || | |
(move_primary_only && window.get_monitor () != primary) || | |
@@ -1645,11 +1643,11 @@ namespace Gala | |
// only collect docks here that need to be displayed on both workspaces | |
// all other windows will be collected below | |
if (window.window_type == WindowType.DOCK) { | |
- docks.prepend (actor); | |
+ docks.prepend (window_actor); | |
} else { | |
// windows that are on all workspaces will be faded out and back in | |
- windows.prepend (actor); | |
- parents.prepend (actor.get_parent ()); | |
+ windows.prepend (window_actor); | |
+ parents.prepend (window_actor.get_parent ()); | |
clutter_actor_reparent (actor, static_windows); | |
actor.set_translation (-clone_offset_x, -clone_offset_y, 0); | |
@@ -1709,10 +1707,10 @@ namespace Gala | |
main_container.clip_to_allocation = true; | |
main_container.x = move_primary_only ? monitor_geom.x : 0.0f; | |
main_container.y = move_primary_only ? monitor_geom.y : 0.0f; | |
- main_container.width = move_primary_only ? monitor_geom.width : screen_width; | |
- main_container.height = move_primary_only ? monitor_geom.height : screen_height; | |
+ main_container.width = move_primary_only ? monitor_geom.width : display_width; | |
+ main_container.height = move_primary_only ? monitor_geom.height : display_height; | |
- var x2 = move_primary_only ? monitor_geom.width : screen_width; | |
+ var x2 = move_primary_only ? monitor_geom.width : display_width; | |
if (direction == MotionDirection.RIGHT) | |
x2 = -x2; | |
@@ -1729,8 +1727,8 @@ namespace Gala | |
} | |
in_group.clip_to_allocation = out_group.clip_to_allocation = true; | |
- in_group.width = out_group.width = move_primary_only ? monitor_geom.width : screen_width; | |
- in_group.height = out_group.height = move_primary_only ? monitor_geom.height : screen_height; | |
+ in_group.width = out_group.width = move_primary_only ? monitor_geom.width : display_width; | |
+ in_group.height = out_group.height = move_primary_only ? monitor_geom.height : display_height; | |
var animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC; | |
@@ -1764,8 +1762,8 @@ namespace Gala | |
if (windows == null || parents == null) | |
return; | |
- var screen = get_screen (); | |
- var active_workspace = screen.get_active_workspace (); | |
+ var display = get_display (); | |
+ var active_workspace = display.get_workspace_manager ().get_active_workspace (); | |
for (var i = 0; i < windows.length (); i++) { | |
var actor = windows.nth_data (i); | |
diff --git a/src/WorkspaceManager.vala b/src/WorkspaceManager.vala | |
index 08e0769..a80b83f 100644 | |
--- a/src/WorkspaceManager.vala | |
+++ b/src/WorkspaceManager.vala | |
@@ -47,27 +47,28 @@ namespace Gala | |
construct | |
{ | |
- unowned Screen screen = wm.get_screen (); | |
+ unowned Display display = wm.get_display (); | |
+ unowned Meta.WorkspaceManager workspace_manager = display.get_workspace_manager(); | |
workspaces_marked_removed = new Gee.LinkedList<Workspace> (); | |
if (Prefs.get_dynamic_workspaces ()) | |
- screen.override_workspace_layout (ScreenCorner.TOPLEFT, false, 1, -1); | |
+ workspace_manager.override_workspace_layout (DisplayCorner.TOPLEFT, false, 1, -1); | |
- for (var i = 0; i < screen.get_n_workspaces (); i++) | |
- workspace_added (screen, i); | |
+ for (var i = 0; i < workspace_manager.get_n_workspaces (); i++) | |
+ workspace_added (workspace_manager, i); | |
Prefs.add_listener (prefs_listener); | |
- screen.workspace_switched.connect_after (workspace_switched); | |
- screen.workspace_added.connect (workspace_added); | |
- screen.workspace_removed.connect_after (workspace_removed); | |
- screen.window_entered_monitor.connect (window_entered_monitor); | |
- screen.window_left_monitor.connect (window_left_monitor); | |
+ workspace_manager.workspace_switched.connect_after (workspace_switched); | |
+ workspace_manager.workspace_added.connect (workspace_added); | |
+ workspace_manager.workspace_removed.connect_after (workspace_removed); | |
+ display.window_entered_monitor.connect (window_entered_monitor); | |
+ display.window_left_monitor.connect (window_left_monitor); | |
// make sure the last workspace has no windows on it | |
if (Prefs.get_dynamic_workspaces () | |
- && Utils.get_n_windows (screen.get_workspace_by_index (screen.get_n_workspaces () - 1)) > 0) | |
+ && Utils.get_n_windows (workspace_manager.get_workspace_by_index (workspace_manager.get_n_workspaces () - 1)) > 0) | |
append_workspace (); | |
// There are some empty workspace at startup | |
@@ -76,20 +77,21 @@ namespace Gala | |
~WorkspaceManager () | |
{ | |
- unowned Screen screen = wm.get_screen (); | |
+ unowned Display display = wm.get_display (); | |
+ unowned Meta.WorkspaceManager workspace_manager = display.get_workspace_manager(); | |
Prefs.remove_listener (prefs_listener); | |
- screen.workspace_added.disconnect (workspace_added); | |
- screen.workspace_switched.disconnect (workspace_switched); | |
- screen.workspace_removed.disconnect (workspace_removed); | |
- screen.window_entered_monitor.disconnect (window_entered_monitor); | |
- screen.window_left_monitor.disconnect (window_left_monitor); | |
+ workspace_manager.workspace_added.disconnect (workspace_added); | |
+ workspace_manager.workspace_switched.disconnect (workspace_switched); | |
+ workspace_manager.workspace_removed.disconnect (workspace_removed); | |
+ display.window_entered_monitor.disconnect (window_entered_monitor); | |
+ display.window_left_monitor.disconnect (window_left_monitor); | |
} | |
- void workspace_added (Screen screen, int index) | |
+ void workspace_added (Meta.WorkspaceManager manager, int index) | |
{ | |
- var workspace = screen.get_workspace_by_index (index); | |
+ var workspace = manager.get_workspace_by_index (index); | |
if (workspace == null) | |
return; | |
@@ -97,9 +99,9 @@ namespace Gala | |
workspace.window_removed.connect (window_removed); | |
} | |
- void workspace_removed (Screen screen, int index) | |
+ void workspace_removed (Meta.WorkspaceManager manager, int index) | |
{ | |
- unowned List<Workspace> existing_workspaces = screen.get_workspaces (); | |
+ unowned List<Workspace> existing_workspaces = manager.get_workspaces (); | |
var it = workspaces_marked_removed.iterator (); | |
while (it.next ()) { | |
@@ -108,15 +110,15 @@ namespace Gala | |
} | |
} | |
- void workspace_switched (Screen screen, int from, int to, MotionDirection direction) | |
+ void workspace_switched (Meta.WorkspaceManager manager, int from, int to, MotionDirection direction) | |
{ | |
if (!Prefs.get_dynamic_workspaces ()) | |
return; | |
// remove empty workspaces after we switched away from them unless it's the last one | |
- var prev_workspace = screen.get_workspace_by_index (from); | |
+ var prev_workspace = manager.get_workspace_by_index (from); | |
if (Utils.get_n_windows (prev_workspace) < 1 | |
- && from != screen.get_n_workspaces () - 1) { | |
+ && from != manager.get_n_workspaces () - 1) { | |
remove_workspace (prev_workspace); | |
} | |
} | |
@@ -127,12 +129,12 @@ namespace Gala | |
|| window.on_all_workspaces) | |
return; | |
- unowned Screen screen = workspace.get_screen (); | |
+ unowned Display display = workspace.get_display (); | |
if ((window.window_type == WindowType.NORMAL | |
|| window.window_type == WindowType.DIALOG | |
|| window.window_type == WindowType.MODAL_DIALOG) | |
- && workspace.index () == screen.get_n_workspaces () - 1) | |
+ && workspace.index () == display.get_workspace_manager ().get_n_workspaces () - 1) | |
append_workspace (); | |
} | |
@@ -141,60 +143,60 @@ namespace Gala | |
if (workspace == null || !Prefs.get_dynamic_workspaces () || window.on_all_workspaces) | |
return; | |
- unowned Screen screen = workspace.get_screen (); | |
+ unowned Display display = workspace.get_display (); | |
if (window.window_type != WindowType.NORMAL | |
&& window.window_type != WindowType.DIALOG | |
&& window.window_type != WindowType.MODAL_DIALOG) | |
return; | |
- var index = screen.get_workspaces ().index (workspace); | |
+ var index = display.get_workspace_manager ().get_workspaces ().index (workspace); | |
// has already been removed | |
if (index < 0) | |
return; | |
- var is_active_workspace = workspace == screen.get_active_workspace (); | |
+ var is_active_workspace = workspace == display.get_workspace_manager ().get_active_workspace (); | |
// remove it right away if it was the active workspace and it's not the very last | |
// or we are in modal-mode | |
if ((!is_active_workspace || wm.is_modal ()) | |
&& remove_freeze_count < 1 | |
&& Utils.get_n_windows (workspace) < 1 | |
- && index != screen.get_n_workspaces () - 1) { | |
+ && index != display.get_workspace_manager ().get_n_workspaces () - 1) { | |
remove_workspace (workspace); | |
} | |
} | |
- void window_entered_monitor (Screen screen, int monitor, Window window) | |
+ void window_entered_monitor (Display display, int monitor, Window window) | |
{ | |
if (InternalUtils.workspaces_only_on_primary () | |
- && monitor == screen.get_primary_monitor ()) | |
+ && monitor == display.get_primary_monitor ()) | |
window_added (window.get_workspace (), window); | |
} | |
- void window_left_monitor (Screen screen, int monitor, Window window) | |
+ void window_left_monitor (Display display, int monitor, Window window) | |
{ | |
if (InternalUtils.workspaces_only_on_primary () | |
- && monitor == screen.get_primary_monitor ()) | |
+ && monitor == display.get_primary_monitor ()) | |
window_removed (window.get_workspace (), window); | |
} | |
void prefs_listener (Meta.Preference pref) | |
{ | |
- unowned Screen screen = wm.get_screen (); | |
+ unowned Display display = wm.get_display (); | |
if (pref == Preference.DYNAMIC_WORKSPACES && Prefs.get_dynamic_workspaces ()) { | |
// if the last workspace has a window, we need to append a new workspace | |
- if (Utils.get_n_windows (screen.get_workspace_by_index (screen.get_n_workspaces () - 1)) > 0) | |
+ if (Utils.get_n_windows (display.get_workspace_manager ().get_workspace_by_index (display.get_workspace_manager ().get_n_workspaces () - 1)) > 0) | |
append_workspace (); | |
} | |
} | |
void append_workspace () | |
{ | |
- unowned Screen screen = wm.get_screen (); | |
+ unowned Display display = wm.get_display (); | |
- screen.append_new_workspace (false, screen.get_display ().get_current_time ()); | |
+ display.get_workspace_manager ().append_new_workspace (false, display.get_current_time ()); | |
} | |
/** | |
@@ -204,11 +206,11 @@ namespace Gala | |
*/ | |
void remove_workspace (Workspace workspace) | |
{ | |
- unowned Screen screen = workspace.get_screen (); | |
+ unowned Display display = workspace.get_display (); | |
- var time = screen.get_display ().get_current_time (); | |
+ var time = display.get_current_time (); | |
- if (workspace == screen.get_active_workspace ()) { | |
+ if (workspace == display.get_workspace_manager ().get_active_workspace ()) { | |
Workspace? next = null; | |
next = workspace.get_neighbor (MotionDirection.LEFT); | |
@@ -230,7 +232,7 @@ namespace Gala | |
workspaces_marked_removed.add (workspace); | |
- screen.remove_workspace (workspace, time); | |
+ display.get_workspace_manager ().remove_workspace (workspace, time); | |
} | |
/** | |
@@ -261,10 +263,10 @@ namespace Gala | |
if (!Prefs.get_dynamic_workspaces ()) | |
return; | |
- var screen = wm.get_screen (); | |
- var last_index = screen.get_n_workspaces () - 1; | |
+ var display = wm.get_display (); | |
+ var last_index = display.get_workspace_manager ().get_n_workspaces () - 1; | |
- foreach (var workspace in screen.get_workspaces ()) { | |
+ foreach (var workspace in display.get_workspace_manager ().get_workspaces ()) { | |
if (Utils.get_n_windows (workspace) < 1 | |
&& workspace.index () != last_index) { | |
remove_workspace (workspace); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment