Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compositor: Remove unused functions #635

Merged
merged 6 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
78 changes: 0 additions & 78 deletions compositor/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,6 @@ namespace GreeterCompositor {
});
}

/**
* Get the next window that should be active on a workspace right now. Based on
* stacking order
*
* @param workspace The workspace on which to find the window
* @param backward Whether to get the previous one instead
*/
public static Meta.Window get_next_window (Meta.Workspace workspace, bool backward = false) {
var display = workspace.get_display ();
var window = display.get_tab_next (Meta.TabList.NORMAL, workspace, null, backward);

if (window == null) {
window = display.get_tab_current (Meta.TabList.NORMAL, workspace);
}

return window;
}

/**
* Get the number of toplevel windows on a workspace excluding those that are
* on all workspaces
Expand All @@ -112,65 +94,5 @@ namespace GreeterCompositor {
}
return n;
}

/**
* Creates an actor showing the current contents of the given WindowActor.
*
* @param actor The actor from which to create a shnapshot
* @param inner_rect The inner (actually visible) rectangle of the window
* @param outer_rect The outer (input region) rectangle of the window
*
* @return A copy of the actor at that time or %NULL
*/
public static Clutter.Actor? get_window_actor_snapshot (
Meta.WindowActor actor,
Meta.Rectangle inner_rect,
Meta.Rectangle outer_rect
) {
var texture = actor.get_texture () as Meta.ShapedTexture;

if (texture == null) {
return null;
}

var surface = texture.get_image ({
inner_rect.x - outer_rect.x,
inner_rect.y - outer_rect.y,
inner_rect.width,
inner_rect.height
});

if (surface == null) {
return null;
}

var canvas = new Clutter.Canvas ();
var handler = canvas.draw.connect ((cr) => {
cr.set_source_surface (surface, 0, 0);
cr.paint ();
return false;
});
canvas.set_size (inner_rect.width, inner_rect.height);
SignalHandler.disconnect (canvas, handler);

var container = new Clutter.Actor ();
container.set_size (inner_rect.width, inner_rect.height);
container.content = canvas;

return container;
}
/**
* Ring the system bell, will most likely emit a <beep> error sound or, if the
* audible bell is disabled, flash the display
*
* @param display The display to flash, if necessary
*/
public static void bell (Meta.Display display) {
if (Meta.Prefs.bell_is_audible ()) {
Gdk.beep ();
} else {
display.get_compositor ().flash_display (display);
}
}
}
}
119 changes: 1 addition & 118 deletions compositor/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ using Meta;
namespace GreeterCompositor {

public class WindowManager : Meta.Plugin {
const uint GL_VENDOR = 0x1F00;
const string LOGIND_DBUS_NAME = "org.freedesktop.login1";
const string LOGIND_DBUS_OBJECT_PATH = "/org/freedesktop/login1";

delegate unowned string? GlQueryFunc (uint id);

/**
* {@inheritDoc}
Expand All @@ -47,11 +42,6 @@ namespace GreeterCompositor {
*/
public Clutter.Actor top_window_group { get; protected set; }

/**
* {@inheritDoc}
*/
public Meta.BackgroundGroup background_group { get; protected set; }

public Greeter.SystemBackground system_background { get; private set; }

Meta.PluginInfo info;
Expand All @@ -62,8 +52,6 @@ namespace GreeterCompositor {

//ScreenSaver? screensaver;

Window? moving; //place for the window that is being moved over

//Gee.LinkedList<ModalProxy> modal_stack = new Gee.LinkedList<ModalProxy> ();

Gee.HashSet<Meta.WindowActor> minimizing = new Gee.HashSet<Meta.WindowActor> ();
Expand Down Expand Up @@ -181,37 +169,6 @@ namespace GreeterCompositor {
return list.to_array ();
}

/**
* {@inheritDoc}
*/
public void move_window (Window? window, MotionDirection direction) {
if (window == null)
return;

unowned Meta.Display display = get_display ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();

var active = 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 () == manager.n_workspaces - 1) {
Utils.bell (display);
return;
}

moving = window;

if (!window.is_on_all_workspaces ())
window.change_workspace (next);

next.activate_with_focus (window, display.get_current_time ());
}

public void get_current_cursor_position (out int x, out int y) {
Gdk.Display.get_default ().get_default_seat ().get_pointer ().get_position (null, out x, out y);
}

public override void show_window_menu_for_rect (Meta.Window window, Meta.WindowMenuType menu, Meta.Rectangle rect) {
show_window_menu (window, menu, rect.x, rect.y);
}
Expand Down Expand Up @@ -277,6 +234,7 @@ namespace GreeterCompositor {

switch (which_change) {
case Meta.SizeChange.MAXIMIZE:
case Meta.SizeChange.UNMAXIMIZE:
break;
case Meta.SizeChange.FULLSCREEN:
case Meta.SizeChange.UNFULLSCREEN:
Expand Down Expand Up @@ -351,76 +309,11 @@ namespace GreeterCompositor {
end_animation (ref maximizing, actor);
}

/*workspace switcher*/
List<Clutter.Actor>? windows;
List<Clutter.Actor>? parents;
List<Clutter.Actor>? tmp_actors;

public override void switch_workspace (int from, int to, MotionDirection direction) {
switch_workspace_completed ();
return;
}

void end_switch_workspace () {
if (windows == null || parents == null)
return;

unowned Meta.Display 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);
actor.set_translation (0.0f, 0.0f, 0.0f);

if (actor is Meta.BackgroundGroup) {
actor.x = 0;
// thankfully mutter will take care of stacking it at the right place for us
clutter_actor_reparent (actor, window_group);
continue;
}

var window = actor as WindowActor;

if (window == null || !window.is_destroyed ())
clutter_actor_reparent (actor, parents.nth_data (i));

if (window == null || window.is_destroyed ())
continue;

kill_window_effects (window);

var meta_window = window.get_meta_window ();
if (meta_window.get_workspace () != active_workspace
&& !meta_window.is_on_all_workspaces ())
window.hide ();

// some static windows may have been faded out
if (actor.opacity < 255U) {
actor.save_easing_state ();
actor.set_easing_duration (300);
actor.opacity = 255U;
actor.restore_easing_state ();
}
}

if (tmp_actors != null) {
foreach (var actor in tmp_actors) {
actor.destroy ();
}

tmp_actors = null;
}

windows = null;
parents = null;
moving = null;

switch_workspace_completed ();
}

public override void kill_switch_workspace () {
end_switch_workspace ();
}

public override void confirm_display_change () {
var dialog = new AccessDialog (
Expand Down Expand Up @@ -450,16 +343,6 @@ namespace GreeterCompositor {
public override unowned Meta.PluginInfo? plugin_info () {
return info;
}

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")]
Expand Down