Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/pip/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
var rect = Graphene.Rect.alloc ();
rect.init (point_x, point_y, width, height);

var popup_window = new PopupWindow (wm, active);
var popup_window = new PopupWindow (wm.get_display (), active);
popup_window.set_container_clip (rect);
popup_window.show.connect (on_popup_window_show);
popup_window.hide.connect (on_popup_window_hide);
Expand All @@ -114,7 +114,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
private void select_window_at (int x, int y) {
var selected = get_window_actor_at (x, y);
if (selected != null) {
var popup_window = new PopupWindow (wm, selected);
var popup_window = new PopupWindow (wm.get_display (), selected);
popup_window.show.connect (on_popup_window_show);
popup_window.hide.connect (on_popup_window_hide);
add_window (popup_window);
Expand Down
23 changes: 10 additions & 13 deletions plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {

public signal void closed ();

public Gala.WindowManager wm { get; construct; }
public Meta.Display display { get; construct; }
public Meta.WindowActor window_actor { get; construct; }

private Clutter.Clone clone; // clone itself
Expand Down Expand Up @@ -52,12 +52,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
|| window_type == Meta.WindowType.MODAL_DIALOG;
}

public PopupWindow (Gala.WindowManager wm, Meta.WindowActor window_actor) {
Object (wm: wm, window_actor: window_actor);
public PopupWindow (Meta.Display display, Meta.WindowActor window_actor) {
Object (display: display, window_actor: window_actor);
}

construct {
unowned var display = wm.get_display ();
var scale = display.get_monitor_scale (display.get_current_monitor ());

button_size = Gala.Utils.scale_to_int (36, scale);
Expand Down Expand Up @@ -133,7 +132,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
window.unmanaged.connect (on_close_click_clicked);
window.notify["appears-focused"].connect (update_window_focus);

unowned var workspace_manager = wm.get_display ().get_workspace_manager ();
unowned var workspace_manager = display.get_workspace_manager ();
workspace_manager.active_workspace_changed.connect (update_window_focus);
}

Expand Down Expand Up @@ -215,15 +214,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private Clutter.Actor on_move_begin () {
wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);
display.set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

private void on_move_end () {
reactive = true;
update_screen_position ();
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
display.set_cursor (Meta.Cursor.DEFAULT);
}

#if HAS_MUTTER45
Expand All @@ -245,7 +244,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
grab = resize_button.get_stage ().grab (resize_button);
resize_button.event.connect (on_resize_event);

wm.get_display ().set_cursor (Meta.Cursor.SE_RESIZE);
display.set_cursor (Meta.Cursor.SE_RESIZE);

return Clutter.EVENT_PROPAGATE;
}
Expand Down Expand Up @@ -306,7 +305,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {

update_screen_position ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
display.set_cursor (Meta.Cursor.DEFAULT);
}

private void on_allocation_changed () {
Expand All @@ -329,14 +328,14 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private void update_window_focus () {
unowned Meta.Window focus_window = wm.get_display ().get_focus_window ();
unowned Meta.Window focus_window = 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;
return;
}

unowned var workspace_manager = wm.get_display ().get_workspace_manager ();
unowned var workspace_manager = display.get_workspace_manager ();
unowned var active_workspace = workspace_manager.get_active_workspace ();
unowned var window = window_actor.get_meta_window ();

Expand Down Expand Up @@ -520,7 +519,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private bool coord_is_in_other_monitor (float coord, Clutter.Orientation axis) {
var display = wm.get_display ();
int n_monitors = display.get_n_monitors ();

if (n_monitors == 1) {
Expand Down Expand Up @@ -553,7 +551,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
#else
private void get_current_monitor_rect (out Meta.Rectangle rect) {
#endif
var display = wm.get_display ();
rect = display.get_monitor_geometry (display.get_current_monitor ());
}

Expand Down
14 changes: 7 additions & 7 deletions src/Background/BackgroundContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Gala {
public signal void changed ();
public signal void show_background_menu (int x, int y);

public WindowManager wm { get; construct; }
public Meta.Display display { get; construct; }

public BackgroundContainer (WindowManager wm) {
Object (wm: wm);
public BackgroundContainer (Meta.Display display) {
Object (display: display);
}

construct {
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (update);

reactive = true;
Expand All @@ -44,7 +44,7 @@ namespace Gala {
}

~BackgroundContainer () {
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.disconnect (update);
}

Expand All @@ -59,8 +59,8 @@ namespace Gala {

destroy_all_children ();

for (var i = 0; i < wm.get_display ().get_n_monitors (); i++) {
var background = new BackgroundManager (wm, i);
for (var i = 0; i < display.get_n_monitors (); i++) {
var background = new BackgroundManager (display, i);

add_child (background);

Expand Down
14 changes: 6 additions & 8 deletions src/Background/BackgroundManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag

public signal void changed ();

public WindowManager wm { get; construct; }
public Meta.Display display { get; construct; }
public int monitor_index { get; construct; }
public bool control_position { get; construct; }
public bool rounded_corners { get; construct; }
Expand All @@ -24,12 +24,12 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
private Meta.BackgroundActor? background_actor;
private Meta.BackgroundActor? new_background_actor = null;

public BackgroundManager (WindowManager wm, int monitor_index, bool control_position = true, bool rounded_corners = true) {
Object (wm: wm, monitor_index: monitor_index, control_position: control_position, rounded_corners: rounded_corners);
public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true, bool rounded_corners = true) {
Object (display: display, monitor_index: monitor_index, control_position: control_position, rounded_corners: rounded_corners);
}

construct {
background_source = BackgroundCache.get_default ().get_background_source (wm.get_display ());
background_source = BackgroundCache.get_default ().get_background_source (display);
update_background_actor (false);

destroy.connect (on_destroy);
Expand Down Expand Up @@ -93,7 +93,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag

if (background.is_loaded) {
if (rounded_corners) {
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
new_content.rounded_clip_radius = Utils.scale_to_int (6, display.get_monitor_scale (monitor_index));
}

swap_background_actor (animate);
Expand All @@ -106,7 +106,7 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
background.set_data<ulong> ("background-loaded-handler", 0);

if (rounded_corners) {
new_content.rounded_clip_radius = Utils.scale_to_int (6, wm.get_display ().get_monitor_scale (monitor_index));
new_content.rounded_clip_radius = Utils.scale_to_int (6, display.get_monitor_scale (monitor_index));
}

swap_background_actor (animate);
Expand All @@ -121,8 +121,6 @@ public class Gala.BackgroundManager : Meta.BackgroundGroup, Gala.BackgroundManag
}

private Meta.BackgroundActor create_background_actor () {
unowned var display = wm.get_display ();

var background = background_source.get_background (monitor_index);
var background_actor = new Meta.BackgroundActor (display, monitor_index);

Expand Down
2 changes: 1 addition & 1 deletion src/DBus.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Gala.DBus {
Bus.own_name (BusType.SESSION, "org.gnome.Shell", BusNameOwnerFlags.NONE,
(connection) => {
try {
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm));
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm.get_display ()));
connection.register_object ("/org/gnome/Shell/Screenshot", ScreenshotManager.init (wm));
} catch (Error e) { warning (e.message); }
},
Expand Down
19 changes: 10 additions & 9 deletions src/DBusAccelerator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,23 @@ namespace Gala {
private static DBusAccelerator? instance;

[DBus (visible = false)]
public static unowned DBusAccelerator init (WindowManager wm) {
if (instance == null)
instance = new DBusAccelerator (wm);
public static unowned DBusAccelerator init (Meta.Display display) {
if (instance == null) {
instance = new DBusAccelerator (display);
}

return instance;
}

public signal void accelerator_activated (uint action, GLib.HashTable<string, Variant> parameters);

private WindowManager wm;
private Meta.Display display;
private GLib.HashTable<unowned string, GrabbedAccelerator> grabbed_accelerators;

private DBusAccelerator (WindowManager _wm) {
wm = _wm;
private DBusAccelerator (Meta.Display _display) {
display = _display;
grabbed_accelerators = new HashTable<unowned string, GrabbedAccelerator> (str_hash, str_equal);
wm.get_display ().accelerator_activated.connect (on_accelerator_activated);
display.accelerator_activated.connect (on_accelerator_activated);
}

private void on_accelerator_activated (uint action, Clutter.InputDevice device, uint timestamp) {
Expand All @@ -115,7 +116,7 @@ namespace Gala {
return found_accel.action;
}

uint action = wm.get_display ().grab_accelerator (accelerator, grab_flags);
uint action = display.grab_accelerator (accelerator, grab_flags);
if (action != Meta.KeyBindingFlags.NONE) {
var accel = new GrabbedAccelerator ();
accel.action = action;
Expand All @@ -141,7 +142,7 @@ namespace Gala {
public bool ungrab_accelerator (uint action) throws GLib.DBusError, GLib.IOError {
foreach (unowned GrabbedAccelerator accel in grabbed_accelerators.get_values ()) {
if (accel.action == action) {
bool ret = wm.get_display ().ungrab_accelerator (action);
bool ret = display.ungrab_accelerator (action);
grabbed_accelerators.remove (accel.name);
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public class Gala.ShellClientsManager : Object {
}

public void make_centered (Meta.Window window) requires (!is_itself_positioned (window)) {
positioned_windows[window] = new WindowPositioner (wm, window, CENTER);
positioned_windows[window] = new WindowPositioner (wm.get_display (), window, CENTER);

// connect_after so we make sure that any queued move is unqueued
window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window));
Expand Down
9 changes: 4 additions & 5 deletions src/ShellClients/WindowPositioner.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public class Gala.WindowPositioner : Object {
CENTER
}

public Meta.Display display { get; construct; }
public Meta.Window window { get; construct; }
public WindowManager wm { get; construct; }
public Position position { get; private set; }
public Variant? position_data { get; private set; }

public WindowPositioner (WindowManager wm, Meta.Window window, Position position, Variant? position_data = null) {
Object (wm: wm, window: window, position: position, position_data: position_data);
public WindowPositioner (Meta.Display display, Meta.Window window, Position position, Variant? position_data = null) {
Object (display: display, window: window, position: position, position_data: position_data);
}

construct {
Expand All @@ -26,7 +26,7 @@ public class Gala.WindowPositioner : Object {
window.position_changed.connect (position_window);
window.shown.connect (position_window);

unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (position_window);
monitor_manager.monitors_changed_internal.connect (position_window);
}
Expand All @@ -46,7 +46,6 @@ public class Gala.WindowPositioner : Object {

switch (position) {
case CENTER:
unowned var display = wm.get_display ();
var monitor_geom = display.get_monitor_geometry (display.get_primary_monitor ());
var window_rect = window.get_frame_rect ();

Expand Down
7 changes: 3 additions & 4 deletions src/Widgets/DwellClickTimer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ namespace Gala {
private GLib.Settings interface_settings;
private Cairo.ImageSurface surface;

public weak WindowManager wm { get; construct; }
public Meta.Display display { get; construct; }

public double angle { get; set; }

public DwellClickTimer (WindowManager wm) {
Object (wm: wm);
public DwellClickTimer (Meta.Display display) {
Object (display: display);
}

construct {
Expand All @@ -69,7 +69,6 @@ namespace Gala {
seat.set_pointer_a11y_dwell_click_type (Clutter.PointerA11yDwellClickType.PRIMARY);

seat.ptr_a11y_timeout_started.connect ((device, type, timeout) => {
unowned var display = wm.get_display ();
var scale = display.get_monitor_scale (display.get_current_monitor ());
update_cursor_size (scale);

Expand Down
14 changes: 7 additions & 7 deletions src/Widgets/IconGroup.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Gala {

private DragDropAction drag_action;

public WindowManager wm { get; construct; }
public Meta.Display display { get; construct; }
public Meta.Workspace workspace { get; construct; }
private float _scale_factor = 1.0f;
public float scale_factor {
Expand All @@ -55,8 +55,8 @@ namespace Gala {
private Clutter.Actor? prev_parent = null;
private Clutter.Actor icon_container;

public IconGroup (WindowManager wm, Meta.Workspace workspace, float scale) {
Object (wm: wm, workspace: workspace, scale_factor: scale);
public IconGroup (Meta.Display display, Meta.Workspace workspace, float scale) {
Object (display: display, workspace: workspace, scale_factor: scale);
}

construct {
Expand Down Expand Up @@ -143,7 +143,7 @@ namespace Gala {
* the group.
*/
public void add_window (Meta.Window window, bool no_redraw = false, bool temporary = false) {
var new_window = new WindowIconActor (wm, window);
var new_window = new WindowIconActor (window);
new_window.set_position (32, 32);
new_window.temporary = temporary;

Expand Down Expand Up @@ -415,7 +415,7 @@ namespace Gala {
// disable reactivity so that workspace thumbs can get events
reactive = false;

wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);
display.set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}
Expand All @@ -433,14 +433,14 @@ namespace Gala {
drag_canceled ();
}

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
display.set_cursor (Meta.Cursor.DEFAULT);
}

private void drag_canceled () {
get_parent ().remove_child (this);
restore_group ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
display.set_cursor (Meta.Cursor.DEFAULT);
}

private void restore_group () {
Expand Down
Loading