mirror of
https://github.com/elementary/gala.git
synced 2024-08-17 02:50:38 +03:00
WIP
This commit is contained in:
parent
b5b297e6b4
commit
85c40b8fb6
@ -181,5 +181,7 @@ namespace Gala {
|
||||
* @param direction The direction in which to switch
|
||||
*/
|
||||
public abstract void switch_to_next_workspace (Meta.MotionDirection direction, uint32 timestamp);
|
||||
|
||||
public abstract bool is_window_owned_by_daemon (Meta.Window window);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ public class Gala.DaemonManager : GLib.Object {
|
||||
|
||||
public Meta.Display display { get; construct; }
|
||||
|
||||
private Meta.WaylandClient daemon_client;
|
||||
private Meta.WaylandClient? daemon_client;
|
||||
private Subprocess? subprocess;
|
||||
private Daemon? daemon_proxy = null;
|
||||
|
||||
public DaemonManager (Meta.Display display) {
|
||||
@ -33,6 +34,7 @@ public class Gala.DaemonManager : GLib.Object {
|
||||
|
||||
display.window_created.connect ((window) => {
|
||||
if (daemon_client.owns_window (window)) {
|
||||
daemon_client.make_dock (window);
|
||||
window.shown.connect (handle_daemon_window);
|
||||
}
|
||||
});
|
||||
@ -41,6 +43,14 @@ public class Gala.DaemonManager : GLib.Object {
|
||||
}
|
||||
}
|
||||
|
||||
public bool is_window_owned_by_daemon(Meta.Window window) {
|
||||
if (Meta.Util.is_wayland_compositor ()) {
|
||||
return daemon_client.owns_window (window);
|
||||
}
|
||||
|
||||
return subprocess.get_identifier () == window.get_pid ().to_string ();
|
||||
}
|
||||
|
||||
private async void start_wayland () {
|
||||
var subprocess_launcher = new GLib.SubprocessLauncher (NONE);
|
||||
try {
|
||||
@ -67,7 +77,7 @@ public class Gala.DaemonManager : GLib.Object {
|
||||
|
||||
private async void start_x () {
|
||||
try {
|
||||
var subprocess = new Subprocess (NONE, "gala-daemon");
|
||||
subprocess = new Subprocess (NONE, "gala-daemon");
|
||||
yield subprocess.wait_async ();
|
||||
|
||||
//Restart the daemon if it crashes
|
||||
@ -96,8 +106,10 @@ public class Gala.DaemonManager : GLib.Object {
|
||||
|
||||
var index = int.parse (info[1]);
|
||||
|
||||
var monitor_geometry = display.get_monitor_geometry (index);
|
||||
window.move_frame (false, monitor_geometry.x + SPACING, monitor_geometry.y + SPACING);
|
||||
var workspace_manager = display.get_workspace_manager ();
|
||||
var work_area = workspace_manager.get_active_workspace ().get_work_area_for_monitor (index);
|
||||
|
||||
window.move_frame (false, work_area.x + SPACING, work_area.y + SPACING);
|
||||
window.make_above ();
|
||||
break;
|
||||
|
||||
|
@ -336,5 +336,15 @@ namespace Gala {
|
||||
return { 0, 0, (int) screen_width, (int) screen_height };
|
||||
}
|
||||
}
|
||||
|
||||
public static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent) {
|
||||
if (actor == new_parent)
|
||||
return;
|
||||
|
||||
actor.ref ();
|
||||
actor.get_parent ().remove_child (actor);
|
||||
new_parent.add_child (actor);
|
||||
actor.unref ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ namespace Gala {
|
||||
private IconGroupContainer icon_groups;
|
||||
private Clutter.Actor workspaces;
|
||||
private Clutter.Actor dock_clones;
|
||||
private Clutter.Actor daemon_clones;
|
||||
private Clutter.Actor primary_monitor_container;
|
||||
private Clutter.BrightnessContrastEffect brightness_effect;
|
||||
|
||||
@ -83,6 +84,8 @@ namespace Gala {
|
||||
|
||||
dock_clones = new Clutter.Actor ();
|
||||
|
||||
daemon_clones = new Clutter.Actor ();
|
||||
|
||||
brightness_effect = new Clutter.BrightnessContrastEffect ();
|
||||
update_brightness_effect ();
|
||||
|
||||
@ -100,6 +103,7 @@ namespace Gala {
|
||||
primary_monitor_container.add_child (workspaces);
|
||||
add_child (primary_monitor_container);
|
||||
add_child (dock_clones);
|
||||
add_child (daemon_clones);
|
||||
|
||||
unowned var manager = display.get_workspace_manager ();
|
||||
manager.workspace_added.connect (add_workspace);
|
||||
@ -820,9 +824,14 @@ namespace Gala {
|
||||
: actor.y + actor.height;
|
||||
|
||||
var clone = new SafeWindowClone (window, true);
|
||||
clone.set_position (initial_x, initial_y);
|
||||
dock_clones.add_child (clone);
|
||||
|
||||
clone.set_position (initial_x, initial_y);
|
||||
if (wm.is_window_owned_by_daemon (window)) {
|
||||
InternalUtils.clutter_actor_reparent (actor, daemon_clones);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
GestureTracker.OnUpdate on_animation_update = (percentage) => {
|
||||
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
|
||||
@ -851,10 +860,15 @@ namespace Gala {
|
||||
|
||||
private void hide_docks (bool with_gesture, bool is_cancel_animation) {
|
||||
foreach (unowned var child in dock_clones.get_children ()) {
|
||||
var dock = (Clutter.Clone) child;
|
||||
var dock = (SafeWindowClone) child;
|
||||
var initial_y = dock.y;
|
||||
var target_y = dock.source.y;
|
||||
|
||||
if (wm.is_window_owned_by_daemon (dock.window)) {
|
||||
InternalUtils.clutter_actor_reparent (dock, wm.window_group);
|
||||
continue;
|
||||
}
|
||||
|
||||
GestureTracker.OnUpdate on_animation_update = (percentage) => {
|
||||
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
|
||||
dock.y = y;
|
||||
|
@ -1079,6 +1079,10 @@ namespace Gala {
|
||||
}
|
||||
}
|
||||
|
||||
public bool is_window_owned_by_daemon (Meta.Window window) {
|
||||
return daemon_manager.is_window_owned_by_daemon (window);
|
||||
}
|
||||
|
||||
#if HAS_MUTTER45
|
||||
public override void show_tile_preview (Meta.Window window, Mtk.Rectangle tile_rect, int tile_monitor_number) {
|
||||
#else
|
||||
@ -1467,7 +1471,7 @@ namespace Gala {
|
||||
// Notifications are a special case and have to be always be handled
|
||||
// (also regardless of the animation setting)
|
||||
if (window.get_data (NOTIFICATION_DATA_KEY) || window.window_type == NOTIFICATION) {
|
||||
clutter_actor_reparent (actor, notification_group);
|
||||
InternalUtils.clutter_actor_reparent (actor, notification_group);
|
||||
notification_stack.show_notification (actor, enable_animations);
|
||||
|
||||
map_completed (actor);
|
||||
@ -1952,7 +1956,7 @@ namespace Gala {
|
||||
parents.prepend (moving_actor.get_parent ());
|
||||
|
||||
moving_actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (moving_actor, static_windows);
|
||||
InternalUtils.clutter_actor_reparent (moving_actor, static_windows);
|
||||
}
|
||||
|
||||
unowned var grabbed_window = window_grab_tracker.current_window;
|
||||
@ -1964,7 +1968,7 @@ namespace Gala {
|
||||
parents.prepend (moving_actor.get_parent ());
|
||||
|
||||
moving_actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (moving_actor, static_windows);
|
||||
InternalUtils.clutter_actor_reparent (moving_actor, static_windows);
|
||||
}
|
||||
|
||||
var to_has_fullscreened = false;
|
||||
@ -1995,7 +1999,7 @@ namespace Gala {
|
||||
windows.prepend (actor);
|
||||
parents.prepend (actor.get_parent ());
|
||||
|
||||
clutter_actor_reparent (actor, static_windows);
|
||||
InternalUtils.clutter_actor_reparent (actor, static_windows);
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
|
||||
// Don't fade docks they just stay where they are
|
||||
@ -2016,7 +2020,7 @@ namespace Gala {
|
||||
windows.append (actor);
|
||||
parents.append (actor.get_parent ());
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (actor, out_group);
|
||||
InternalUtils.clutter_actor_reparent (actor, out_group);
|
||||
|
||||
if (window.fullscreen)
|
||||
from_has_fullscreened = true;
|
||||
@ -2025,7 +2029,7 @@ namespace Gala {
|
||||
windows.append (actor);
|
||||
parents.append (actor.get_parent ());
|
||||
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
|
||||
clutter_actor_reparent (actor, in_group);
|
||||
InternalUtils.clutter_actor_reparent (actor, in_group);
|
||||
|
||||
if (window.fullscreen)
|
||||
to_has_fullscreened = true;
|
||||
@ -2101,7 +2105,7 @@ namespace Gala {
|
||||
switch_workspace_window_created_id = window_created.connect ((window) => {
|
||||
if (window.window_type == Meta.WindowType.NOTIFICATION) {
|
||||
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
|
||||
clutter_actor_reparent (actor, notification_group);
|
||||
InternalUtils.clutter_actor_reparent (actor, notification_group);
|
||||
notification_stack.show_notification (actor, enable_animations);
|
||||
}
|
||||
});
|
||||
@ -2218,13 +2222,13 @@ namespace Gala {
|
||||
|
||||
unowned Meta.WindowActor? window = actor as Meta.WindowActor;
|
||||
if (window == null) {
|
||||
clutter_actor_reparent (actor, parents.nth_data (i));
|
||||
InternalUtils.clutter_actor_reparent (actor, parents.nth_data (i));
|
||||
continue;
|
||||
}
|
||||
|
||||
unowned Meta.Window? meta_window = window.get_meta_window ();
|
||||
if (!window.is_destroyed ()) {
|
||||
clutter_actor_reparent (actor, parents.nth_data (i));
|
||||
InternalUtils.clutter_actor_reparent (actor, parents.nth_data (i));
|
||||
}
|
||||
|
||||
kill_window_effects (window);
|
||||
@ -2389,16 +2393,6 @@ namespace Gala {
|
||||
// Ignore this error
|
||||
}
|
||||
}
|
||||
|
||||
private static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent) {
|
||||
if (actor == new_parent)
|
||||
return;
|
||||
|
||||
actor.ref ();
|
||||
actor.get_parent ().remove_child (actor);
|
||||
new_parent.add_child (actor);
|
||||
actor.unref ();
|
||||
}
|
||||
}
|
||||
|
||||
[CCode (cname="clutter_x11_get_stage_window")]
|
||||
|
Loading…
Reference in New Issue
Block a user